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">
<property name="name" value="AccessAudit"/>
<property name="permission" value="AccessAudit"/>
<property name="groupId" value="audit" />
<property name="group"><ref bean="auditGroup"/></property>
</bean>
<bean id="rmDeclareAuditAsRecordCapability"
parent="declarativeCapability">
<property name="name" value="DeclareAuditAsRecord" />
<property name="permission" value="DeclareAuditAsRecord" />
<property name="groupId" value="audit" />
<property name="group"><ref bean="auditGroup"/></property>
</bean>
<bean id="rmDeleteAuditCapability"
parent="declarativeCapability">
<property name="name" value="DeleteAudit" />
<property name="permission" value="DeleteAudit" />
<property name="groupId" value="audit" />
<property name="group"><ref bean="auditGroup"/></property>
</bean>
<bean id="rmEnableDisableAuditByTypesCapability"
parent="declarativeCapability">
<property name="name" value="EnableDisableAuditByTypes" />
<property name="permission" value="EnableDisableAuditByTypes" />
<property name="groupId" value="audit" />
<property name="group"><ref bean="auditGroup"/></property>
</bean>
<bean id="rmExportAuditCapability"
parent="declarativeCapability">
<property name="name" value="ExportAudit" />
<property name="permission" value="ExportAudit" />
<property name="groupId" value="audit" />
<property name="group"><ref bean="auditGroup"/></property>
</bean>
<bean id="rmSelectAuditMetadataCapability"
parent="declarativeCapability">
<property name="name" value="SelectAuditMetadata" />
<property name="permission" value="SelectAuditMetadata" />
<property name="groupId" value="audit" />
<property name="group"><ref bean="auditGroup"/></property>
</bean>
<!-- Non-Assignable Capabilities -->

View File

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

View File

@@ -16,7 +16,7 @@
<ref bean="rmCreateModifyDestroyUnfiledRecordContainerCapability"/>
</list>
</property>
<property name="groupId" value="filePlanMetadataListsAndEmail" />
<property name="group"><ref bean="filePlanMetadataListsAndEmailGroup"/></property>
</bean>
<!-- Unassignable Capabilities -->

View File

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

View File

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

View File

@@ -7,7 +7,7 @@
parent="rmBaseCapability"
class="org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability">
<property name="name" value="ViewRecords" />
<property name="groupId" value="records" />
<property name="group"><ref bean="recordsGroup"/></property>
</bean>
<bean id="rmUndeclareRecordsCapability"
@@ -27,7 +27,7 @@
<entry key="capabilityCondition.cutoff" value="false"/>
</map>
</property>
<property name="groupId" value="records" />
<property name="group"><ref bean="recordsGroup"/></property>
</bean>
<bean id="rmCreateModifyRecordsInCuttoffFoldersCapability"
@@ -48,7 +48,7 @@
<entry key="capabilityCondition.closed" value="false"/>
</map>
</property>
<property name="groupId" value="cutoff" />
<property name="group"><ref bean="cutoffGroup"/></property>
</bean>
<bean id="rmFileCapability"
@@ -106,7 +106,7 @@
<entry key="capabilityCondition.declared" value="false"/>
</map>
</property>
<property name="groupId" value="records"/>
<property name="group"><ref bean="recordsGroup"/></property>
</bean>
<bean id="rmDeleteRecordsCapability"
@@ -123,7 +123,7 @@
<entry key="capabilityCondition.frozen" value="false"/>
</map>
</property>
<property name="groupId" value="dispositionAndTransfers" />
<property name="group"><ref bean="dispositionAndTransfersGroup"/></property>
</bean>
<bean id="rmEditDeclaredRecordMetadataCapability"
@@ -143,7 +143,7 @@
<entry key="capabilityCondition.declared" value="true"/>
</map>
</property>
<property name="groupId" value="metadataControl"/>
<property name="group"><ref bean="metadataControlGroup"/></property>
</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 -->
@@ -159,7 +159,7 @@
<entry key="capabilityCondition.frozen" value="false"/>
</map>
</property>
<property name="groupId" value="metadataControl"/>
<property name="group"><ref bean="metadataControlGroup"/></property>
</bean>
<bean id="rmEditRecordMetadataCapability"
@@ -181,7 +181,7 @@
<entry key="capabilityCondition.declared" value="false"/>
</map>
</property>
<property name="groupId" value="metadataControl"/>
<property name="group"><ref bean="metadataControlGroup"/></property>
</bean>
<bean id="rmMoveRecordsCapability"
@@ -197,7 +197,7 @@
</map>
</property>
<property name="targetCapability" ref="rmFileRecordsCapability"/>
<property name="groupId" value="metadataControl"/>
<property name="group"><ref bean="metadataControlGroup"/></property>
</bean>
<bean id="rmUpgradeDowngradeAndDeclassifyRecordsCapability"
@@ -209,7 +209,7 @@
<entry key="capabilityCondition.frozen" value="false"/>
</map>
</property>
<property name="groupId" value="classifiedRecords" />
<property name="group"><ref bean="classifiedRecordsGroup"/></property>
</bean>
</beans>

View File

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

View File

@@ -138,6 +138,9 @@
<!-- 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"/>

View File

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

View File

@@ -54,9 +54,8 @@ public abstract class AbstractCapability extends RMSecurityCommon
protected String title;
protected String description;
/** Capability group id and title*/
protected String groupId;
protected String groupTitle;
/** Capability Group */
protected Group group;
/** Indicates whether this is a private capability or not */
protected boolean isPrivate = false;
@@ -311,34 +310,16 @@ public abstract class AbstractCapability extends RMSecurityCommon
// }
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getGroupId()
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getGroup()
*/
public String getGroupId()
public Group getGroup()
{
return this.groupId;
return this.group;
}
public void setGroupId(String groupId)
public void setGroup(Group group)
{
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;
this.group = group;
}
/**

View File

@@ -18,9 +18,6 @@
*/
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.security.AccessStatus;
@@ -93,16 +90,9 @@ public interface Capability
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();
/**
* Gets the group title of a capability
*
* @return String capability group title
*/
String getGroupTitle();
Group getGroup();
}

View File

@@ -95,4 +95,49 @@ public interface CapabilityService
* @return
*/
AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName);
/**
* Gets the list of all the capability groups (in index order)
*
* @return {@link List}<{@link Group}> List of all the capability groups (in index order)
*/
List<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;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -38,6 +40,9 @@ public class CapabilityServiceImpl implements CapabilityService
/** Capabilities */
private Map<String, Capability> capabilities = new HashMap<String, Capability>(57);
/** Groups */
private Map<String, Group> groups = new HashMap<String, Group>(13);
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapability(java.lang.String)
*/
@@ -91,7 +96,6 @@ public class CapabilityServiceImpl implements CapabilityService
}
}
}
return result;
}
@@ -169,4 +173,97 @@ public class CapabilityServiceImpl implements CapabilityService
}
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.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.servlet.http.HttpServletResponse;
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.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.Group;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.security.AccessStatus;
@@ -98,15 +99,19 @@ public class CapabilitiesGet extends DeclarativeWebScript
if (grouped == true)
{
// Construct the map which is needed to build the model
Map<String, GroupedCapabilities> groupedCapabilitiesMap = new HashMap<String, GroupedCapabilities>(13);
Map<String, GroupedCapabilities> groupedCapabilitiesMap = new TreeMap<String, GroupedCapabilities>();
Set<Capability> capabilities = capabilityService.getCapabilities();
for (Capability capability : capabilities)
List<Group> groups = capabilityService.getGroups();
for (Group group : groups)
{
String capabilityGroupTitle = capability.getGroupTitle();
String capabilityGroupTitle = group.getTitle();
if (StringUtils.isNotBlank(capabilityGroupTitle))
{
String capabilityGroupId = capability.getGroupId();
String capabilityGroupId = group.getId();
List<Capability> capabilities = capabilityService.getCapabilitiesByGroup(capabilityGroupId);
for (Capability capability : capabilities)
{
String capabilityName = capability.getName();
String capabilityTitle = capability.getTitle();
@@ -122,7 +127,7 @@ public class CapabilitiesGet extends DeclarativeWebScript
}
}
}
}
model.put("groupedCapabilities", groupedCapabilitiesMap);
}
else