fix out of memory error in management endpoints.
This commit is contained in:
parent
8c30c558b2
commit
a1fd03a444
|
@ -16,4 +16,6 @@ public interface DatasetProfileDao extends DatabaseAccessLayer<DatasetProfile, U
|
|||
|
||||
QueryableList<DatasetProfile> getAuthenticated(QueryableList<DatasetProfile> query, UUID principal, List<Integer> roles);
|
||||
|
||||
List<DatasetProfile> getAllIds();
|
||||
|
||||
}
|
|
@ -15,6 +15,7 @@ import org.springframework.stereotype.Component;
|
|||
import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
@ -86,6 +87,11 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implem
|
|||
return getDatabaseService().getQueryable(DatasetProfile.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DatasetProfile> getAllIds(){
|
||||
return getDatabaseService().getQueryable(DatasetProfile.class).withFields(Collections.singletonList("id")).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(DatasetProfile item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
|
|
|
@ -386,8 +386,9 @@ public class DatasetProfileManager {
|
|||
}
|
||||
|
||||
public void addSchematicsInDatasetProfiles() throws XPathExpressionException {
|
||||
List<DatasetProfile> datasetProfiles = this.databaseRepository.getDatasetProfileDao().getAll().toList();
|
||||
for(DatasetProfile datasetProfile: datasetProfiles){
|
||||
List<DatasetProfile> ids = this.databaseRepository.getDatasetProfileDao().getAllIds();
|
||||
for(DatasetProfile dp: ids){
|
||||
DatasetProfile datasetProfile = this.databaseRepository.getDatasetProfileDao().find(dp.getId());
|
||||
Document document = XmlBuilder.fromXml(datasetProfile.getDefinition());
|
||||
XPathFactory xpathFactory = XPathFactory.newInstance();
|
||||
XPath xpath = xpathFactory.newXPath();
|
||||
|
@ -411,8 +412,9 @@ public class DatasetProfileManager {
|
|||
}
|
||||
|
||||
public void addRdaInSchematicsInDatasetProfiles() throws XPathExpressionException {
|
||||
List<DatasetProfile> datasetProfiles = this.databaseRepository.getDatasetProfileDao().getAll().toList();
|
||||
for(DatasetProfile datasetProfile: datasetProfiles){
|
||||
List<DatasetProfile> ids = this.databaseRepository.getDatasetProfileDao().getAllIds();
|
||||
for(DatasetProfile dp: ids){
|
||||
DatasetProfile datasetProfile = this.databaseRepository.getDatasetProfileDao().find(dp.getId());
|
||||
Document document = XmlBuilder.fromXml(datasetProfile.getDefinition());
|
||||
XPathFactory xpathFactory = XPathFactory.newInstance();
|
||||
XPath xpath = xpathFactory.newXPath();
|
||||
|
|
Loading…
Reference in New Issue