use of org.entando.entando.plugins.jacms.aps.system.services.api.model.ApiContentListBean in project entando-core by entando.
the class ApiContentInterface method extractContents.
protected List<String> extractContents(Properties properties) throws Throwable {
List<String> contentsId = null;
try {
ApiContentListBean bean = this.buildSearchBean(properties);
UserDetails user = (UserDetails) properties.get(SystemConstants.API_USER_PARAMETER);
contentsId = this.getContentListHelper().getContentsId(bean, user);
} catch (ApiException ae) {
throw ae;
} catch (Throwable t) {
_logger.error("error in extractContents", t);
throw new ApsSystemException("Error into API method", t);
}
return contentsId;
}
use of org.entando.entando.plugins.jacms.aps.system.services.api.model.ApiContentListBean in project entando-core by entando.
the class ApiContentInterface method buildSearchBean.
protected ApiContentListBean buildSearchBean(Properties properties) throws ApiException, Throwable {
ApiContentListBean bean = null;
try {
String contentType = properties.getProperty("contentType");
if (null == this.getContentManager().getSmallContentTypesMap().get(contentType)) {
throw new ApiException(IApiErrorCodes.API_PARAMETER_VALIDATION_ERROR, "Content Type '" + contentType + "' does not exist", Response.Status.CONFLICT);
}
String langCode = properties.getProperty(SystemConstants.API_LANG_CODE_PARAMETER);
String filtersParam = properties.getProperty("filters");
EntitySearchFilter[] filters = this.getContentListHelper().getFilters(contentType, filtersParam, langCode);
String[] categoryCodes = null;
String categoriesParam = properties.getProperty("categories");
if (null != categoriesParam && categoriesParam.trim().length() > 0) {
categoryCodes = categoriesParam.split(IContentListHelper.CATEGORIES_SEPARATOR);
}
bean = new ApiContentListBean(contentType, 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;
}
Aggregations