Skip to content

Commit

Permalink
Fix missing parent ids in the vendor MO csv files
Browse files Browse the repository at this point in the history
  • Loading branch information
erssebaggala committed Dec 29, 2018
1 parent bb1eecb commit 740a6c8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.bodastate.boda_bulkcmparser</groupId>
<artifactId>boda-bulkcmparser</artifactId>
<packaging>jar</packaging>
<version>2.0.2</version>
<version>2.0.3</version>
<name>boda-bulkcmparser</name>
<url>http://maven.apache.org</url>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class BodaBulkCMParser {
*
* Since 1.3.0
*/
final static String VERSION = "2.0.2";
final static String VERSION = "2.0.3";


private static final Logger LOGGER = LoggerFactory.getLogger(BodaBulkCMParser.class);
Expand Down Expand Up @@ -1410,13 +1410,15 @@ private void updateThreeGPPAttrMap(){
}

/**
* Collect parameters for vendor specific mo data
* Collect parameters for vendor specific MO data
*/
private void collectVendorMOColumns(){

//If MO is not in the parameter list, then don't continue
if(parameterFile != null && !moColumns.containsKey(vsDataType)) return;



if (!moColumns.containsKey(vsDataType) ) {
moColumns.put(vsDataType, new Stack());
moColumnsParentIds.put(vsDataType, new Stack()); //Holds parent element IDs
Expand All @@ -1425,6 +1427,45 @@ private void collectVendorMOColumns(){
Stack s = moColumns.get(vsDataType);
Stack parentIDStack = moColumnsParentIds.get(vsDataType);

//
//Parent IDs
for (int i = 0; i < xmlTagStack.size(); i++) {
String parentMO = xmlTagStack.get(i).toString();

//If the parent tag is VsDataContainer, look for the
//vendor specific MO in the vsDataContainer-to-vsDataType map.
if (parentMO.startsWith("VsDataContainer")) {
parentMO = vsDataContainerTypeMap.get(parentMO);
}

//The depth at each xml tag index is index+1
int depthKey = i + 1;

//Iterate through the XML attribute tags for the element.
if (xmlAttrStack.get(depthKey) == null) {
continue; //Skip null values
}

Iterator<Map.Entry<String, String>> mIter
= xmlAttrStack.get(depthKey).entrySet().iterator();

while (mIter.hasNext()) {
Map.Entry<String, String> meMap = mIter.next();
//String pName = meMap.getKey();
String pName = parentMO + "_" + meMap.getKey();

if( parentIDStack.search(pName ) < 0 ){
parentIDStack.push(pName);
}

if( parameterFile == null && !s.contains(pName) ){
s.push(pName);
}
}
}

moColumnsParentIds.replace(vsDataType, parentIDStack);

//Only update hte moColumns list if the parameterFile is not set
//else use the list provided in the parameterFile
if( parameterFile == null ){
Expand All @@ -1440,6 +1481,7 @@ private void collectVendorMOColumns(){
}
moColumns.replace(vsDataType, s);
}

//
//Parent IDs
for (int i = 0; i < xmlTagStack.size(); i++) {
Expand Down

0 comments on commit 740a6c8

Please sign in to comment.