use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class WidgetTypeManager method getWidgetTypes.
@Override
public List<WidgetType> getWidgetTypes() {
List<WidgetType> types = new ArrayList<WidgetType>();
types.addAll(this.getCacheWrapper().getWidgetTypes());
BeanComparator comparator = new BeanComparator("code");
Collections.sort(types, comparator);
return types;
}
use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class AbstractEntityService method getShortEntityTypes.
protected PagedMetadata<EntityTypeShortDto> getShortEntityTypes(String entityManagerCode, RestListRequest requestList) {
IEntityManager entityManager = this.extractEntityManager(entityManagerCode);
List<IApsEntity> entityTypes = new ArrayList<>(entityManager.getEntityPrototypes().values());
Map<String, String> fieldMapping = this.getEntityTypeFieldNameMapping();
entityTypes.stream().filter(i -> this.filterObjects(i, requestList.getFilter(), fieldMapping));
Collections.sort(entityTypes, new BeanComparator(this.getFieldName(requestList.getSort(), fieldMapping)));
if (!RestListRequest.DIRECTION_VALUE_DEFAULT.equals(requestList.getDirection())) {
Collections.reverse(entityTypes);
}
List<IApsEntity> sublist = requestList.getSublist(entityTypes);
SearcherDaoPaginatedResult<IApsEntity> result = new SearcherDaoPaginatedResult(entityTypes.size(), sublist);
PagedMetadata<EntityTypeShortDto> pagedMetadata = new PagedMetadata<>(requestList, result);
List<EntityTypeShortDto> body = this.getEntityTypeShortDtoBuilder().convert(sublist);
for (EntityTypeShortDto entityTypeShortDto : body) {
String code = entityTypeShortDto.getCode();
entityTypeShortDto.setStatus(String.valueOf(entityManager.getStatus(code)));
}
pagedMetadata.setBody(body);
return pagedMetadata;
}
use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class DataSourceDumpReport method getComponentsHistory.
public List<ComponentInstallationReport> getComponentsHistory() {
BeanComparator comparator = new BeanComparator("date");
Collections.sort(this._componentsHistory, comparator);
return _componentsHistory;
}
use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class ApiServiceInterface method getServices.
public ArrayList<ServiceInfo> getServices(Properties properties) throws ApiException {
ArrayList<ServiceInfo> services = new ArrayList<ServiceInfo>();
try {
String defaultLangCode = this.getLangManager().getDefaultLang().getCode();
String langCode = properties.getProperty(SystemConstants.API_LANG_CODE_PARAMETER);
String tagParamValue = properties.getProperty("tag");
// String myentandoParamValue = properties.getProperty("myentando");
// Boolean myentando = (null != myentandoParamValue && myentandoParamValue.trim().length() > 0) ? Boolean.valueOf(myentandoParamValue) : null;
langCode = (null != langCode && null != this.getLangManager().getLang(langCode)) ? langCode : defaultLangCode;
Map<String, ApiService> masterServices = this.getApiCatalogManager().getServices(tagParamValue);
Iterator<ApiService> iter = masterServices.values().iterator();
while (iter.hasNext()) {
ApiService service = (ApiService) iter.next();
if (service.isActive() && !service.isHidden() && this.checkServiceAuthorization(service, properties, false)) {
ServiceInfo smallService = this.createServiceInfo(service, langCode, defaultLangCode);
services.add(smallService);
}
}
BeanComparator comparator = new BeanComparator("description");
Collections.sort(services, comparator);
} catch (Throwable t) {
_logger.error("Error extracting services", t);
throw new ApiException(IApiErrorCodes.SERVER_ERROR, "Internal error");
}
return services;
}
use of org.apache.commons.beanutils.BeanComparator in project entando-core by entando.
the class ResourceFinderAction method getImageDimensions.
public List<ImageResourceDimension> getImageDimensions() {
Map<Integer, ImageResourceDimension> master = this.getImageDimensionManager().getImageDimensions();
List<ImageResourceDimension> dimensions = new ArrayList<ImageResourceDimension>(master.values());
BeanComparator comparator = new BeanComparator("dimx");
Collections.sort(dimensions, comparator);
return dimensions;
}
Aggregations