private <T extends MetadataItem> PartialList<Metadata> getMetadatas( int offset, int size, String sortBy, Class<T> clazz) { PartialList<T> items = persistenceService.getAllItems(clazz, offset, size, sortBy); List<Metadata> details = new LinkedList<>(); for (T definition : items.getList()) { details.add(definition.getMetadata()); } return new PartialList<>(details, items.getOffset(), items.getPageSize(), items.getTotalSize()); }
private <T extends MetadataItem> PartialList<Metadata> getMetadatas(Query query, Class<T> clazz) { if (query.isForceRefresh()) { persistenceService.refresh(); } definitionsService.resolveConditionType(query.getCondition()); PartialList<T> items = persistenceService.query( query.getCondition(), query.getSortby(), clazz, query.getOffset(), query.getLimit()); List<Metadata> details = new LinkedList<>(); for (T definition : items.getList()) { details.add(definition.getMetadata()); } return new PartialList<>(details, items.getOffset(), items.getPageSize(), items.getTotalSize()); }