Search in sources :

Example 1 with ApiDataObjectListBean

use of org.entando.entando.aps.system.services.dataobject.api.model.ApiDataObjectListBean in project entando-core by entando.

the class ApiDataObjectInterface method extractDataObjects.

protected List<String> extractDataObjects(Properties properties) throws Throwable {
    List<String> contentsId = null;
    try {
        ApiDataObjectListBean bean = this.buildSearchBean(properties);
        UserDetails user = (UserDetails) properties.get(SystemConstants.API_USER_PARAMETER);
        contentsId = this.getDataObjectListHelper().getDataTypesId(bean, user);
    } catch (ApiException ae) {
        throw ae;
    } catch (Throwable t) {
        _logger.error("error in extractDataObjects", t);
        throw new ApsSystemException("Error into API method", t);
    }
    return contentsId;
}
Also used : ApiDataObjectListBean(org.entando.entando.aps.system.services.dataobject.api.model.ApiDataObjectListBean) UserDetails(com.agiletec.aps.system.services.user.UserDetails) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) ApiException(org.entando.entando.aps.system.services.api.model.ApiException)

Example 2 with ApiDataObjectListBean

use of org.entando.entando.aps.system.services.dataobject.api.model.ApiDataObjectListBean in project entando-core by entando.

the class ApiDataObjectInterface method buildSearchBean.

protected ApiDataObjectListBean buildSearchBean(Properties properties) throws ApiException, Throwable {
    ApiDataObjectListBean bean = null;
    try {
        String dataType = properties.getProperty("dataType");
        if (null == this.getDataObjectManager().getSmallDataTypesMap().get(dataType)) {
            throw new ApiException(IApiErrorCodes.API_PARAMETER_VALIDATION_ERROR, "DataObject Type '" + dataType + "' does not exist", Response.Status.CONFLICT);
        }
        String langCode = properties.getProperty(SystemConstants.API_LANG_CODE_PARAMETER);
        String filtersParam = properties.getProperty("filters");
        EntitySearchFilter[] filters = this.getDataObjectListHelper().getFilters(dataType, filtersParam, langCode);
        String[] categoryCodes = null;
        String categoriesParam = properties.getProperty("categories");
        if (null != categoriesParam && categoriesParam.trim().length() > 0) {
            categoryCodes = categoriesParam.split(IDataTypeListHelper.CATEGORIES_SEPARATOR);
        }
        bean = new ApiDataObjectListBean(dataType, filters, categoryCodes);
    } catch (ApiException ae) {
        throw ae;
    } catch (Throwable t) {
        _logger.error("error in buildSearchBean", t);
        throw new ApsSystemException("Error into API method", t);
    }
    return bean;
}
Also used : ApiDataObjectListBean(org.entando.entando.aps.system.services.dataobject.api.model.ApiDataObjectListBean) 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

ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)2 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)2 ApiDataObjectListBean (org.entando.entando.aps.system.services.dataobject.api.model.ApiDataObjectListBean)2 EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)1 UserDetails (com.agiletec.aps.system.services.user.UserDetails)1