Search in sources :

Example 11 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class BaseFilterAction method getFilterTypes.

/**
 * Restituisce la lista di filtri possibili per il tipo di contenuto specificato.
 * La lista comprende sempre la possibilità di filtrare per i metadati "Data Creazione" e "Data Ultima Modifica" e
 * insieme a tutti gli attributi di contenuto (del tipo specificato) dichiarati ricercabili.
 * La lista è e servizio dell'interfaccia di gestione del filtro.
 * @return La lista di filtri possibili per il tipo di contenuto specificato.
 */
public List<SelectItem> getFilterTypes() {
    List<SelectItem> types = new ArrayList<SelectItem>();
    types.add(new SelectItem(METADATA_KEY_PREFIX + IContentManager.CONTENT_CREATION_DATE_FILTER_KEY, this.getText("label.creationDate")));
    types.add(new SelectItem(METADATA_KEY_PREFIX + IContentManager.CONTENT_MODIFY_DATE_FILTER_KEY, this.getText("label.lastModifyDate")));
    Content prototype = this.getContentManager().createContentType(this.getContentType());
    List<AttributeInterface> contentAttributes = prototype.getAttributeList();
    for (int i = 0; i < contentAttributes.size(); i++) {
        AttributeInterface attribute = contentAttributes.get(i);
        if (attribute.isSearchable()) {
            types.add(new SelectItem(attribute.getName(), this.getText("label.attribute", new String[] { attribute.getName() })));
        }
    }
    return types;
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ArrayList(java.util.ArrayList) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 12 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class ContentListViewerWidgetAction method getAllowedUserFilterTypes.

public List<SelectItem> getAllowedUserFilterTypes() throws ApsSystemException {
    List<SelectItem> types = new ArrayList<SelectItem>();
    try {
        types.add(new SelectItem(UserFilterOptionBean.KEY_FULLTEXT, this.getText("label.fulltext")));
        types.add(new SelectItem(UserFilterOptionBean.KEY_CATEGORY, this.getText("label.category")));
        String contentType = this.getWidget().getConfig().getProperty(IContentListWidgetHelper.WIDGET_PARAM_CONTENT_TYPE);
        Content prototype = this.getContentManager().createContentType(contentType);
        List<AttributeInterface> contentAttributes = prototype.getAttributeList();
        for (int i = 0; i < contentAttributes.size(); i++) {
            AttributeInterface attribute = contentAttributes.get(i);
            if (attribute.isSearchable()) {
                types.add(new SelectItem(UserFilterOptionBean.TYPE_ATTRIBUTE + "_" + attribute.getName(), this.getText("label.attribute", new String[] { attribute.getName() })));
            }
        }
    } catch (Throwable t) {
        _logger.error("Error extracting allowed user filter types", t);
        throw new ApsSystemException("Error extracting allowed user filter types", t);
    }
    return types;
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ArrayList(java.util.ArrayList) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 13 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class AbstractPortalAction method addFlavourWidgetType.

protected void addFlavourWidgetType(String mapCode, WidgetType type, Map<String, List<SelectItem>> mapping) {
    List<SelectItem> widgetTypes = mapping.get(mapCode);
    if (null == widgetTypes) {
        widgetTypes = new ArrayList<SelectItem>();
        mapping.put(mapCode, widgetTypes);
    }
    String title = super.getTitle(type.getCode(), type.getTitles());
    SelectItem item = new SelectItem(type.getCode(), title, mapCode);
    widgetTypes.add(item);
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem)

Example 14 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class AbstractPortalAction method addGroup.

private void addGroup(String code, Map<String, List<SelectItem>> mapping, List<List<SelectItem>> group) {
    List<SelectItem> singleGroup = mapping.get(code);
    if (null != singleGroup) {
        BeanComparator comparator = new BeanComparator("value");
        Collections.sort(singleGroup, comparator);
        group.add(singleGroup);
    }
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Example 15 with SelectItem

use of com.agiletec.aps.util.SelectItem in project entando-core by entando.

the class AbstractApiAction method getPermissionAutorityOptions.

public List<SelectItem> getPermissionAutorityOptions() {
    List<SelectItem> items = new ArrayList<SelectItem>();
    try {
        List<Permission> permissions = new ArrayList<Permission>();
        permissions.addAll(this.getRoleManager().getPermissions());
        BeanComparator comparator = new BeanComparator("description");
        Collections.sort(permissions, comparator);
        for (int i = 0; i < permissions.size(); i++) {
            Permission permission = permissions.get(i);
            items.add(new SelectItem(permission.getName(), this.getPermissionAutorityOptionPrefix() + permission.getDescription()));
        }
    } catch (Throwable t) {
        _logger.error("Error extracting autority options", t);
    }
    return items;
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) ArrayList(java.util.ArrayList) Permission(com.agiletec.aps.system.services.role.Permission) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Aggregations

SelectItem (com.agiletec.aps.util.SelectItem)22 ArrayList (java.util.ArrayList)15 BeanComparator (org.apache.commons.beanutils.BeanComparator)6 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)4 List (java.util.List)4 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)3 HashMap (java.util.HashMap)3 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)2 Category (com.agiletec.aps.system.services.category.Category)2 Lang (com.agiletec.aps.system.services.lang.Lang)2 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)2 RequestContext (com.agiletec.aps.system.RequestContext)1 ICategoryManager (com.agiletec.aps.system.services.category.ICategoryManager)1 IPage (com.agiletec.aps.system.services.page.IPage)1 Permission (com.agiletec.aps.system.services.role.Permission)1 ContentUtilizer (com.agiletec.plugins.jacms.aps.system.services.content.ContentUtilizer)1 ServletRequest (javax.servlet.ServletRequest)1 JspException (javax.servlet.jsp.JspException)1 RootFolderAttributeView (org.entando.entando.aps.system.services.storage.RootFolderAttributeView)1 Shortcut (org.entando.entando.apsadmin.system.services.shortcut.model.Shortcut)1