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

* Sorting capabilities

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@44305 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2012-12-04 12:21:19 +00:00
parent 3e91b7ab54
commit 3ca20e6428
13 changed files with 96 additions and 5 deletions

View File

@@ -54,9 +54,12 @@ public abstract class AbstractCapability extends RMSecurityCommon
protected String title;
protected String description;
/** Capability Group */
/** Capability group */
protected Group group;
/** Capability index */
protected String index;
/** Indicates whether this is a private capability or not */
protected boolean isPrivate = false;
@@ -322,6 +325,19 @@ public abstract class AbstractCapability extends RMSecurityCommon
this.group = group;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getIndex()
*/
public String getIndex()
{
return this.index;
}
public void setIndex(String index)
{
this.index = index;
}
/**
* @see java.lang.Object#hashCode()
*/

View File

@@ -95,4 +95,11 @@ public interface Capability
* @return Group capability group
*/
Group getGroup();
/**
* Gets the index of a capability
*
* @return String capability index
*/
String getIndex();
}

View File

@@ -188,6 +188,7 @@ public class CapabilityServiceImpl implements CapabilityService
Collections.sort(groups, new Comparator<Group>()
{
@Override
public int compare(Group g1, Group g2)
{
return Integer.parseInt(g1.getIndex()) - Integer.parseInt(g2.getIndex());
@@ -220,6 +221,15 @@ public class CapabilityServiceImpl implements CapabilityService
}
}
Collections.sort(capabilities, new Comparator<Capability>()
{
@Override
public int compare(Capability c1, Capability c2)
{
return Integer.parseInt(c1.getIndex()) - Integer.parseInt(c2.getIndex());
}
});
return capabilities;
}

View File

@@ -95,7 +95,7 @@ public class CapabilitiesGet extends DeclarativeWebScript
grouped = Boolean.parseBoolean(groupedString);
}
Map<String, Object> model = new HashMap<String, Object>(1);
Map<String, Object> model = new TreeMap<String, Object>();
if (grouped == true)
{
// Construct the map which is needed to build the model
@@ -174,7 +174,7 @@ public class CapabilitiesGet extends DeclarativeWebScript
this.capabilityGroupTitle = capabilityGroupTitle;
this.capabilityName = capabilityName;
this.capabilityTitle = capabilityTitle;
this.capabilities = new HashMap<String, String>(5);
this.capabilities = new TreeMap<String, String>();
}
public String getGroupId()