use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class AbstractApiFinderAction method addResourceGroup.
private void addResourceGroup(String groupCode, Map<String, List<ApiResource>> mapping, List<List<ApiResource>> group) {
List<ApiResource> singleGroup = mapping.get(groupCode);
if (null != singleGroup) {
BeanComparator comparator = new BeanComparator("resourceName");
Collections.sort(singleGroup, comparator);
group.add(singleGroup);
}
}
use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class GuiFragmentFinderAction method getGuiFragmentPlugins.
public List<SelectItem> getGuiFragmentPlugins() {
List<SelectItem> items = new ArrayList<SelectItem>();
try {
List<String> codes = this.getGuiFragmentManager().loadGuiFragmentPluginCodes();
if (null != codes) {
for (int i = 0; i < codes.size(); i++) {
String code = codes.get(i);
items.add(new SelectItem(code, this.getText(code + ".name")));
}
BeanComparator c = new BeanComparator("value");
Collections.sort(items, c);
}
} catch (Throwable t) {
_logger.error("Error loading guiFragment plugins", t);
throw new RuntimeException("Error loading guiFragment plugins", t);
}
return items;
}
use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class AbstractContentAction method getGroups.
/**
* Restituisce la lista ordinata dei gruppi presenti nel sistema.
* @return La lista dei gruppi presenti nel sistema.
*/
public List<Group> getGroups() {
List<Group> groups = this.getGroupManager().getGroups();
BeanComparator c = new BeanComparator("description");
Collections.sort(groups, c);
return groups;
}
use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class AbstractApsEntityFinderAction method getEntityPrototypes.
public List<IApsEntity> getEntityPrototypes() {
List<IApsEntity> entityPrototypes = null;
try {
Map<String, IApsEntity> modelMap = this.getEntityManager().getEntityPrototypes();
entityPrototypes = new ArrayList<IApsEntity>(modelMap.values());
BeanComparator comparator = new BeanComparator("typeDescr");
Collections.sort(entityPrototypes, comparator);
} catch (Throwable t) {
_logger.error("Error while extracting entity prototypes", t);
throw new RuntimeException("Error while extracting entity prototypes", t);
}
return entityPrototypes;
}
use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class CompositeAttributeConfigAction method getAllowedAttributeElementTypes.
public List<AttributeInterface> getAllowedAttributeElementTypes() {
List<AttributeInterface> attributes = new ArrayList<AttributeInterface>();
try {
IEntityManager entityManager = this.getEntityManager();
Map<String, AttributeInterface> attributeTypes = entityManager.getEntityAttributePrototypes();
Iterator<AttributeInterface> attributeIter = attributeTypes.values().iterator();
while (attributeIter.hasNext()) {
AttributeInterface attribute = attributeIter.next();
if (attribute.isSimple()) {
attributes.add(attribute);
}
}
Collections.sort(attributes, new BeanComparator("type"));
} catch (Throwable t) {
_logger.error("Error extracting the allowed types of attribute elements", t);
// ApsSystemUtils.logThrowable(t, this, "getAllowedAttributeElementTypes");
throw new RuntimeException("Error extracting the allowed types of attribute elements", t);
}
return attributes;
}
Aggregations