Skip to content

Commit

Permalink
Fix collection of 3GPP parameters (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
erssebaggala authored Sep 25, 2019
1 parent c68813b commit 097d45c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 34 deletions.
Binary file modified dist/boda-bulkcmparser.jar
Binary file not shown.
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.2.0</version>
<version>2.2.1</version>
<name>boda-bulkcmparser-pr</name>
<url>http://maven.apache.org</url>
<dependencies>
Expand Down
46 changes: 13 additions & 33 deletions src/main/java/com/bodastage/boda_bulkcmparser/BodaBulkCMParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class BodaBulkCMParser {
*
* Since 1.3.0
*/
final static String VERSION = "2.2.0";
final static String VERSION = "2.2.1";


private static final Logger LOGGER = LoggerFactory.getLogger(BodaBulkCMParser.class);
Expand Down Expand Up @@ -669,7 +669,7 @@ public void parse() throws XMLStreamException, FileNotFoundException, Unsupporte

parserState = ParserStates.EXTRACTING_VALUES;
}

//Reset variables
resetVariables();

Expand Down Expand Up @@ -1045,7 +1045,6 @@ public void endELementEvent(XMLEvent xmlEvent)
}


LOGGER.debug("xmlTagStack:" + xmlTagStack.toString());
//We are at the end of </attributes> in 3GPP tag
if(qName.equals("attributes") && !xmlTagStack.peek().toString().startsWith("VsDataContainer")){
//Collect values for use when separateVsData is false
Expand All @@ -1070,8 +1069,6 @@ public void endELementEvent(XMLEvent xmlEvent)
if(parserState == ParserStates.EXTRACTING_PARAMETERS && vsDataType == null ){
updateThreeGPPAttrMap();
}


return;
}

Expand Down Expand Up @@ -1387,8 +1384,6 @@ public void process3GPPAttributes()
private void saveThreeGPPAttrValues(String mo){

threeGPPAttrValues.clear();
LOGGER.debug("moThreeGPPAttrMap:" + moThreeGPPAttrMap.toString());
LOGGER.debug("threeGPPAttrStack:" + threeGPPAttrStack.toString());

//Some MOs dont have 3GPP attributes e.g. the fileHeader
//and the fileFooter
Expand All @@ -1402,10 +1397,6 @@ private void saveThreeGPPAttrValues(String mo){
current3GPPAttrs = threeGPPAttrStack.get(depth);
}

LOGGER.debug("a3GPPAtrr: " + a3GPPAtrr);
LOGGER.debug("current3GPPAttrs:" + current3GPPAttrs);


for(int i =0; i < a3GPPAtrr.size();i++){
String aAttr = (String)a3GPPAtrr.get(i);

Expand Down Expand Up @@ -1481,9 +1472,6 @@ public void processVendorAttributes() {
Iterator<Map.Entry<String, String>> aIter
= xmlAttrStack.get(depthKey).entrySet().iterator();

LOGGER.debug( "depth:" + depth + " parentMO:" + parentMO +
" xmlAttrStack:" + xmlAttrStack.toString() + " m:" + m.toString());

//If we dont't want to separate the vsDataMo from the 3GPP mos
//strip vsData From the MOs Ids ie.e vsDataSomeMO_id becomes SomeMO_id
if(separateVendorAttributes == false){
Expand All @@ -1500,18 +1488,11 @@ public void processVendorAttributes() {

}
}

//LOGGER.info("parentIdValues:" + parentIdValues.toString());

//Make copy of the columns first
Stack columns = new Stack();

columns = moColumns.get(vsDataType);

//LOGGER.info("vsDataType:" + vsDataType);
//LOGGER.info("columns:" + columns.toString());



//Iterate through the columns already collected
for (int i = 0; i < columns.size(); i++) {
Expand Down Expand Up @@ -1549,35 +1530,34 @@ public void processVendorAttributes() {
paramNames = paramNames + "," + pName;
paramValues = paramValues + "," + pValue;
}


//LOGGER.info("threeGPPAttrValues:" + threeGPPAttrValues.toString());

//If we dont't want to separate the vsDataMo from the 3GPP mos
//strip vsData From the MOs, we must print the 3GPP mos here .
//Get the parameter names and values of the 3GPP MOs
//@TODO: Handle parameter file
String threeGGPMo = vsDataType.replace("vsData", "");
if(separateVendorAttributes == false && xmlTagStack.contains(threeGGPMo)){
//@TODO: comment 3GPP MO attributes and value
Iterator<Map.Entry<String, String>> aIter
= threeGPPAttrValues.entrySet().iterator();
while (aIter.hasNext()) {
Map.Entry<String, String> meMap = aIter.next();
String pValue = toCSVFormat(meMap.getValue());
String pName = meMap.getKey();
//@TODO: collect 3GPP MO attributes and value
Stack _3gppAttr = moThreeGPPAttrMap.get(threeGGPMo);
for(int idx =0; idx < _3gppAttr.size(); idx++){
String pName = _3gppAttr.get(idx).toString();
String pValue= "";

//Skip _id fileds
if(pName.endsWith("_id")) continue;

if(threeGPPAttrValues.containsKey(pName)) pValue = threeGPPAttrValues.get(pName);

paramNames = paramNames + "," + pName;
paramValues = paramValues + "," + pValue;
}

}

String csvFileName = vsDataType;

//Remove vsData if we don't want to separate the 3GPP and vendor attributes
if(separateVendorAttributes == false) csvFileName = csvFileName.replace("vsData", "");

//Write the parameters and values to files.
PrintWriter pw = null;
if (!outputVsDataTypePWMap.containsKey(csvFileName)) {
Expand Down

0 comments on commit 097d45c

Please sign in to comment.