Skip to content

Commit

Permalink
LDDTool: Cleanup output log messages to use consistent formatting and…
Browse files Browse the repository at this point in the history
… remove unnecessary messages - Phase 2 (#191)

LDDTool: Cleanup output log messages to use consistent formatting and remove unnecessary messages. Phase 2, focused on including the LDD Parser error, warning and info messages. Also cloned code for combined LDD JSON file to LDDTool.

Resolves #85
  • Loading branch information
jshughes authored Jul 11, 2020
1 parent 9b6d26d commit 21db3b7
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public class DMDocument extends Object {

// import export file flags
static boolean exportJSONFileFlag = false; // LDDTool, set by -J option
static boolean exportJSONFileAllFlag = false; // LDDTool, set by -6 option
static boolean exportSpecFileFlag = false;
static boolean exportDDFileFlag = false;
static boolean exportJSONAttrFlag = false; // non PDS processing - not currently used
Expand Down Expand Up @@ -324,7 +325,7 @@ public static void main (String args[]) throws Throwable {
messageLevelCountMap.put("2>error", msgCount2error);
messageLevelCountMap.put("3>error", msgCount3error);
messageLevelCountMap.put("4>error", msgCount4error);

// get dates
rTodaysDate = new Date();
sTodaysDate = rTodaysDate.toString();
Expand Down Expand Up @@ -709,6 +710,9 @@ static private void getCommandArgsSecondary (String args[]) {
if (lArg.indexOf('5') > -1) {
exportOWLFileFlag = true;
}
if (lArg.indexOf('6') > -1) {
exportJSONFileAllFlag = true;
}
if (lArg.indexOf('f') > -1) {
aind++;
while (aind < args.length) {
Expand Down Expand Up @@ -1622,13 +1626,23 @@ static void registerMessage (String lMessage) {

static void printErrorMessages () {
String lPreviousGroupTitle = "";
System.out.println (" ");
// System.out.println (" ");
// System.out.println (">> -- Processing Messages --");

// first sort error messages
TreeMap <String, DOMMsgDefn> lMainMsgMap = new TreeMap <String, DOMMsgDefn> ();
for (Iterator <DOMMsgDefn> i = mainMsgArr.iterator(); i.hasNext();) {
DOMMsgDefn lMainMsg = (DOMMsgDefn) i.next();
// System.out.println ("debug printErrorMessages -SORT- lMainMsg.msgOrgText:" + lMainMsg.msgOrgText + " lMainMsg.msgTypeLevel:" + lMainMsg.msgTypeLevel + " lMainMsg.msgOrder.toString():" + lMainMsg.msgOrder.toString());
// System.out.println ("debug printErrorMessages -SORT- lMainMsg.msgTypeLevel.substring(0, 2)):" + lMainMsg.msgTypeLevel.substring(0, 2));

// if debugFlag is false, skip debug messages
// 0>info, 0>warning, 0>error
if (! debugFlag) {
if ((lMainMsg.msgTypeLevel.substring(0, 2)).compareTo("0>") == 0) {
continue;
}
}
String lMapID = lMainMsg.msgTypeLevel + "." + lMainMsg.msgOrder.toString();
lMainMsgMap.put(lMapID, lMainMsg);
// System.out.println ("debug printErrorMessages lMainMsg.msgTypeLevel:" + lMainMsg.msgTypeLevel + " lMainMsg.msgOrder.toString():" + lMainMsg.msgOrder.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ public void writeLDDArtifacts (boolean domFlagxxx, boolean mofFlag) throws java.
DMDocument.registerMessage ("0>info " + "writeLDDArtifacts - DD DocBook Done");
}

// write the OWL File
if (DMDocument.exportOWLFileFlag) {
WriteDOMRDFOWLFile writeDOMRDFOWLFile = new WriteDOMRDFOWLFile ();
writeDOMRDFOWLFile.writeOWLFile (DMDocument.masterPDSSchemaFileDefn.relativeFileSpecOWLRDF_DOM);
DMDocument.registerMessage ("0>info " + "writeLDDArtifacts - OWL File Done");
}

// get the LDD SchemaFileDefn - should be just one; but the Master must be skipped
ArrayList <SchemaFileDefn> lSchemaFileDefnArr = new ArrayList <SchemaFileDefn> (DMDocument.masterSchemaFileSortMap.values());
for (Iterator <SchemaFileDefn> i = lSchemaFileDefnArr.iterator(); i.hasNext();) {
Expand All @@ -238,10 +245,7 @@ public void writeLDDArtifacts (boolean domFlagxxx, boolean mofFlag) throws java.
DMDocument.registerMessage ("0>info " + "writeAllArtifacts - Schema Label - lSchemaFileDefn.identifier:" + lSchemaFileDefn.identifier + " - Done");

// write the 11179 JSON file
//??
if (DMDocument.exportJSONFileFlag) {
// Write11179DDJSONFile write11179DDJSONFile = new Write11179DDJSONFile ();
// write11179DDJSONFile.writeJSONFile (lSchemaFileDefn);
if (DMDocument.exportJSONFileFlag || DMDocument.exportJSONFileAllFlag) {
WriteDOMDDJSONFile writeDOMDDJSONFile = new WriteDOMDDJSONFile ();
writeDOMDDJSONFile.writeJSONFile ();
DMDocument.registerMessage ("0>info " + "writeAllArtifacts - JSON Done");
Expand Down
Loading

0 comments on commit 21db3b7

Please sign in to comment.