Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Performance improvements on entity processing.
  • Loading branch information
dds14002 committed Mar 24, 2020
1 parent c9f106e commit 3d84cde
Showing 1 changed file with 9 additions and 7 deletions.
Expand Up @@ -34,6 +34,11 @@ public class XMLGeiaDataSource implements GeiaDataSource {

}

@SuppressWarnings("unchecked")
private <T extends GeiaEntity> List<T> getEntities(Class<T> clazz) {
return (List<T>) geiaEntityMap.get(clazz);
}

private void processGeiaStd() {

for(GeiaEntity entity : stdModel.getGeiaFullFile()) {
Expand All @@ -43,7 +48,7 @@ public class XMLGeiaDataSource implements GeiaDataSource {
geiaEntityMap.get(entity.getClass()).add(entity);
}

geiaEntityMap.get(XA.class).forEach(xa -> xaList.add((XA) xa));
xaList.addAll(getEntities(XA.class));

for(XA xa : xaList) {
pairXAWithChildren(xa);
Expand All @@ -52,9 +57,8 @@ public class XMLGeiaDataSource implements GeiaDataSource {
}

private void pairXAWithChildren(XA src) {
geiaEntityMap.get(XB.class)
getEntities(XB.class)
.stream()
.map(entity -> (XB)entity)
.filter(xb -> xb.getLcnIndentureCode().charAt(0) == 'A' && src.getEndItemAcronymCode().equals(xb.getEndItemAcronymCode()))
.forEach(xb -> {
pairXBWithChildren(xb);
Expand All @@ -63,17 +67,15 @@ public class XMLGeiaDataSource implements GeiaDataSource {
}

private void pairXBWithChildren(XB src) {
geiaEntityMap.get(XB.class)
getEntities(XB.class)
.stream()
.map(entity -> (XB)entity)
.filter(xb -> xb.getLcn().startsWith(src.getLcn()) && xb.getLcnIndentureCode().charAt(0)-1 == src.getLcnIndentureCode().charAt(0))
.forEach(xb -> {
pairXBWithChildren(xb);
src.getXbChildren().add(xb);
});
geiaEntityMap.get(CA.class)
getEntities(CA.class)
.stream()
.map(entity -> (CA)entity)
.filter(ca -> src.getLcn().equals(ca.getLcn()))
.forEach(ca -> src.getCaChildren().add(ca)); // TODO process CA children
}
Expand Down

0 comments on commit 3d84cde

Please sign in to comment.