use of org.broadleafcommerce.openadmin.server.service.handler.CustomPersistenceHandlerFilter in project BroadleafCommerce by BroadleafCommerce.
the class PersistenceManagerImpl method getCustomPersistenceHandlers.
@Override
public List<CustomPersistenceHandler> getCustomPersistenceHandlers() {
List<CustomPersistenceHandler> cloned = new ArrayList<>();
cloned.addAll(customPersistenceHandlers);
if (getCustomPersistenceHandlerFilters() != null) {
for (CustomPersistenceHandlerFilter filter : getCustomPersistenceHandlerFilters()) {
Iterator<CustomPersistenceHandler> itr = cloned.iterator();
while (itr.hasNext()) {
CustomPersistenceHandler handler = itr.next();
if (!filter.shouldUseHandler(handler.getClass().getName())) {
itr.remove();
}
}
}
}
Collections.sort(cloned, new Comparator<CustomPersistenceHandler>() {
@Override
public int compare(CustomPersistenceHandler o1, CustomPersistenceHandler o2) {
return new Integer(o1.getOrder()).compareTo(new Integer(o2.getOrder()));
}
});
return cloned;
}
Aggregations