Refactor DatasetMigrationService
This commit is contained in:
parent
f38febc22b
commit
eae9a5f7d3
|
@ -55,24 +55,6 @@ public class DatasetMigrationService {
|
|||
this.entityManager = entityManager;
|
||||
}
|
||||
|
||||
public QueryableList<Dataset> datasetQueryableList() {
|
||||
return databaseRepository.getDatasetDao().asQueryable();
|
||||
}
|
||||
|
||||
public List<DatasetWizardModel> getDatasets(Integer skip, Integer take) {
|
||||
List<Dataset> datasets = datasetQueryableList()
|
||||
.orderBy((builder, root) -> builder.desc(root.get("created")))
|
||||
.skip(skip)
|
||||
.take(take)
|
||||
.toList();
|
||||
|
||||
return datasets.stream().map(x -> {
|
||||
DatasetWizardModel dataset = new DatasetWizardModel();
|
||||
dataset.fromDataModel(x);
|
||||
return dataset;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
public void migrate() throws IOException, JAXBException, ParserConfigurationException, InstantiationException, IllegalAccessException, SAXException {
|
||||
DatasetDao datasetDao = databaseRepository.getDatasetDao();
|
||||
long total = datasetDao.asQueryable().count();
|
||||
|
|
Loading…
Reference in New Issue