Search in sources :

Example 6 with BaseFilterUtils

use of com.agiletec.aps.system.common.entity.helper.BaseFilterUtils in project entando-core by entando.

the class ApiContentListBean method getListName.

public String getListName() {
    StringBuffer buffer = new StringBuffer("listName_api");
    buffer.append("-TYPE:" + this.getContentType());
    buffer.append("_FILTERS:");
    if (null != this.getFilters() && this.getFilters().length > 0) {
        BaseFilterUtils filterUtils = new BaseFilterUtils();
        buffer.append(filterUtils.getFilterParam(this.getFilters()));
    } else {
        buffer.append("NULL");
    }
    buffer.append("_CATEGORIES:");
    if (null != this.getCategories() && this.getCategories().length > 0) {
        List<String> categories = Arrays.asList(this.getCategories());
        Collections.sort(categories);
        for (int i = 0; i < categories.size(); i++) {
            if (i > 0) {
                buffer.append("+");
            }
            buffer.append(categories.get(i));
        }
    } else {
        buffer.append("NULL");
    }
    return buffer.toString();
}
Also used : BaseFilterUtils(com.agiletec.aps.system.common.entity.helper.BaseFilterUtils)

Example 7 with BaseFilterUtils

use of com.agiletec.aps.system.common.entity.helper.BaseFilterUtils in project entando-core by entando.

the class ApiUserProfileInterface method getUserProfiles.

public List<String> getUserProfiles(Properties properties) throws Throwable {
    List<String> usernames = null;
    try {
        String userProfileType = properties.getProperty("typeCode");
        IUserProfile prototype = (IUserProfile) this.getUserProfileManager().getEntityPrototype(userProfileType);
        if (null == prototype) {
            throw new ApiException(IApiErrorCodes.API_PARAMETER_VALIDATION_ERROR, "Profile Type '" + userProfileType + "' does not exist", Response.Status.CONFLICT);
        }
        String langCode = properties.getProperty(SystemConstants.API_LANG_CODE_PARAMETER);
        String filtersParam = properties.getProperty("filters");
        BaseFilterUtils filterUtils = new BaseFilterUtils();
        EntitySearchFilter[] filters = filterUtils.getFilters(prototype, filtersParam, langCode);
        usernames = this.getUserProfileManager().searchId(userProfileType, filters);
    } catch (ApiException ae) {
        throw ae;
    } catch (Throwable t) {
        _logger.error("Error searching usernames", t);
        // ApsSystemUtils.logThrowable(t, this, "getUserProfiles");
        throw new ApsSystemException("Error searching usernames", t);
    }
    return usernames;
}
Also used : BaseFilterUtils(com.agiletec.aps.system.common.entity.helper.BaseFilterUtils) IUserProfile(org.entando.entando.aps.system.services.userprofile.model.IUserProfile) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter) ApiException(org.entando.entando.aps.system.services.api.model.ApiException)

Aggregations

BaseFilterUtils (com.agiletec.aps.system.common.entity.helper.BaseFilterUtils)7 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)2 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)2 EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)1 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)1 IUserProfile (org.entando.entando.aps.system.services.userprofile.model.IUserProfile)1