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;
}
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;
}
Aggregations