Search in sources :

Example 6 with BeanComparator

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);
    }
}
Also used : ApiResource(org.entando.entando.aps.system.services.api.model.ApiResource) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Example 7 with BeanComparator

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;
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) ArrayList(java.util.ArrayList) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Example 8 with BeanComparator

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;
}
Also used : Group(com.agiletec.aps.system.services.group.Group) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Example 9 with BeanComparator

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;
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Example 10 with BeanComparator

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;
}
Also used : IEntityManager(com.agiletec.aps.system.common.entity.IEntityManager) ArrayList(java.util.ArrayList) BeanComparator(org.apache.commons.beanutils.BeanComparator) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Aggregations

BeanComparator (org.apache.commons.beanutils.BeanComparator)50 ArrayList (java.util.ArrayList)25 SelectItem (com.agiletec.aps.util.SelectItem)6 NullComparator (org.apache.commons.collections.comparators.NullComparator)6 IEntityManager (com.agiletec.aps.system.common.entity.IEntityManager)5 Group (com.agiletec.aps.system.services.group.Group)5 IApsEntity (com.agiletec.aps.system.common.entity.model.IApsEntity)4 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)4 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)3 Comparator (java.util.Comparator)3 HashMap (java.util.HashMap)3 List (java.util.List)3 ComparatorChain (org.apache.commons.collections.comparators.ComparatorChain)3 ReverseComparator (org.apache.commons.collections.comparators.ReverseComparator)3 Role (com.agiletec.aps.system.services.role.Role)2 WebApplicationContext (org.springframework.web.context.WebApplicationContext)2 SmallEntityType (com.agiletec.aps.system.common.entity.model.SmallEntityType)1 AbstractListAttribute (com.agiletec.aps.system.common.entity.model.attribute.AbstractListAttribute)1 AttributeRole (com.agiletec.aps.system.common.entity.model.attribute.AttributeRole)1 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)1