added counter on wf progress information
This commit is contained in:
parent
8073ac7131
commit
5d29077a43
|
@ -86,27 +86,45 @@ public class IndexOnESJobNode extends AsyncJobNode {
|
|||
String[] splits = getDatasourceInterface().split("::");
|
||||
String datasource = splits[2];
|
||||
String collectionId = splits[3];
|
||||
|
||||
log.info("selecting collection identifiers for "+datasource+" "+collectionId+" ...");
|
||||
List<String> collectionIdentifiers = selectIdentifiers(datasource, collectionId, collectionResourceType);
|
||||
if (!collectionIdentifiers.isEmpty()) {
|
||||
log.info("retrieved "+collectionIdentifiers.size()+" collections");
|
||||
setTotalResourceToIndex(collectionIdentifiers.size());
|
||||
int counter = 0;
|
||||
List <Integer> counters = Arrays.asList(counter);
|
||||
log.info("start indexing loop for collections ... ");
|
||||
collectionIdentifiers.forEach(identifier -> {
|
||||
try {
|
||||
indexing(datasource, collectionId, collectionResourceType, cleanIdentifier(identifier));
|
||||
int value = counters.get(0);
|
||||
counters.set(0, value+1);
|
||||
setCurrentResourceToIndex(counters.get(0));
|
||||
} catch (Throwable t) {
|
||||
log.error(identifier+" "+t);
|
||||
}
|
||||
});
|
||||
log.info("index loop for collections completed");
|
||||
}
|
||||
|
||||
log.info("selecting record identifiers for "+datasource+" "+collectionId+" ...");
|
||||
List<String> recordIdentifiers = selectIdentifiers(datasource, collectionId, recordResourceType);
|
||||
if (!recordIdentifiers.isEmpty()) {
|
||||
log.info("retrieved "+recordIdentifiers.size()+" records");
|
||||
setTotalResourceToIndex(recordIdentifiers.size());
|
||||
int counter = 0;
|
||||
List <Integer> counters = Arrays.asList(counter);
|
||||
log.info("start indexing loop for records ... ");
|
||||
recordIdentifiers.forEach(identifier -> {
|
||||
try {
|
||||
indexing(datasource, collectionId, recordResourceType, cleanIdentifier(identifier));
|
||||
int value = counters.get(0);
|
||||
counters.set(0, value+1);
|
||||
setCurrentResourceToIndex(counters.get(0));
|
||||
} catch (Throwable t) {
|
||||
log.error(identifier+" "+t);
|
||||
}
|
||||
});
|
||||
log.info("index loop for records completed");
|
||||
}
|
||||
}
|
||||
catch (Throwable t) {
|
||||
|
@ -217,4 +235,20 @@ public class IndexOnESJobNode extends AsyncJobNode {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int getCurrentResourceToIndex() {
|
||||
return currentResourceToIndex;
|
||||
}
|
||||
|
||||
public void setCurrentResourceToIndex(int currentResourceToIndex) {
|
||||
this.currentResourceToIndex = currentResourceToIndex;
|
||||
}
|
||||
|
||||
public int getTotalResourceToIndex() {
|
||||
return totalResourceToIndex;
|
||||
}
|
||||
|
||||
public void setTotalResourceToIndex(int totalResourceToIndex) {
|
||||
this.totalResourceToIndex = totalResourceToIndex;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue