Skip to content

Commit

Permalink
Database harvester - Define IMetadataUtils and MetadataRepository as …
Browse files Browse the repository at this point in the history
…class members
  • Loading branch information
josegar74 committed Oct 17, 2024
1 parent 6b7fb4d commit eab298f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class DatabaseHarvesterAligner extends BaseAligner<DatabaseHarvesterParams> impl
private IMetadataUtils metadataUtils;
private IMetadataIndexer metadataIndexer;
private IMetadataSchemaUtils metadataSchemaUtils;
private MetadataRepository metadataRepository;
private HarvestResult result;
private CategoryMapper localCateg;
private GroupMapper localGroups;
Expand Down Expand Up @@ -91,6 +92,7 @@ public DatabaseHarvesterAligner(AtomicBoolean cancelMonitor, Logger log, Service
metadataSchemaUtils = gc.getBean(IMetadataSchemaUtils.class);
metadataUtils = gc.getBean(IMetadataUtils.class);
metadataIndexer = gc.getBean(IMetadataIndexer.class);
metadataRepository = gc.getBean(MetadataRepository.class);
}

@Override
Expand All @@ -110,7 +112,7 @@ public HarvestResult harvest(Logger log) throws Exception {
//--- retrieve harvested uuids for given harvesting node
localCateg = new CategoryMapper(context);
localGroups = new GroupMapper(context);
localUuids = new UUIDMapper(context.getBean(IMetadataUtils.class), params.getUuid());
localUuids = new UUIDMapper(metadataUtils, params.getUuid());

Pair<String, Map<String, Object>> filter = HarvesterUtil.parseXSLFilter(params.getXslfilter());
processName = filter.one();
Expand Down Expand Up @@ -165,7 +167,7 @@ public void align(String metadata) {

private void deleteLocalMetadataNotInDatabase(List<Integer> idsForHarvestingResult) throws Exception {
Set<Integer> idsResultHs = Sets.newHashSet(idsForHarvestingResult);
List<Integer> existingMetadata = context.getBean(MetadataRepository.class).findIdsBy(MetadataSpecs.hasHarvesterUuid(params.getUuid()));
List<Integer> existingMetadata = metadataRepository.findIdsBy(MetadataSpecs.hasHarvesterUuid(params.getUuid()));
for (Integer existingId : existingMetadata) {
if (cancelMonitor.get()) {
return;
Expand Down

0 comments on commit eab298f

Please sign in to comment.