RM-563 (Add group id and title to Capability API and definitions)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@44277 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2012-12-03 22:32:42 +00:00
parent 583b4412a8
commit a06ba9d3c3
17 changed files with 1413 additions and 1047 deletions

View File

@@ -0,0 +1,91 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="groupBase"
abstract="true"
init-method="init"
class="org.alfresco.module.org_alfresco_module_rm.capability.GroupImpl">
<property name="capabilityService" ref="CapabilityService"/>
</bean>
<bean id="auditGroup"
parent="groupBase">
<property name="id" value="audit"/>
<property name="index" value="1"/>
</bean>
<bean id="classifiedRecordsGroup"
parent="groupBase">
<property name="id" value="classifiedRecords"/>
<property name="index" value="2"/>
</bean>
<bean id="cutoffGroup"
parent="groupBase">
<property name="id" value="cutoff"/>
<property name="index" value="3"/>
</bean>
<bean id="dispositionAndTransfersGroup"
parent="groupBase">
<property name="id" value="dispositionAndTransfers"/>
<property name="index" value="4"/>
</bean>
<bean id="eventsGroup"
parent="groupBase">
<property name="id" value="events"/>
<property name="index" value="5"/>
</bean>
<bean id="filePlanMetadataListsAndEmailGroup"
parent="groupBase">
<property name="id" value="filePlanMetadataListsAndEmail"/>
<property name="index" value="6"/>
</bean>
<bean id="folderControlGroup"
parent="groupBase">
<property name="id" value="folderControl"/>
<property name="index" value="7"/>
</bean>
<bean id="holdControlsGroup"
parent="groupBase">
<property name="id" value="holdControls"/>
<property name="index" value="8"/>
</bean>
<bean id="metadataControlGroup"
parent="groupBase">
<property name="id" value="metadataControl"/>
<property name="index" value="9"/>
</bean>
<bean id="recordsGroup"
parent="groupBase">
<property name="id" value="records"/>
<property name="index" value="10"/>
</bean>
<bean id="referencesAndLinksGroup"
parent="groupBase">
<property name="id" value="referencesAndLinks"/>
<property name="index" value="11"/>
</bean>
<bean id="rolesAndAccessRightsGroup"
parent="groupBase">
<property name="id" value="rolesAndAccessRights"/>
<property name="index" value="12"/>
</bean>
<bean id="vitalRecordsGroup"
parent="groupBase">
<property name="id" value="vitalRecords"/>
<property name="index" value="13"/>
</bean>
</beans>

View File

@@ -8,42 +8,42 @@
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="AccessAudit"/> <property name="name" value="AccessAudit"/>
<property name="permission" value="AccessAudit"/> <property name="permission" value="AccessAudit"/>
<property name="groupId" value="audit" /> <property name="group"><ref bean="auditGroup"/></property>
</bean> </bean>
<bean id="rmDeclareAuditAsRecordCapability" <bean id="rmDeclareAuditAsRecordCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="DeclareAuditAsRecord" /> <property name="name" value="DeclareAuditAsRecord" />
<property name="permission" value="DeclareAuditAsRecord" /> <property name="permission" value="DeclareAuditAsRecord" />
<property name="groupId" value="audit" /> <property name="group"><ref bean="auditGroup"/></property>
</bean> </bean>
<bean id="rmDeleteAuditCapability" <bean id="rmDeleteAuditCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="DeleteAudit" /> <property name="name" value="DeleteAudit" />
<property name="permission" value="DeleteAudit" /> <property name="permission" value="DeleteAudit" />
<property name="groupId" value="audit" /> <property name="group"><ref bean="auditGroup"/></property>
</bean> </bean>
<bean id="rmEnableDisableAuditByTypesCapability" <bean id="rmEnableDisableAuditByTypesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="EnableDisableAuditByTypes" /> <property name="name" value="EnableDisableAuditByTypes" />
<property name="permission" value="EnableDisableAuditByTypes" /> <property name="permission" value="EnableDisableAuditByTypes" />
<property name="groupId" value="audit" /> <property name="group"><ref bean="auditGroup"/></property>
</bean> </bean>
<bean id="rmExportAuditCapability" <bean id="rmExportAuditCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="ExportAudit" /> <property name="name" value="ExportAudit" />
<property name="permission" value="ExportAudit" /> <property name="permission" value="ExportAudit" />
<property name="groupId" value="audit" /> <property name="group"><ref bean="auditGroup"/></property>
</bean> </bean>
<bean id="rmSelectAuditMetadataCapability" <bean id="rmSelectAuditMetadataCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="SelectAuditMetadata" /> <property name="name" value="SelectAuditMetadata" />
<property name="permission" value="SelectAuditMetadata" /> <property name="permission" value="SelectAuditMetadata" />
<property name="groupId" value="audit" /> <property name="group"><ref bean="auditGroup"/></property>
</bean> </bean>
<!-- Non-Assignable Capabilities --> <!-- Non-Assignable Capabilities -->

View File

@@ -21,7 +21,7 @@
<entry key="capabilityCondition.frozenOrFrozenChildren" value="false"/> <entry key="capabilityCondition.frozenOrFrozenChildren" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="cutoff" /> <property name="group"><ref bean="cutoffGroup"/></property>
</bean> </bean>
<!-- Transfer --> <!-- Transfer -->
@@ -35,7 +35,7 @@
<ref bean="rmCompleteAllTransfersCapability"/> <ref bean="rmCompleteAllTransfersCapability"/>
</list> </list>
</property> </property>
<property name="groupId" value="dispositionAndTransfers" /> <property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean> </bean>
<!-- Accession --> <!-- Accession -->
@@ -49,7 +49,7 @@
<ref bean="rmCompleteNominatedTransfersCapability"/> <ref bean="rmCompleteNominatedTransfersCapability"/>
</list> </list>
</property> </property>
<property name="groupId" value="dispositionAndTransfers" /> <property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean> </bean>
<!-- Destroy --> <!-- Destroy -->
@@ -70,7 +70,7 @@
<entry key="capabilityCondition.destroyIsScheduled" value="true"/> <entry key="capabilityCondition.destroyIsScheduled" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="dispositionAndTransfers" /> <property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean> </bean>
<!-- Unscheduled Destroy --> <!-- Unscheduled Destroy -->
@@ -91,7 +91,7 @@
<entry key="capabilityCondition.destroyMayBeScheduled" value="true"/> <entry key="capabilityCondition.destroyMayBeScheduled" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="dispositionAndTransfers" /> <property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean> </bean>
<!-- Manually Change Disposition Dates --> <!-- Manually Change Disposition Dates -->
@@ -113,7 +113,7 @@
<entry key="capabilityCondition.isTransferring" value="false" /> <entry key="capabilityCondition.isTransferring" value="false" />
</map> </map>
</property> </property>
<property name="groupId" value="dispositionAndTransfers" /> <property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean> </bean>
<!-- Non-assignable Capabilities --> <!-- Non-assignable Capabilities -->

View File

@@ -3,86 +3,86 @@
<beans> <beans>
<!-- Assignable Capabilities --> <!-- Assignable Capabilities -->
<bean id="rmCreateModifyDestroyFileplanMetadataCapability" <bean id="rmCreateModifyDestroyFileplanMetadataCapability"
parent="compositeCapability"> parent="compositeCapability">
<property name="name" value="CreateModifyDestroyFileplanMetadata"/> <property name="name" value="CreateModifyDestroyFileplanMetadata"/>
<property name="permission" value="CreateModifyDestroyFileplanMetadata"/> <property name="permission" value="CreateModifyDestroyFileplanMetadata"/>
<property name="capabilities"> <property name="capabilities">
<list> <list>
<ref bean="rmCreateRootRecordCategoryCapability"/> <ref bean="rmCreateRootRecordCategoryCapability"/>
<ref bean="rmCreateModifyDestroyRecordCategoryCapability"/> <ref bean="rmCreateModifyDestroyRecordCategoryCapability"/>
<ref bean="rmCreateModifyDestroyUnfiledRecordContainerCapability"/> <ref bean="rmCreateModifyDestroyUnfiledRecordContainerCapability"/>
</list> </list>
</property> </property>
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<!-- Unassignable Capabilities --> <!-- Unassignable Capabilities -->
<bean id="rmCreateRootRecordCategoryCapability" <bean id="rmCreateRootRecordCategoryCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateRootRecordCategory"/> <property name="name" value="CreateRootRecordCategory"/>
<property name="permission" value="CreateModifyDestroyFileplanMetadata"/> <property name="permission" value="CreateModifyDestroyFileplanMetadata"/>
<property name="private" value="true"/> <property name="private" value="true"/>
<property name="kinds"> <property name="kinds">
<list> <list>
<value>FILE_PLAN</value> <value>FILE_PLAN</value>
</list> </list>
</property> </property>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.filling" value="true"/> <entry key="capabilityCondition.filling" value="true"/>
</map> </map>
</property> </property>
</bean> </bean>
<bean id="rmCreateModifyDestroyRecordCategoryCapability" <bean id="rmCreateModifyDestroyRecordCategoryCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyRecordCategory"/> <property name="name" value="CreateModifyDestroyRecordCategory"/>
<property name="permission" value="CreateModifyDestroyFileplanMetadata"/> <property name="permission" value="CreateModifyDestroyFileplanMetadata"/>
<property name="private" value="true"/> <property name="private" value="true"/>
<property name="kinds"> <property name="kinds">
<list> <list>
<value>RECORD_CATEGORY</value> <value>RECORD_CATEGORY</value>
<value>DISPOSITION_SCHEDULE</value> <value>DISPOSITION_SCHEDULE</value>
</list> </list>
</property> </property>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.filling" value="true"/> <entry key="capabilityCondition.filling" value="true"/>
</map> </map>
</property> </property>
</bean> </bean>
<bean id="rmMoveRecordCategoryCapability" <bean id="rmMoveRecordCategoryCapability"
parent="compositeCapability"> parent="compositeCapability">
<property name="name" value="MoveRecordCategory"/> <property name="name" value="MoveRecordCategory"/>
<property name="private" value="true"/> <property name="private" value="true"/>
<property name="undetermined" value="true"/> <property name="undetermined" value="true"/>
<property name="capabilities"> <property name="capabilities">
<list> <list>
<ref bean="rmCreateModifyDestroyFileplanMetadataCapability"/> <ref bean="rmCreateModifyDestroyFileplanMetadataCapability"/>
</list> </list>
</property> </property>
<property name="targetCapability" ref="rmCreateModifyDestroyFileplanMetadataCapability"/> <property name="targetCapability" ref="rmCreateModifyDestroyFileplanMetadataCapability"/>
</bean> </bean>
<bean id="rmCreateModifyDestroyUnfiledRecordContainerCapability" <bean id="rmCreateModifyDestroyUnfiledRecordContainerCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyUnfiledRecordContainer"/> <property name="name" value="CreateModifyDestroyUnfiledRecordContainer"/>
<property name="private" value="true"/> <property name="private" value="true"/>
<property name="kinds"> <property name="kinds">
<list> <list>
<value>UNFILED_RECORD_CONTAINER</value> <value>UNFILED_RECORD_CONTAINER</value>
</list> </list>
</property> </property>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.filling" value="true"/> <entry key="capabilityCondition.filling" value="true"/>
</map> </map>
</property> </property>
</bean> </bean>
</beans> </beans>

View File

@@ -21,7 +21,7 @@
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="holdControls" /> <property name="group"><ref bean="holdControlsGroup"/></property>
</bean> </bean>
<bean id="rmUnfreezeCapability" <bean id="rmUnfreezeCapability"
@@ -34,7 +34,7 @@
<entry key="capabilityCondition.frozenOrHold" value="true"/> <entry key="capabilityCondition.frozenOrHold" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="holdControls" /> <property name="group"><ref bean="holdControlsGroup"/></property>
</bean> </bean>
<bean id="rmViewUpdateReasonsForFreezeCapability" <bean id="rmViewUpdateReasonsForFreezeCapability"
@@ -46,7 +46,7 @@
<entry key="capabilityCondition.frozenOrHold" value="true"/> <entry key="capabilityCondition.frozenOrHold" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="holdControls" /> <property name="group"><ref bean="holdControlsGroup"/></property>
</bean> </bean>
</beans> </beans>

View File

@@ -9,14 +9,14 @@
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateAndAssociateSelectionLists"/> <property name="name" value="CreateAndAssociateSelectionLists"/>
<property name="permission" value="CreateAndAssociateSelectionLists"/> <property name="permission" value="CreateAndAssociateSelectionLists"/>
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<bean id="rmEditSelectionListsCapability" <bean id="rmEditSelectionListsCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="EditSelectionLists" /> <property name="name" value="EditSelectionLists" />
<property name="permission" value="EditSelectionLists" /> <property name="permission" value="EditSelectionLists" />
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<!-- Non-Assignable Capabilities --> <!-- Non-Assignable Capabilities -->

View File

@@ -7,7 +7,7 @@
parent="rmBaseCapability" parent="rmBaseCapability"
class="org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability"> class="org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability">
<property name="name" value="ViewRecords" /> <property name="name" value="ViewRecords" />
<property name="groupId" value="records" /> <property name="group"><ref bean="recordsGroup"/></property>
</bean> </bean>
<bean id="rmUndeclareRecordsCapability" <bean id="rmUndeclareRecordsCapability"
@@ -27,7 +27,7 @@
<entry key="capabilityCondition.cutoff" value="false"/> <entry key="capabilityCondition.cutoff" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="records" /> <property name="group"><ref bean="recordsGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyRecordsInCuttoffFoldersCapability" <bean id="rmCreateModifyRecordsInCuttoffFoldersCapability"
@@ -48,7 +48,7 @@
<entry key="capabilityCondition.closed" value="false"/> <entry key="capabilityCondition.closed" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="cutoff" /> <property name="group"><ref bean="cutoffGroup"/></property>
</bean> </bean>
<bean id="rmFileCapability" <bean id="rmFileCapability"
@@ -106,7 +106,7 @@
<entry key="capabilityCondition.declared" value="false"/> <entry key="capabilityCondition.declared" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="records"/> <property name="group"><ref bean="recordsGroup"/></property>
</bean> </bean>
<bean id="rmDeleteRecordsCapability" <bean id="rmDeleteRecordsCapability"
@@ -123,7 +123,7 @@
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="dispositionAndTransfers" /> <property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean> </bean>
<bean id="rmEditDeclaredRecordMetadataCapability" <bean id="rmEditDeclaredRecordMetadataCapability"
@@ -143,7 +143,7 @@
<entry key="capabilityCondition.declared" value="true"/> <entry key="capabilityCondition.declared" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="metadataControl"/> <property name="group"><ref bean="metadataControlGroup"/></property>
</bean> </bean>
<!-- TODO .. this is being used for the wrong thing! ... should indicate that the use can edit the non-record meta-data of a record --> <!-- TODO .. this is being used for the wrong thing! ... should indicate that the use can edit the non-record meta-data of a record -->
@@ -159,7 +159,7 @@
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="metadataControl"/> <property name="group"><ref bean="metadataControlGroup"/></property>
</bean> </bean>
<bean id="rmEditRecordMetadataCapability" <bean id="rmEditRecordMetadataCapability"
@@ -181,7 +181,7 @@
<entry key="capabilityCondition.declared" value="false"/> <entry key="capabilityCondition.declared" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="metadataControl"/> <property name="group"><ref bean="metadataControlGroup"/></property>
</bean> </bean>
<bean id="rmMoveRecordsCapability" <bean id="rmMoveRecordsCapability"
@@ -197,7 +197,7 @@
</map> </map>
</property> </property>
<property name="targetCapability" ref="rmFileRecordsCapability"/> <property name="targetCapability" ref="rmFileRecordsCapability"/>
<property name="groupId" value="metadataControl"/> <property name="group"><ref bean="metadataControlGroup"/></property>
</bean> </bean>
<bean id="rmUpgradeDowngradeAndDeclassifyRecordsCapability" <bean id="rmUpgradeDowngradeAndDeclassifyRecordsCapability"
@@ -209,7 +209,7 @@
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="classifiedRecords" /> <property name="group"><ref bean="classifiedRecordsGroup"/></property>
</bean> </bean>
</beans> </beans>

View File

@@ -20,7 +20,7 @@
<entry key="capabilityCondition.closed" value="false"/> <entry key="capabilityCondition.closed" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="folderControl" /> <property name="group"><ref bean="folderControlGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyFoldersCapability" <bean id="rmCreateModifyDestroyFoldersCapability"
@@ -41,7 +41,7 @@
<entry key="capabilityCondition.closed" value="false"/> <entry key="capabilityCondition.closed" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="folderControl" /> <property name="group"><ref bean="folderControlGroup"/></property>
</bean> </bean>
<bean id="rmMoveRecordFolderCapability" <bean id="rmMoveRecordFolderCapability"
@@ -74,7 +74,7 @@
<entry key="capabilityCondition.closed" value="true"/> <entry key="capabilityCondition.closed" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="folderControl" /> <property name="group"><ref bean="folderControlGroup"/></property>
</bean> </bean>
<bean id="rmDeclareRecordsInClosedFoldersCapability" <bean id="rmDeclareRecordsInClosedFoldersCapability"
@@ -95,6 +95,6 @@
<entry key="capabilityCondition.declared" value="false"/> <entry key="capabilityCondition.declared" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="folderControl" /> <property name="group"><ref bean="folderControlGroup"/></property>
</bean> </bean>
</beans> </beans>

View File

@@ -2,276 +2,279 @@
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans> <beans>
<bean id="permissionServiceImpl" class="org.alfresco.repo.security.permissions.impl.RMPermissionServiceImpl" init-method="init"> <bean id="permissionServiceImpl" class="org.alfresco.repo.security.permissions.impl.RMPermissionServiceImpl" init-method="init">
<property name="nodeService"> <property name="nodeService">
<ref bean="mtAwareNodeService" /> <ref bean="mtAwareNodeService" />
</property> </property>
<property name="tenantService"> <property name="tenantService">
<ref bean="tenantService"/> <ref bean="tenantService"/>
</property> </property>
<property name="dictionaryService"> <property name="dictionaryService">
<ref bean="dictionaryService" /> <ref bean="dictionaryService" />
</property> </property>
<property name="permissionsDaoComponent"> <property name="permissionsDaoComponent">
<ref bean="permissionsDaoComponent" /> <ref bean="permissionsDaoComponent" />
</property> </property>
<property name="modelDAO"> <property name="modelDAO">
<ref bean="permissionsModelDAO" /> <ref bean="permissionsModelDAO" />
</property> </property>
<property name="authorityService"> <property name="authorityService">
<ref bean="authorityService" /> <ref bean="authorityService" />
</property> </property>
<property name="accessCache"> <property name="accessCache">
<ref bean="permissionsAccessCache" /> <ref bean="permissionsAccessCache" />
</property> </property>
<property name="readersCache"> <property name="readersCache">
<ref bean="readersCache" /> <ref bean="readersCache" />
</property> </property>
<property name="readersDeniedCache"> <property name="readersDeniedCache">
<ref bean="readersDeniedCache" /> <ref bean="readersDeniedCache" />
</property> </property>
<property name="policyComponent"> <property name="policyComponent">
<ref bean="policyComponent" /> <ref bean="policyComponent" />
</property> </property>
<property name="aclDAO"> <property name="aclDAO">
<ref bean="aclDAO" /> <ref bean="aclDAO" />
</property> </property>
<property name="ownableService"> <property name="ownableService">
<ref bean="ownableService" /> <ref bean="ownableService" />
</property> </property>
<property name="anyDenyDenies"> <property name="anyDenyDenies">
<value>${security.anyDenyDenies}</value> <value>${security.anyDenyDenies}</value>
</property> </property>
<property name="dynamicAuthorities"> <property name="dynamicAuthorities">
<list> <list>
<ref bean="ownerDynamicAuthority" /> <ref bean="ownerDynamicAuthority" />
<ref bean="lockOwnerDynamicAuthority" /> <ref bean="lockOwnerDynamicAuthority" />
<ref bean="extendedReaderDynamicAuthority" /> <ref bean="extendedReaderDynamicAuthority" />
</list> </list>
</property> </property>
</bean>
<bean id="extendedReaderDynamicAuthority" class="org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority" />
<!-- Bootstrap records management data -->
<bean id="org_alfresco_module_rm_bootstrapData"
class="org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponent"
parent="module.baseComponent">
<property name="nodeService" ref="nodeService" />
<property name="moduleId" value="org_alfresco_module_rm"/>
<property name="name" value="org_alfresco_module_rm_bootstrapData"/>
<property name="description" value="Bootstrap records management data"/>
<property name="sinceVersion" value="1.0"/>
<property name="appliesFromVersion" value="1.0"/>
<property name="importer" ref="spacesBootstrap"/>
<property name="bootstrapViews">
<list>
<props>
<prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}</prop>
<prop key="location">alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml</prop>
</props>
</list>
</property>
</bean>
<!-- Bootstap the message property files -->
<bean id="org_alfresco_module_rm_resourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.module.org_alfresco_module_rm.messages.notification-service</value>
<value>alfresco.module.org_alfresco_module_rm.messages.admin-service</value>
<value>alfresco.module.org_alfresco_module_rm.messages.records-management-service</value>
<value>alfresco.module.org_alfresco_module_rm.messages.action-service</value>
<value>alfresco.module.org_alfresco_module_rm.messages.audit-service</value>
<value>alfresco.module.org_alfresco_module_rm.messages.capability-service</value>
</list>
</property>
</bean> </bean>
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-model-context.xml"/>
<!-- Load audit config -->
<bean id="org_alfresco_module_rm_userRolesExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.AuthenticatedUserRolesDataExtractor">
<property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" />
<property name="rmService" ref="recordsManagementService" />
<property name="rmSecurityService" ref="recordsManagementSecurityService" />
</bean>
<bean id="org_alfresco_module_rm_namePathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanNamePathDataExtractor">
<property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" />
<property name="rmService" ref="recordsManagementService" />
</bean>
<bean id="org_alfresco_module_rm_nodeRefPathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanNodeRefPathDataExtractor">
<property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" />
<property name="rmService" ref="recordsManagementService" />
</bean>
<bean id="org_alfresco_module_rm_identifierExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanIdentifierDataExtractor">
<property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" />
</bean>
<!-- Bootstrap the permission model -->
<bean id="org_alfresco_module_rm_permissionBootstrap" parent="permissionModelBootstrap">
<property name="model" value="alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml"/>
</bean>
<!-- Import fixed permission definitions for RM -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml"/>
<import resource="classpath:alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml"/>
<!-- Import the RM service's -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-service-context.xml"/>
<!-- Import DOD 5015 -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml"/>
<!-- Import the RM identifier service's -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-id-context.xml"/>
<!-- Import capabilities -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml"/>
<!-- Import the RM action's -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-action-context.xml"/>
<import resource="classpath:alfresco/module/org_alfresco_module_rm/action-context.xml"/>
<!-- Import the RM module patches -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-patch-context.xml"/>
<!-- Import RM UI evaluators -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml"/>
<!-- Import disposition properties -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml"/>
<!-- RM Script API -->
<bean id="scriptRecordsManagementService" parent="baseJavaScriptExtension" class="org.alfresco.module.org_alfresco_module_rm.jscript.ScriptRecordsManagmentService">
<property name="extensionName">
<value>rmService</value>
</property>
<property name="recordsManagementServiceRegistry" ref="RecordsManagementServiceRegistry"/>
<property name="notificationHelper" ref="recordsManagementNotificationHelper"/>
</bean>
<!-- Event types -->
<bean id="rmEventResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.module.org_alfresco_module_rm.rm-events</value>
</list>
</property>
</bean>
<bean id="rmEventType" init-method="init" abstract="true">
<property name="recordsManagementEventService" ref="recordsManagementEventService"/>
</bean>
<bean id="rmEventType.simple" class="org.alfresco.module.org_alfresco_module_rm.event.SimpleRecordsManagementEventTypeImpl" parent="rmEventType"/>
<bean id="rmEventType.superseded" class="org.alfresco.module.org_alfresco_module_rm.event.OnReferenceCreateEventType" parent="rmEventType">
<property name="referenceName" value="{http://www.alfresco.org/model/rmcustom/1.0}supersedes"/>
<property name="recordsManagementService" ref="recordsManagementService"/>
<property name="dispositionService" ref="dispositionService"/>
<property name="recordsManagementActionService" ref="recordsManagementActionService"/>
<property name="policyComponent" ref="policyComponent"/>
</bean>
<bean id="rmEventType.obsolete" class="org.alfresco.module.org_alfresco_module_rm.event.OnReferenceCreateEventType" parent="rmEventType">
<property name="referenceName" value="{http://www.alfresco.org/model/rmcustom/1.0}obsoletes"/>
<property name="recordsManagementService" ref="recordsManagementService"/>
<property name="dispositionService" ref="dispositionService"/>
<property name="recordsManagementActionService" ref="recordsManagementActionService"/>
<property name="policyComponent" ref="policyComponent"/>
</bean>
<bean id="rmEventType.crossReferencedRecordTransfered" class="org.alfresco.module.org_alfresco_module_rm.event.OnReferencedRecordActionedUpon" parent="rmEventType">
<property name="referenceName" value="{http://www.alfresco.org/model/rmcustom/1.0}crossreference"/>
<property name="actionName" value="transferComplete"/>
<property name="nodeService" ref="nodeService"/>
<property name="recordsManagementService" ref="recordsManagementService"/>
<property name="dispositionService" ref="dispositionService"/>
<property name="recordsManagementAdminService" ref="recordsManagementAdminService"/>
<property name="recordsManagementActionService" ref="recordsManagementActionService"/>
<property name="policyComponent" ref="policyComponent"/>
</bean>
<!-- Job context -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-job-context.xml"/>
<!-- Bootstrap bean -->
<bean id="RecordsManagementBootstrap" class="org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordsManagementBootstrap">
<property name="transactionService" ref="transactionService"/>
<!-- init caveatConfig behaviours -->
<property name="caveatConfigService" ref="caveatConfigService"/>
<property name="customEmailMappingService" ref="customEmailMappingService"/>
<property name="recordsManagementAdminService" ref="RecordsManagementAdminService"/>
</bean>
<!-- Java script interface for rm caveat config--> <bean id="extendedReaderDynamicAuthority" class="org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority" />
<bean id="rmConfigServiceScript" parent="baseJavaScriptExtension" class="org.alfresco.module.org_alfresco_module_rm.caveat.ScriptRMCaveatConfigService">
<property name="extensionName"> <!-- Bootstrap records management data -->
<value>caveatConfig</value> <bean id="org_alfresco_module_rm_bootstrapData"
</property> class="org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponent"
<property name="caveatConfigService" ref="caveatConfigService"/> parent="module.baseComponent">
<property name="authorityService" ref="authorityService"/> <property name="nodeService" ref="nodeService" />
</bean> <property name="moduleId" value="org_alfresco_module_rm"/>
<property name="name" value="org_alfresco_module_rm_bootstrapData"/>
<!-- Form Processor Filters to process RM nodes and types --> <property name="description" value="Bootstrap records management data"/>
<property name="sinceVersion" value="1.0"/>
<bean id="baseRMFormFilter" parent="baseFormFilter" abstract="true"> <property name="appliesFromVersion" value="1.0"/>
<property name="namespaceService" ref="NamespaceService"/> <property name="importer" ref="spacesBootstrap"/>
<property name="nodeService" ref="NodeService"/> <property name="bootstrapViews">
<property name="recordsManagementServiceRegistry" ref="RecordsManagementServiceRegistry" /> <list>
<property name="recordsManagementService" ref="recordsManagementService"/> <props>
<property name="recordService" ref="recordService"/> <prop key="path">/${spaces.company_home.childname}/${spaces.dictionary.childname}</prop>
<property name="recordsManagementAdminService" ref="recordsManagementAdminService"/> <prop key="location">alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml</prop>
</bean> </props>
</list>
<bean id="rmNodeFormFilter" </property>
parent="baseRMFormFilter" </bean>
class="org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementNodeFormFilter">
<property name="filterRegistry" ref="nodeFilterRegistry" /> <!-- Bootstap the message property files -->
<property name="dictionaryService" ref="DictionaryService" /> <bean id="org_alfresco_module_rm_resourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="dispositionService" ref="dispositionService"/> <property name="resourceBundles">
</bean> <list>
<value>alfresco.module.org_alfresco_module_rm.messages.notification-service</value>
<bean id="rmTypeFormFilter" <value>alfresco.module.org_alfresco_module_rm.messages.admin-service</value>
parent="baseRMFormFilter" <value>alfresco.module.org_alfresco_module_rm.messages.records-management-service</value>
class="org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementTypeFormFilter"> <value>alfresco.module.org_alfresco_module_rm.messages.action-service</value>
<property name="filterRegistry" ref="typeFilterRegistry" /> <value>alfresco.module.org_alfresco_module_rm.messages.audit-service</value>
<property name="identifierService" ref="recordsManagementIdentifierService"/> <value>alfresco.module.org_alfresco_module_rm.messages.capability-service</value>
</bean> </list>
</property>
<!-- Override email extractor implementation --> </bean>
<bean id="extracter.RFC822" <import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-model-context.xml"/>
class="org.alfresco.module.org_alfresco_module_rm.email.RFC822MetadataExtracter"
parent="baseMetadataExtracter" > <!-- Load audit config -->
<property name="nodeService" ref="nodeService"/>
<property name="supportedDateFormats"> <bean id="org_alfresco_module_rm_userRolesExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.AuthenticatedUserRolesDataExtractor">
<list> <property name="registry" ref="auditModel.extractorRegistry" />
<value>EEE, d MMM yyyy HH:mm:ss Z</value> <property name="nodeService" ref="nodeService" />
<value>EEE, d MMM yy HH:mm:ss Z</value> <property name="rmService" ref="recordsManagementService" />
</list> <property name="rmSecurityService" ref="recordsManagementSecurityService" />
</property> </bean>
</bean>
<bean id="org_alfresco_module_rm_namePathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanNamePathDataExtractor">
<!-- Prevent ghosted records being renditioned --> <property name="registry" ref="auditModel.extractorRegistry" />
<bean id="noRenditionsForGhosts" parent="baseRenditionPreventionClass"> <property name="nodeService" ref="nodeService" />
<constructor-arg value="rma:ghosted"/> <property name="rmService" ref="recordsManagementService" />
</bean> </bean>
<!-- Import the RM webscript's --> <bean id="org_alfresco_module_rm_nodeRefPathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanNodeRefPathDataExtractor">
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml"/> <property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" />
<property name="rmService" ref="recordsManagementService" />
</bean>
<bean id="org_alfresco_module_rm_identifierExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanIdentifierDataExtractor">
<property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" />
</bean>
<!-- Bootstrap the permission model -->
<bean id="org_alfresco_module_rm_permissionBootstrap" parent="permissionModelBootstrap">
<property name="model" value="alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml"/>
</bean>
<!-- Import fixed permission definitions for RM -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml"/>
<import resource="classpath:alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml"/>
<!-- Import the RM service's -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-service-context.xml"/>
<!-- Import DOD 5015 -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml"/>
<!-- Import the RM identifier service's -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-id-context.xml"/>
<!-- Import capabilities -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml"/>
<!-- Import capability groups -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/capability/groups/rm-capability-groups-context.xml"/>
<!-- Import the RM action's -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-action-context.xml"/>
<import resource="classpath:alfresco/module/org_alfresco_module_rm/action-context.xml"/>
<!-- Import the RM module patches -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-patch-context.xml"/>
<!-- Import RM UI evaluators -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml"/>
<!-- Import disposition properties -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml"/>
<!-- RM Script API -->
<bean id="scriptRecordsManagementService" parent="baseJavaScriptExtension" class="org.alfresco.module.org_alfresco_module_rm.jscript.ScriptRecordsManagmentService">
<property name="extensionName">
<value>rmService</value>
</property>
<property name="recordsManagementServiceRegistry" ref="RecordsManagementServiceRegistry"/>
<property name="notificationHelper" ref="recordsManagementNotificationHelper"/>
</bean>
<!-- Event types -->
<bean id="rmEventResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.module.org_alfresco_module_rm.rm-events</value>
</list>
</property>
</bean>
<bean id="rmEventType" init-method="init" abstract="true">
<property name="recordsManagementEventService" ref="recordsManagementEventService"/>
</bean>
<bean id="rmEventType.simple" class="org.alfresco.module.org_alfresco_module_rm.event.SimpleRecordsManagementEventTypeImpl" parent="rmEventType"/>
<bean id="rmEventType.superseded" class="org.alfresco.module.org_alfresco_module_rm.event.OnReferenceCreateEventType" parent="rmEventType">
<property name="referenceName" value="{http://www.alfresco.org/model/rmcustom/1.0}supersedes"/>
<property name="recordsManagementService" ref="recordsManagementService"/>
<property name="dispositionService" ref="dispositionService"/>
<property name="recordsManagementActionService" ref="recordsManagementActionService"/>
<property name="policyComponent" ref="policyComponent"/>
</bean>
<bean id="rmEventType.obsolete" class="org.alfresco.module.org_alfresco_module_rm.event.OnReferenceCreateEventType" parent="rmEventType">
<property name="referenceName" value="{http://www.alfresco.org/model/rmcustom/1.0}obsoletes"/>
<property name="recordsManagementService" ref="recordsManagementService"/>
<property name="dispositionService" ref="dispositionService"/>
<property name="recordsManagementActionService" ref="recordsManagementActionService"/>
<property name="policyComponent" ref="policyComponent"/>
</bean>
<bean id="rmEventType.crossReferencedRecordTransfered" class="org.alfresco.module.org_alfresco_module_rm.event.OnReferencedRecordActionedUpon" parent="rmEventType">
<property name="referenceName" value="{http://www.alfresco.org/model/rmcustom/1.0}crossreference"/>
<property name="actionName" value="transferComplete"/>
<property name="nodeService" ref="nodeService"/>
<property name="recordsManagementService" ref="recordsManagementService"/>
<property name="dispositionService" ref="dispositionService"/>
<property name="recordsManagementAdminService" ref="recordsManagementAdminService"/>
<property name="recordsManagementActionService" ref="recordsManagementActionService"/>
<property name="policyComponent" ref="policyComponent"/>
</bean>
<!-- Job context -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-job-context.xml"/>
<!-- Bootstrap bean -->
<bean id="RecordsManagementBootstrap" class="org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordsManagementBootstrap">
<property name="transactionService" ref="transactionService"/>
<!-- init caveatConfig behaviours -->
<property name="caveatConfigService" ref="caveatConfigService"/>
<property name="customEmailMappingService" ref="customEmailMappingService"/>
<property name="recordsManagementAdminService" ref="RecordsManagementAdminService"/>
</bean>
<!-- Java script interface for rm caveat config-->
<bean id="rmConfigServiceScript" parent="baseJavaScriptExtension" class="org.alfresco.module.org_alfresco_module_rm.caveat.ScriptRMCaveatConfigService">
<property name="extensionName">
<value>caveatConfig</value>
</property>
<property name="caveatConfigService" ref="caveatConfigService"/>
<property name="authorityService" ref="authorityService"/>
</bean>
<!-- Form Processor Filters to process RM nodes and types -->
<bean id="baseRMFormFilter" parent="baseFormFilter" abstract="true">
<property name="namespaceService" ref="NamespaceService"/>
<property name="nodeService" ref="NodeService"/>
<property name="recordsManagementServiceRegistry" ref="RecordsManagementServiceRegistry" />
<property name="recordsManagementService" ref="recordsManagementService"/>
<property name="recordService" ref="recordService"/>
<property name="recordsManagementAdminService" ref="recordsManagementAdminService"/>
</bean>
<bean id="rmNodeFormFilter"
parent="baseRMFormFilter"
class="org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementNodeFormFilter">
<property name="filterRegistry" ref="nodeFilterRegistry" />
<property name="dictionaryService" ref="DictionaryService" />
<property name="dispositionService" ref="dispositionService"/>
</bean>
<bean id="rmTypeFormFilter"
parent="baseRMFormFilter"
class="org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementTypeFormFilter">
<property name="filterRegistry" ref="typeFilterRegistry" />
<property name="identifierService" ref="recordsManagementIdentifierService"/>
</bean>
<!-- Override email extractor implementation -->
<bean id="extracter.RFC822"
class="org.alfresco.module.org_alfresco_module_rm.email.RFC822MetadataExtracter"
parent="baseMetadataExtracter" >
<property name="nodeService" ref="nodeService"/>
<property name="supportedDateFormats">
<list>
<value>EEE, d MMM yyyy HH:mm:ss Z</value>
<value>EEE, d MMM yy HH:mm:ss Z</value>
</list>
</property>
</bean>
<!-- Prevent ghosted records being renditioned -->
<bean id="noRenditionsForGhosts" parent="baseRenditionPreventionClass">
<constructor-arg value="rma:ghosted"/>
</bean>
<!-- Import the RM webscript's -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml"/>
</beans> </beans>

View File

@@ -45,14 +45,14 @@
<entry key="capabilityCondition.hasEvents" value="true"/> <entry key="capabilityCondition.hasEvents" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="events" /> <property name="group"><ref bean="eventsGroup"/></property>
</bean> </bean>
<bean id="rmAttachRulesToMetadataPropertiesCapability" <bean id="rmAttachRulesToMetadataPropertiesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="AttachRulesToMetadataProperties"/> <property name="name" value="AttachRulesToMetadataProperties"/>
<property name="permission" value="AttachRulesToMetadataProperties"/> <property name="permission" value="AttachRulesToMetadataProperties"/>
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<bean id="rmChangeOrDeleteReferencesCapability" <bean id="rmChangeOrDeleteReferencesCapability"
@@ -66,63 +66,63 @@
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="referencesAndLinks" /> <property name="group"><ref bean="referencesAndLinksGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyClassificationGuidesCapability" <bean id="rmCreateModifyDestroyClassificationGuidesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyClassificationGuides"/> <property name="name" value="CreateModifyDestroyClassificationGuides"/>
<property name="permission" value="CreateModifyDestroyClassificationGuides"/> <property name="permission" value="CreateModifyDestroyClassificationGuides"/>
<property name="groupId" value="classifiedRecords" /> <property name="group"><ref bean="classifiedRecordsGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyEventsCapability" <bean id="rmCreateModifyDestroyEventsCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyEvents" /> <property name="name" value="CreateModifyDestroyEvents" />
<property name="permission" value="CreateModifyDestroyEvents" /> <property name="permission" value="CreateModifyDestroyEvents" />
<property name="groupId" value="events" /> <property name="group"><ref bean="eventsGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyFileplanTypesCapability" <bean id="rmCreateModifyDestroyFileplanTypesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyFileplanTypes" /> <property name="name" value="CreateModifyDestroyFileplanTypes" />
<property name="permission" value="CreateModifyDestroyFileplanTypes" /> <property name="permission" value="CreateModifyDestroyFileplanTypes" />
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyRecordTypesCapability" <bean id="rmCreateModifyDestroyRecordTypesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyRecordTypes" /> <property name="name" value="CreateModifyDestroyRecordTypes" />
<property name="permission" value="CreateModifyDestroyRecordTypes" /> <property name="permission" value="CreateModifyDestroyRecordTypes" />
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyReferenceTypesCapability" <bean id="rmCreateModifyDestroyReferenceTypesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyReferenceTypes" /> <property name="name" value="CreateModifyDestroyReferenceTypes" />
<property name="permission" value="CreateModifyDestroyReferenceTypes" /> <property name="permission" value="CreateModifyDestroyReferenceTypes" />
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyRolesCapability" <bean id="rmCreateModifyDestroyRolesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyRoles" /> <property name="name" value="CreateModifyDestroyRoles" />
<property name="permission" value="CreateModifyDestroyRoles" /> <property name="permission" value="CreateModifyDestroyRoles" />
<property name="groupId" value="rolesAndAccessRights" /> <property name="group"><ref bean="rolesAndAccessRightsGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyTimeframesCapability" <bean id="rmCreateModifyDestroyTimeframesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyTimeframes" /> <property name="name" value="CreateModifyDestroyTimeframes" />
<property name="permission" value="CreateModifyDestroyTimeframes" /> <property name="permission" value="CreateModifyDestroyTimeframes" />
<property name="groupId" value="classifiedRecords" /> <property name="group"><ref bean="classifiedRecordsGroup"/></property>
</bean> </bean>
<bean id="rmCreateModifyDestroyUsersAndGroupsCapability" <bean id="rmCreateModifyDestroyUsersAndGroupsCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CreateModifyDestroyUsersAndGroups" /> <property name="name" value="CreateModifyDestroyUsersAndGroups" />
<property name="permission" value="CreateModifyDestroyUsersAndGroups" /> <property name="permission" value="CreateModifyDestroyUsersAndGroups" />
<property name="groupId" value="rolesAndAccessRights" /> <property name="group"><ref bean="rolesAndAccessRightsGroup"/></property>
</bean> </bean>
<bean id="rmCycleVitalRecordsCapability" <bean id="rmCycleVitalRecordsCapability"
@@ -145,7 +145,7 @@
<entry key="capabilityCondition.vitalRecordOrFolder" value="true"/> <entry key="capabilityCondition.vitalRecordOrFolder" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="vitalRecords" /> <property name="group"><ref bean="vitalRecordsGroup"/></property>
</bean> </bean>
<bean id="rmDeleteLinksCapability" <bean id="rmDeleteLinksCapability"
@@ -160,28 +160,28 @@
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="referencesAndLinks" /> <property name="group"><ref bean="referencesAndLinksGroup"/></property>
</bean> </bean>
<bean id="rmDisplayRightsReportCapability" <bean id="rmDisplayRightsReportCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="DisplayRightsReport" /> <property name="name" value="DisplayRightsReport" />
<property name="permission" value="DisplayRightsReport" /> <property name="permission" value="DisplayRightsReport" />
<property name="groupId" value="rolesAndAccessRights" /> <property name="group"><ref bean="rolesAndAccessRightsGroup"/></property>
</bean> </bean>
<bean id="rmMakeOptionalPropertiesMandatoryCapability" <bean id="rmMakeOptionalPropertiesMandatoryCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="MakeOptionalParametersMandatory" /> <property name="name" value="MakeOptionalParametersMandatory" />
<property name="permission" value="MakeOptionalParametersMandatory" /> <property name="permission" value="MakeOptionalParametersMandatory" />
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<bean id="rmManageAccessControlsCapability" <bean id="rmManageAccessControlsCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="ManageAccessControls" /> <property name="name" value="ManageAccessControls" />
<property name="permission" value="ManageAccessControls" /> <property name="permission" value="ManageAccessControls" />
<property name="groupId" value="rolesAndAccessRights" /> <property name="group"><ref bean="rolesAndAccessRightsGroup"/></property>
</bean> </bean>
<bean id="rmManageAccessRightsCapability" <bean id="rmManageAccessRightsCapability"
@@ -194,28 +194,28 @@
<entry key="capabilityCondition.filling" value="true"/> <entry key="capabilityCondition.filling" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="rolesAndAccessRights" /> <property name="group"><ref bean="rolesAndAccessRightsGroup"/></property>
</bean> </bean>
<bean id="rmMapClassificationGuideMetadataCapability" <bean id="rmMapClassificationGuideMetadataCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="MapClassificationGuideMetadata" /> <property name="name" value="MapClassificationGuideMetadata" />
<property name="permission" value="MapClassificationGuideMetadata" /> <property name="permission" value="MapClassificationGuideMetadata" />
<property name="groupId" value="classifiedRecords" /> <property name="group"><ref bean="classifiedRecordsGroup"/></property>
</bean> </bean>
<bean id="rmMapEmailMetadataCapability" <bean id="rmMapEmailMetadataCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="MapEmailMetadata" /> <property name="name" value="MapEmailMetadata" />
<property name="permission" value="MapEmailMetadata" /> <property name="permission" value="MapEmailMetadata" />
<property name="groupId" value="filePlanMetadataListsAndEmail" /> <property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean> </bean>
<bean id="rmPasswordControlCapability" <bean id="rmPasswordControlCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="PasswordControl" /> <property name="name" value="PasswordControl" />
<property name="permission" value="PasswordControl" /> <property name="permission" value="PasswordControl" />
<property name="groupId" value="rolesAndAccessRights" /> <property name="group"><ref bean="rolesAndAccessRightsGroup"/></property>
</bean> </bean>
<bean id="rmPlanningReviewCyclesCapability" <bean id="rmPlanningReviewCyclesCapability"
@@ -230,7 +230,7 @@
<entry key="capabilityCondition.vitalRecordOrFolder" value="true"/> <entry key="capabilityCondition.vitalRecordOrFolder" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="vitalRecords" /> <property name="group"><ref bean="vitalRecordsGroup"/></property>
</bean> </bean>
<bean id="rmTriggerAnEventCapability" <bean id="rmTriggerAnEventCapability"
@@ -250,21 +250,21 @@
<entry key="capabilityCondition.hasEvents" value="true"/> <entry key="capabilityCondition.hasEvents" value="true"/>
</map> </map>
</property> </property>
<property name="groupId" value="dispositionAndTransfers" /> <property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean> </bean>
<bean id="rmUpdateClassificationDatesCapability" <bean id="rmUpdateClassificationDatesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="UpdateClassificationDates" /> <property name="name" value="UpdateClassificationDates" />
<property name="permission" value="UpdateClassificationDates" /> <property name="permission" value="UpdateClassificationDates" />
<property name="groupId" value="classifiedRecords" /> <property name="group"><ref bean="classifiedRecordsGroup"/></property>
</bean> </bean>
<bean id="rmUpdateExemptionCategoriesCapability" <bean id="rmUpdateExemptionCategoriesCapability"
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="UpdateExemptionCategories" /> <property name="name" value="UpdateExemptionCategories" />
<property name="permission" value="UpdateExemptionCategories" /> <property name="permission" value="UpdateExemptionCategories" />
<property name="groupId" value="classifiedRecords" /> <property name="group"><ref bean="classifiedRecordsGroup"/></property>
</bean> </bean>
<bean id="rmUpdateTriggerDatesCapability" <bean id="rmUpdateTriggerDatesCapability"
@@ -276,7 +276,7 @@
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="dispositionAndTransfers" /> <property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean> </bean>
<bean id="rmUpdateVitalRecordCycleInformationCapability" <bean id="rmUpdateVitalRecordCycleInformationCapability"
@@ -288,7 +288,7 @@
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
</map> </map>
</property> </property>
<property name="groupId" value="vitalRecords" /> <property name="group"><ref bean="vitalRecordsGroup"/></property>
</bean> </bean>
<!-- Record Folder capabilities --> <!-- Record Folder capabilities -->

View File

@@ -30,350 +30,331 @@ import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* Abstract capability implementation. * Abstract capability implementation.
* *
* @author Andy Hind * @author Andy Hind
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public abstract class AbstractCapability extends RMSecurityCommon public abstract class AbstractCapability extends RMSecurityCommon
implements Capability, RecordsManagementModel, RMPermissionModel implements Capability, RecordsManagementModel, RMPermissionModel
{ {
/** Logger */ /** Logger */
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(AbstractCapability.class); private static Log logger = LogFactory.getLog(AbstractCapability.class);
/** RM entry voter */ /** RM entry voter */
protected RMEntryVoter voter; protected RMEntryVoter voter;
/** Capability service */ /** Capability service */
protected CapabilityService capabilityService; protected CapabilityService capabilityService;
/** Capability name */ /** Capability name */
protected String name; protected String name;
/** Capability title and description */ /** Capability title and description */
protected String title; protected String title;
protected String description; protected String description;
/** Capability group id and title*/ /** Capability Group */
protected String groupId; protected Group group;
protected String groupTitle;
/** Indicates whether this is a private capability or not */ /** Indicates whether this is a private capability or not */
protected boolean isPrivate = false; protected boolean isPrivate = false;
/** List of actions */ /** List of actions */
// protected List<RecordsManagementAction> actions = new ArrayList<RecordsManagementAction>(1); // protected List<RecordsManagementAction> actions = new ArrayList<RecordsManagementAction>(1);
/** Action names */ /** Action names */
// protected List<String> actionNames = new ArrayList<String>(1); // protected List<String> actionNames = new ArrayList<String>(1);
/** /**
* @param voter RM entry voter * @param voter RM entry voter
*/ */
public void setVoter(RMEntryVoter voter) public void setVoter(RMEntryVoter voter)
{ {
this.voter = voter; this.voter = voter;
} }
/** /**
* @param capabilityService capability service * @param capabilityService capability service
*/ */
public void setCapabilityService(CapabilityService capabilityService) public void setCapabilityService(CapabilityService capabilityService)
{ {
this.capabilityService = capabilityService; this.capabilityService = capabilityService;
} }
/** /**
* Init method * Init method
*/ */
public void init() public void init()
{ {
capabilityService.registerCapability(this); capabilityService.registerCapability(this);
} }
/** /**
* Registers an action * Registers an action
* *
* @param action * @param action
*/ */
// public void registerAction(RecordsManagementAction action) // public void registerAction(RecordsManagementAction action)
// { // {
// this.actions.add(action); // this.actions.add(action);
// this.actionNames.add(action.getName()); // this.actionNames.add(action.getName());
// } // }
/** /**
* @param name capability name * @param name capability name
*/ */
public void setName(String name) public void setName(String name)
{ {
this.name = name; this.name = name;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getName() * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getName()
*/ */
@Override @Override
public String getName() public String getName()
{ {
return name; return name;
} }
/** /**
* @param title capability title * @param title capability title
*/ */
public void setTitle(String title) public void setTitle(String title)
{ {
this.title = title; this.title = title;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getTitle() * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getTitle()
*/ */
@Override @Override
public String getTitle() public String getTitle()
{ {
String title = this.title; String title = this.title;
if (StringUtils.isBlank(title)) if (StringUtils.isBlank(title))
{ {
title = I18NUtil.getMessage("capability." + getName() + ".title"); title = I18NUtil.getMessage("capability." + getName() + ".title");
} }
return title; return title;
} }
/** /**
* @param description capability description * @param description capability description
*/ */
public void setDescription(String description) public void setDescription(String description)
{ {
this.description = description; this.description = description;
} }
/** /**
* @param descriptionId message id * @param descriptionId message id
*/ */
public void setDescriptionId(String descriptionId) public void setDescriptionId(String descriptionId)
{ {
this.description = I18NUtil.getMessage(descriptionId); this.description = I18NUtil.getMessage(descriptionId);
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getDescription() * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getDescription()
*/ */
@Override @Override
public String getDescription() public String getDescription()
{ {
return description; return description;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#isPrivate() * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#isPrivate()
*/ */
public boolean isPrivate() public boolean isPrivate()
{ {
return isPrivate; return isPrivate;
} }
/** /**
* @param isPrivate indicates whether the capability is private or not * @param isPrivate indicates whether the capability is private or not
*/ */
public void setPrivate(boolean isPrivate) public void setPrivate(boolean isPrivate)
{ {
this.isPrivate = isPrivate; this.isPrivate = isPrivate;
} }
/** /**
* Translates the vote to an AccessStatus * Translates the vote to an AccessStatus
* *
* @param vote * @param vote
* @return * @return
*/ */
private AccessStatus translate(int vote) private AccessStatus translate(int vote)
{ {
switch (vote) switch (vote)
{ {
case AccessDecisionVoter.ACCESS_ABSTAIN: case AccessDecisionVoter.ACCESS_ABSTAIN:
return AccessStatus.UNDETERMINED; return AccessStatus.UNDETERMINED;
case AccessDecisionVoter.ACCESS_GRANTED: case AccessDecisionVoter.ACCESS_GRANTED:
return AccessStatus.ALLOWED; return AccessStatus.ALLOWED;
case AccessDecisionVoter.ACCESS_DENIED: case AccessDecisionVoter.ACCESS_DENIED:
return AccessStatus.DENIED; return AccessStatus.DENIED;
default: default:
return AccessStatus.UNDETERMINED; return AccessStatus.UNDETERMINED;
} }
} }
/** /**
* *
* @param nodeRef * @param nodeRef
* @return * @return
*/ */
// public int checkActionConditionsIfPresent(NodeRef nodeRef) // public int checkActionConditionsIfPresent(NodeRef nodeRef)
// { // {
// String prefix = "checkActionConditionsIfPresent" + getName(); // String prefix = "checkActionConditionsIfPresent" + getName();
// int result = getTransactionCache(prefix, nodeRef); // int result = getTransactionCache(prefix, nodeRef);
// if (result != NOSET_VALUE) // if (result != NOSET_VALUE)
// { // {
// return result; // return result;
// } // }
// //
// if (actions.size() > 0) // if (actions.size() > 0)
// { // {
// for (RecordsManagementAction action : actions) // for (RecordsManagementAction action : actions)
// {
// if (action.isExecutable(nodeRef, null))
// { // {
// return setTransactionCache(prefix, nodeRef, AccessDecisionVoter.ACCESS_GRANTED); // if (action.isExecutable(nodeRef, null))
// {
// return setTransactionCache(prefix, nodeRef, AccessDecisionVoter.ACCESS_GRANTED);
// }
// } // }
// } // return setTransactionCache(prefix, nodeRef, AccessDecisionVoter.ACCESS_DENIED);
// return setTransactionCache(prefix, nodeRef, AccessDecisionVoter.ACCESS_DENIED); // }
// } // else
// else // {
// { // return setTransactionCache(prefix, nodeRef, AccessDecisionVoter.ACCESS_GRANTED);
// return setTransactionCache(prefix, nodeRef, AccessDecisionVoter.ACCESS_GRANTED); // }
// } // }
/**
* @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.
* <p>
* 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)
{
return result;
}
if (checkRmRead(nodeRef) == AccessDecisionVoter.ACCESS_DENIED)
{
result = AccessDecisionVoter.ACCESS_DENIED;
}
// else if (checkActionConditionsIfPresent(nodeRef) == AccessDecisionVoter.ACCESS_DENIED)
// {
// result = AccessDecisionVoter.ACCESS_DENIED;
// }
else
{
result = hasPermissionImpl(nodeRef);
}
return setTransactionCache(prefix, nodeRef, 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#getActionNames()
*/
// public List<String> getActionNames()
// {
// return actionNames;
// }
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getActions()
*/
// public List<RecordsManagementAction> getActions()
// {
// return actions;
// } // }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#hasPermission(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getGroup()
*/ */
public AccessStatus hasPermission(NodeRef nodeRef) public Group getGroup()
{ {
return translate(hasPermissionRaw(nodeRef)); return this.group;
} }
/** public void setGroup(Group group)
* Determines whether the current user has permission on this capability. {
* <p> this.group = group;
* 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)
{
return result;
}
if (checkRmRead(nodeRef) == AccessDecisionVoter.ACCESS_DENIED) /**
{ * @see java.lang.Object#hashCode()
result = AccessDecisionVoter.ACCESS_DENIED; */
} @Override
//else if (checkActionConditionsIfPresent(nodeRef) == AccessDecisionVoter.ACCESS_DENIED) public int hashCode()
// { {
// result = AccessDecisionVoter.ACCESS_DENIED; final int prime = 31;
// } int result = 1;
else result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
{ return result;
result = hasPermissionImpl(nodeRef); }
}
return setTransactionCache(prefix, nodeRef, result); /**
} * @see java.lang.Object#equals(java.lang.Object)
*/
/** @Override
* Default implementation. Override if different behaviour required. public boolean equals(Object obj)
* {
* @param nodeRef if (this == obj)
* @return return true;
*/ if (obj == null)
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#getActionNames()
*/
// public List<String> getActionNames()
// {
// return actionNames;
// }
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getActions()
*/
// public List<RecordsManagementAction> getActions()
// {
// return actions;
// }
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getGroupId()
*/
public String getGroupId()
{
return this.groupId;
}
public void setGroupId(String groupId)
{
this.groupId = groupId;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getGroupTitle()
*/
public String getGroupTitle()
{
String groupTitle = this.groupTitle;
if (StringUtils.isBlank(groupTitle))
{
groupTitle = I18NUtil.getMessage("capability.group." + getGroupId() + ".title");
}
return groupTitle;
}
public void setGroupTitle(String groupTitle)
{
this.groupTitle = groupTitle;
}
/**
* @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; return false;
} if (getClass() != obj.getClass())
else if (!getName().equals(other.getName())) return false;
return false; final AbstractCapability other = (AbstractCapability) obj;
return true; if (getName() == null)
} {
if (other.getName() != null)
return false;
}
else if (!getName().equals(other.getName()))
return false;
return true;
}
} }

View File

@@ -18,91 +18,81 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.capability; package org.alfresco.module.org_alfresco_module_rm.capability;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.AccessStatus;
/** /**
* Capability Interface. * Capability Interface.
* *
* @author andyh * @author andyh
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public interface Capability public interface Capability
{ {
/** /**
* Does this capability apply to this nodeRef? * Does this capability apply to this nodeRef?
* @param nodeRef * @param nodeRef
* @return * @return
*/ */
AccessStatus hasPermission(NodeRef nodeRef); AccessStatus hasPermission(NodeRef nodeRef);
/** /**
* *
* @param nodeRef * @param nodeRef
* @return * @return
*/ */
int hasPermissionRaw(NodeRef nodeRef); int hasPermissionRaw(NodeRef nodeRef);
/** /**
* Evaluates the capability. * Evaluates the capability.
* *
* @param nodeRef * @param nodeRef
* @return * @return
*/ */
int evaluate(NodeRef nodeRef); int evaluate(NodeRef nodeRef);
/** /**
* Evaluates the capability, taking into account a target. * Evaluates the capability, taking into account a target.
* *
* @param source source node reference * @param source source node reference
* @param target target node reference * @param target target node reference
* @return int permission value * @return int permission value
*/ */
int evaluate(NodeRef source, NodeRef target); int evaluate(NodeRef source, NodeRef target);
/** /**
* Indicates whether this is a private capability or not. Private capabilities are used internally, otherwise * 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. * they are made available to the user to assign to roles.
* *
* @return boolean true if private, false otherwise * @return boolean true if private, false otherwise
*/ */
boolean isPrivate(); boolean isPrivate();
/** /**
* Get the name of the capability * Get the name of the capability
* *
* @return String capability name * @return String capability name
*/ */
String getName(); String getName();
/** /**
* Get the title of the capability * Get the title of the capability
* *
* @return String capability title * @return String capability title
*/ */
String getTitle(); String getTitle();
/** /**
* Get the description of the capability * Get the description of the capability
* *
* @return String capability description * @return String capability description
*/ */
String getDescription(); String getDescription();
/** /**
* Gets the group id of a capability * Gets the group of a capability
* *
* @return String capability group id * @return Group capability group
*/ */
String getGroupId(); Group getGroup();
/**
* Gets the group title of a capability
*
* @return String capability group title
*/
String getGroupTitle();
} }

View File

@@ -27,7 +27,7 @@ import org.alfresco.service.cmr.security.AccessStatus;
/** /**
* Capability service implementation * Capability service implementation
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.0 * @since 2.0
*/ */
@@ -35,14 +35,14 @@ public interface CapabilityService
{ {
/** /**
* Register a capability * Register a capability
* *
* @param capability capability * @param capability capability
*/ */
void registerCapability(Capability capability); void registerCapability(Capability capability);
/** /**
* Get a named capability. * Get a named capability.
* *
* @param name capability name * @param name capability name
* @return {@link Capability} capability or null if not found * @return {@link Capability} capability or null if not found
*/ */
@@ -50,14 +50,14 @@ public interface CapabilityService
/** /**
* Get a list of all the assignable capabilities. * Get a list of all the assignable capabilities.
* *
* @return {@link Set}<{@link Capability}> set of all the assignable capabilities * @return {@link Set}<{@link Capability}> set of all the assignable capabilities
*/ */
Set<Capability> getCapabilities(); Set<Capability> getCapabilities();
/** /**
* Get a list of all the capabilities, optionally including those that are non-assignable. * 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 * @param includePrivate indicates that the private, or non-assignable capabilities are included in the result
* @return {@link Set}<{@link Capability}> set of capabilities * @return {@link Set}<{@link Capability}> set of capabilities
*/ */
@@ -65,7 +65,7 @@ public interface CapabilityService
/** /**
* Get all the capabilities access state based on the current user for the assignable capabilities. * Get all the capabilities access state based on the current user for the assignable capabilities.
* *
* @param nodeRef node reference * @param nodeRef node reference
* @return * @return
*/ */
@@ -73,14 +73,14 @@ public interface CapabilityService
/** /**
* Get all the capabilities access state based on the current user. * Get all the capabilities access state based on the current user.
* *
* @param nodeRef node reference * @param nodeRef node reference
* @return * @return
*/ */
Map<Capability, AccessStatus> getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate); Map<Capability, AccessStatus> getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate);
/** /**
* *
* @param nodeRef * @param nodeRef
* @param capabilityNames * @param capabilityNames
* @return * @return
@@ -89,10 +89,55 @@ public interface CapabilityService
/** /**
* Helper method to get the access state for a single capability. * Helper method to get the access state for a single capability.
* *
* @param nodeRef * @param nodeRef
* @param capabilityName * @param capabilityName
* @return * @return
*/ */
AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName); 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<Group> 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<Capability> getCapabilitiesByGroup(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<Capability> 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);
} }

View File

@@ -18,7 +18,9 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.capability; package org.alfresco.module.org_alfresco_module_rm.capability;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@@ -35,138 +37,233 @@ import org.alfresco.util.ParameterCheck;
*/ */
public class CapabilityServiceImpl implements CapabilityService public class CapabilityServiceImpl implements CapabilityService
{ {
/** Capabilities */ /** Capabilities */
private Map<String, Capability> capabilities = new HashMap<String, Capability>(57); private Map<String, Capability> capabilities = new HashMap<String, Capability>(57);
/** /** Groups */
* @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapability(java.lang.String) private Map<String, Group> groups = new HashMap<String, Group>(13);
*/
@Override
public Capability getCapability(String name)
{
ParameterCheck.mandatoryString("name", name);
return capabilities.get(name); /**
} * @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#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<Capability> getCapabilities() * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities()
{ */
return getCapabilities(true); @Override
} public Set<Capability> getCapabilities()
{
/** return getCapabilities(true);
* @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities(boolean) }
*/
@Override /**
public Set<Capability> getCapabilities(boolean includePrivate) * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities(boolean)
{ */
Set<Capability> result = null; @Override
if (includePrivate == true) public Set<Capability> getCapabilities(boolean includePrivate)
{ {
result = new HashSet<Capability>(capabilities.values()); Set<Capability> result = null;
} if (includePrivate == true)
else {
{ result = new HashSet<Capability>(capabilities.values());
result = new HashSet<Capability>(capabilities.size()); }
for (Capability capability : capabilities.values()) else
{ {
if (capability.isPrivate() == false) result = new HashSet<Capability>(capabilities.size());
for (Capability capability : capabilities.values())
{ {
result.add(capability); if (capability.isPrivate() == false)
{
result.add(capability);
}
} }
} }
} return result;
}
return result; /**
} * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef)
*/
public Map<Capability, AccessStatus> 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) }
*/
public Map<Capability, AccessStatus> 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<Capability, AccessStatus> getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
/** Set<Capability> listOfCapabilites = getCapabilities(includePrivate);
* @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef, boolean) HashMap<Capability, AccessStatus> answer = new HashMap<Capability, AccessStatus>();
*/ for (Capability capability : listOfCapabilites)
@Override {
public Map<Capability, AccessStatus> getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
Set<Capability> listOfCapabilites = getCapabilities(includePrivate);
HashMap<Capability, AccessStatus> answer = new HashMap<Capability, AccessStatus>();
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<Capability, AccessStatus> getCapabilitiesAccessState(NodeRef nodeRef, List<String> capabilityNames)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
ParameterCheck.mandatory("capabilityNames", capabilityNames);
HashMap<Capability, AccessStatus> answer = new HashMap<Capability, AccessStatus>();
for (String capabilityName : capabilityNames)
{
Capability capability = capabilities.get(capabilityName);
if (capability != null)
{
AccessStatus status = capability.hasPermission(nodeRef); AccessStatus status = capability.hasPermission(nodeRef);
if (answer.put(capability, status) != null) if (answer.put(capability, status) != null)
{ {
throw new IllegalStateException(); throw new IllegalStateException();
} }
} }
} return answer;
return answer; }
}
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilityAccessState(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef, java.util.List)
*/ */
@Override public Map<Capability, AccessStatus> getCapabilitiesAccessState(NodeRef nodeRef, List<String> capabilityNames)
public AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName) {
{ ParameterCheck.mandatory("nodeRef", nodeRef);
ParameterCheck.mandatory("nodeRef", nodeRef); ParameterCheck.mandatory("capabilityNames", capabilityNames);
ParameterCheck.mandatory("capabilityName", capabilityName);
AccessStatus result = AccessStatus.UNDETERMINED; HashMap<Capability, AccessStatus> answer = new HashMap<Capability, AccessStatus>();
Capability capability = getCapability(capabilityName); for (String capabilityName : capabilityNames)
if (capability != null) {
{ Capability capability = capabilities.get(capabilityName);
List<String> list = Collections.singletonList(capabilityName); if (capability != null)
Map<Capability, AccessStatus> map = getCapabilitiesAccessState(nodeRef, list); {
result = map.get(capability); AccessStatus status = capability.hasPermission(nodeRef);
} if (answer.put(capability, status) != null)
return result; {
} 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<String> list = Collections.singletonList(capabilityName);
Map<Capability, AccessStatus> map = getCapabilitiesAccessState(nodeRef, list);
result = map.get(capability);
}
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getGroups()
*/
@Override
public List<Group> getGroups()
{
List<Group> groups = new ArrayList<Group>();
for (Map.Entry<String, Group> entry : this.groups.entrySet())
{
groups.add(entry.getValue());
}
Collections.sort(groups, new Comparator<Group>()
{
public int compare(Group g1, Group g2)
{
return Integer.parseInt(g1.getIndex()) - Integer.parseInt(g2.getIndex());
}
});
return groups;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesByGroup(java.lang.String)
*/
@Override
public List<Capability> getCapabilitiesByGroup(String groupId)
{
ParameterCheck.mandatoryString("groupId", groupId);
String id = this.groups.get(groupId).getId();
List<Capability> capabilities = new ArrayList<Capability>();
for (Capability capability : getCapabilities())
{
Group group = capability.getGroup();
if (group != null)
{
if (group.getId().equalsIgnoreCase(id))
{
capabilities.add(capability);
}
}
}
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<Capability> getCapabilitiesByGroup(Group group)
{
ParameterCheck.mandatory("group", group);
return getCapabilitiesByGroup(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());
}
} }

View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.capability;
/**
* Group interface
*
* @author Tuna Aksoy
* @since 2.1
*/
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 String the group index
*/
String getIndex();
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
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 String 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 String getIndex()
{
return this.index;
}
public void setIndex(String index)
{
this.index = index;
}
}

View File

@@ -22,13 +22,14 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.TreeMap;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability; 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.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.Group;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.AccessStatus;
@@ -41,165 +42,169 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
public class CapabilitiesGet extends DeclarativeWebScript public class CapabilitiesGet extends DeclarativeWebScript
{ {
private RecordsManagementService recordsManagementService; private RecordsManagementService recordsManagementService;
private CapabilityService capabilityService; private CapabilityService capabilityService;
public void setRecordsManagementService(RecordsManagementService recordsManagementService) public void setRecordsManagementService(RecordsManagementService recordsManagementService)
{ {
this.recordsManagementService = recordsManagementService; this.recordsManagementService = recordsManagementService;
} }
public void setCapabilityService(CapabilityService capabilityService) public void setCapabilityService(CapabilityService capabilityService)
{ {
this.capabilityService = capabilityService; this.capabilityService = capabilityService;
} }
/** /**
* @see org.alfresco.repo.web.scripts.content.StreamContent#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) * @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 @Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{ {
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars(); Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String storeType = templateVars.get("store_type"); String storeType = templateVars.get("store_type");
String storeId = templateVars.get("store_id"); String storeId = templateVars.get("store_id");
String nodeId = templateVars.get("id"); String nodeId = templateVars.get("id");
NodeRef nodeRef = null; NodeRef nodeRef = null;
if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(nodeId)) if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(nodeId))
{ {
nodeRef = new NodeRef(new StoreRef(storeType, storeId), nodeId); nodeRef = new NodeRef(new StoreRef(storeType, storeId), nodeId);
} }
else else
{ {
// we are talking about the file plan node // we are talking about the file plan node
// TODO we are making the assumption there is only one file plan here! // TODO we are making the assumption there is only one file plan here!
List<NodeRef> filePlans = recordsManagementService.getFilePlans(); List<NodeRef> filePlans = recordsManagementService.getFilePlans();
if (filePlans.isEmpty() == true) if (filePlans.isEmpty() == true)
{
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "No file plan node has been found.");
}
else if (filePlans.size() != 1)
{
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "More than one file plan has been found.");
}
nodeRef = filePlans.get(0);
}
boolean grouped = false;
String groupedString = req.getParameter("grouped");
if (StringUtils.isNotBlank(groupedString))
{
grouped = Boolean.parseBoolean(groupedString);
}
Map<String, Object> model = new HashMap<String, Object>(1);
if (grouped == true)
{
// Construct the map which is needed to build the model
Map<String, GroupedCapabilities> groupedCapabilitiesMap = new HashMap<String, GroupedCapabilities>(13);
Set<Capability> capabilities = capabilityService.getCapabilities();
for (Capability capability : capabilities)
{
String capabilityGroupTitle = capability.getGroupTitle();
if (StringUtils.isNotBlank(capabilityGroupTitle))
{ {
String capabilityGroupId = capability.getGroupId(); throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "No file plan node has been found.");
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);
}
} }
} else if (filePlans.size() != 1)
model.put("groupedCapabilities", groupedCapabilitiesMap);
}
else
{
boolean includePrivate = false;
String includePrivateString = req.getParameter("includeAll");
if (StringUtils.isNotBlank(includePrivateString))
{
includePrivate = Boolean.parseBoolean(includePrivateString);
}
Map<Capability, AccessStatus> map = capabilityService.getCapabilitiesAccessState(nodeRef, includePrivate);
List<String> list = new ArrayList<String>(map.size());
for (Map.Entry<Capability, AccessStatus> entry : map.entrySet())
{
AccessStatus accessStatus = entry.getValue();
if (AccessStatus.DENIED.equals(accessStatus) == false)
{ {
Capability capability = entry.getKey(); throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "More than one file plan has been found.");
list.add(capability.getName());
} }
} nodeRef = filePlans.get(0);
model.put("capabilities", list); }
}
return model; boolean grouped = false;
} String groupedString = req.getParameter("grouped");
if (StringUtils.isNotBlank(groupedString))
{
grouped = Boolean.parseBoolean(groupedString);
}
/** Map<String, Object> model = new HashMap<String, Object>(1);
* Class to represent grouped capabilities for use in a Freemarker template if (grouped == true)
* {
*/ // Construct the map which is needed to build the model
public class GroupedCapabilities Map<String, GroupedCapabilities> groupedCapabilitiesMap = new TreeMap<String, GroupedCapabilities>();
{
private String capabilityGroupId;
private String capabilityGroupTitle;
private String capabilityName;
private String capabilityTitle;
private Map<String, String> capabilities;
public GroupedCapabilities(String capabilityGroupId, String capabilityGroupTitle, String capabilityName, String capabilityTitle) List<Group> groups = capabilityService.getGroups();
{ for (Group group : groups)
this.capabilityGroupId = capabilityGroupId; {
this.capabilityGroupTitle = capabilityGroupTitle; String capabilityGroupTitle = group.getTitle();
this.capabilityName = capabilityName; if (StringUtils.isNotBlank(capabilityGroupTitle))
this.capabilityTitle = capabilityTitle; {
this.capabilities = new HashMap<String, String>(5); String capabilityGroupId = group.getId();
}
public String getGroupId() List<Capability> capabilities = capabilityService.getCapabilitiesByGroup(capabilityGroupId);
{ for (Capability capability : capabilities)
return this.capabilityGroupId; {
} String capabilityName = capability.getName();
String capabilityTitle = capability.getTitle();
public String getGroupTitle() if (groupedCapabilitiesMap.containsKey(capabilityGroupId))
{ {
return this.capabilityGroupTitle; 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);
}
public String getCapabilityName() Map<Capability, AccessStatus> map = capabilityService.getCapabilitiesAccessState(nodeRef, includePrivate);
{ List<String> list = new ArrayList<String>(map.size());
return this.capabilityName; for (Map.Entry<Capability, AccessStatus> entry : map.entrySet())
} {
AccessStatus accessStatus = entry.getValue();
if (AccessStatus.DENIED.equals(accessStatus) == false)
{
Capability capability = entry.getKey();
list.add(capability.getName());
}
}
model.put("capabilities", list);
}
public String getCapabilityTitle() return model;
{ }
return this.capabilityTitle;
}
public Map<String, String> getCapabilities() /**
{ * Class to represent grouped capabilities for use in a Freemarker template
return this.capabilities; *
} */
public class GroupedCapabilities
{
private String capabilityGroupId;
private String capabilityGroupTitle;
private String capabilityName;
private String capabilityTitle;
private Map<String, String> capabilities;
public void addCapability(String capabilityName, String capabilityTitle) public GroupedCapabilities(String capabilityGroupId, String capabilityGroupTitle, String capabilityName, String capabilityTitle)
{ {
this.capabilities.put(capabilityName, capabilityTitle); this.capabilityGroupId = capabilityGroupId;
} this.capabilityGroupTitle = capabilityGroupTitle;
} this.capabilityName = capabilityName;
this.capabilityTitle = capabilityTitle;
this.capabilities = new HashMap<String, String>(5);
}
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<String, String> getCapabilities()
{
return this.capabilities;
}
public void addCapability(String capabilityName, String capabilityTitle)
{
this.capabilities.put(capabilityName, capabilityTitle);
}
}
} }