Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpotterc0k2013-07-03 12:50:02 -0400
committerGerrit Code Review @ Eclipse.org2013-07-09 19:57:57 -0400
commit800725effd597aa587dda88dec2ed4a717443e86 (patch)
tree90d353cb4c2299fe503d0eafda1180352f752026
parent7677a938f6398ea7138c28fda54605ba324a1828 (diff)
downloadorg.eclipse.osee-800725effd597aa587dda88dec2ed4a717443e86.tar.gz
org.eclipse.osee-800725effd597aa587dda88dec2ed4a717443e86.tar.xz
org.eclipse.osee-800725effd597aa587dda88dec2ed4a717443e86.zip
refinement[ats_J3VWW]: Handle new column in Doors export file
Change-Id: I602d65abe0394a789acf5cbaccac6e2a19786aaa Signed-off-by: mpotterc0k <marc.a.potter@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/DoorsArtifactExtractorTest.java16
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/support/doorsArtifactExtractor/sample_DOORS_export.htm61
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsArtifactExtractor.java174
3 files changed, 196 insertions, 55 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/DoorsArtifactExtractorTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/DoorsArtifactExtractorTest.java
index 5b8d49fdcf..be86cf15bc 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/DoorsArtifactExtractorTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/DoorsArtifactExtractorTest.java
@@ -28,6 +28,7 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.operation.NullOperationLogger;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifact;
+import org.eclipse.osee.framework.skynet.core.importing.RoughArtifactKind;
import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
import org.eclipse.osee.framework.skynet.core.importing.parsers.DoorsArtifactExtractor;
import org.junit.Before;
@@ -64,6 +65,16 @@ public class DoorsArtifactExtractorTest {
IMAGE_CONTENT,
"Paragraph Number"};
+ private static final RoughArtifactKind[] ARTIFACT_TYPES = {
+ RoughArtifactKind.CONTAINER,
+ RoughArtifactKind.SECONDARY,
+ RoughArtifactKind.SECONDARY,
+ RoughArtifactKind.SECONDARY,
+ RoughArtifactKind.SECONDARY,
+ RoughArtifactKind.SECONDARY,
+ RoughArtifactKind.PRIMARY,
+ RoughArtifactKind.SECONDARY,};
+
private static final String DOCUMENT_APPLICABILITY = "Document 1";
@ClassRule
@@ -103,6 +114,10 @@ public class DoorsArtifactExtractorTest {
String actualName = artifact.getName();
assertEquals("Artifact Name is incorrect", expectedName, actualName);
+ RoughArtifactKind expectedType = ARTIFACT_TYPES[index];
+ RoughArtifactKind actualType = artifact.getRoughArtifactKind();
+ assertEquals("Artifact Type is incorrect", expectedType, actualType);
+
/***********************************************************
* Prime item diagram. is checked here because it is the most complicated artifact in the example
*/
@@ -157,7 +172,6 @@ public class DoorsArtifactExtractorTest {
*/
if (COMPANY_DOCUMENTS.equals(actualName)) {
String theHtml = artifact.getRoughAttribute(CoreAttributeTypes.HTMLContent.getName());
- int theValue = theHtml.indexOf("ABC-DEF");
assertEquals("Document Applicability filter failed", theHtml.indexOf("ABC-DEF"), -1);
}
}
diff --git a/plugins/org.eclipse.osee.client.integration.tests/support/doorsArtifactExtractor/sample_DOORS_export.htm b/plugins/org.eclipse.osee.client.integration.tests/support/doorsArtifactExtractor/sample_DOORS_export.htm
index aa7a20698a..d8a0ee913e 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/support/doorsArtifactExtractor/sample_DOORS_export.htm
+++ b/plugins/org.eclipse.osee.client.integration.tests/support/doorsArtifactExtractor/sample_DOORS_export.htm
@@ -7,6 +7,7 @@
<th width=420 align=Left>Requirements</th>
<th width=83 align=Left>Object Number</th>
<th width=52 align=Left>Req?</th>
+<th width=160 align=Left>Data Type</th>
<th width=93 align=Left>Parent ID</th>
<th width=130 align=Left>Effectivity</th>
<th width=160 align=Left>Paragraph Heading</th>
@@ -25,6 +26,7 @@
</DIV></b><br></td>
<td>1</td>
<td>False</td>
+<td>Heading</td>
<td><br></td>
<td><br></td>
<td>SCOPE</td>
@@ -43,6 +45,7 @@
</td>
<td>1.0-1</td>
<td>False</td>
+<td>Information</td>
<td><br></td>
<td><br></td>
<td>SCOPE</td>
@@ -62,6 +65,7 @@
</DIV></b><br></td>
<td>2</td>
<td>False</td>
+<td>Heading</td>
<td><br></td>
<td><br></td>
<td>APPLICABLE DOCUMENTS</td>
@@ -81,6 +85,7 @@
</DIV></b><br></td>
<td>2.2</td>
<td>False</td>
+<td>Heading</td>
<td><br></td>
<td><br></td>
<td>Non-Government documents.</td>
@@ -100,6 +105,7 @@
</DIV></b><br></td>
<td>2.2.1</td>
<td>False</td>
+<td>Heading</td>
<td><br></td>
<td><br></td>
<td>Company documents.</td>
@@ -118,6 +124,7 @@
</td>
<td>2.2.1.0-3</td>
<td>False</td>
+<td>Information</td>
<td><br></td>
<td><br></td>
<td>Company documents.</td>
@@ -136,6 +143,7 @@
</td>
<td>2.2.1.0-6</td>
<td>False</td>
+<td>Information</td>
<td><br></td>
<td><br></td>
<td>Company documents.</td>
@@ -154,6 +162,7 @@
</td>
<td>2.2.1.0-8</td>
<td>False</td>
+<td>Information</td>
<td><br></td>
<td><br></td>
<td>Company documents.</td>
@@ -173,6 +182,7 @@
</DIV></b><br></td>
<td>3</td>
<td>False</td>
+<td>Heading</td>
<td><br></td>
<td><br></td>
<td>REQUIREMENTS</td>
@@ -192,6 +202,7 @@
</DIV></b><br></td>
<td>3.1</td>
<td>False</td>
+<td>Heading</td>
<td><br></td>
<td><br></td>
<td>Prime item definition.</td>
@@ -209,7 +220,8 @@
</a>The subsystem shall be integrated <br>
</td>
<td>3.1.0-1</td>
-<td>True</td>
+<td>False</td>
+<td>Requirement</td>
<td>SREQ-1234<br>SREQ-5678<br>SREQ-2468<br>SREQ-1357<br>SREQ-0987<br>SREQ-4321</td>
<td>Earth</td>
<td>Prime item definition.</td>
@@ -235,6 +247,7 @@
</td>
<td>3.1.0-4</td>
<td>False</td>
+<td>Information</td>
<td><br></td>
<td><br></td>
<td>Prime item definition.</td>
@@ -310,6 +323,7 @@
</td>
<td>1.2.3.4.5.6.7.8.9</td>
<td>False</td>
+<td>Table</td>
<td><br></td>
<td><br></td>
<td>Row</td>
@@ -328,6 +342,7 @@
</DIV></b><br></td>
<td>3.1.1</td>
<td>False</td>
+<td>Heading</td>
<td><br></td>
<td><br></td>
<td>Prime item diagram.</td>
@@ -346,6 +361,7 @@
</td>
<td>3.1.1.0-3</td>
<td>False</td>
+<td>Figure</td>
<td><br></td>
<td><br></td>
<td>Prime item diagram.</td>
@@ -364,6 +380,7 @@
</td>
<td>3.1.1.0-3</td>
<td>False</td>
+<td>Figure</td>
<td><br></td>
<td><br></td>
<td>Prime item diagram.</td>
@@ -376,6 +393,48 @@
<td nowrap align="left"><a href = "sample_DOORS_export#X5948"> EXA-43<br> (5948)</a>(IN)<br>
<small>...</small></td>
</tr>
+
+<tr><td>EXA-1</td>
+<td><a name="X1">
+</a><b>1
+<DIV style="margin-left: 36px">SCOPE
+</DIV></b><br></td>
+<td>3.1.2</td>
+<td>False</td>
+<td>Not Defined</td>
+<td><br></td>
+<td><br></td>
+<td>Bad Row</td>
+<td><br></td>
+<td><br></td>
+<td><br></td>
+<td><br></td>
+<td><br></td>
+<td><br></td>
+<td nowrap align="left"><a href = "sample_DOORS_export#X5880"> EXA-1<br> (5880)</a>(IN)<br>
+<small>...</small></td>
+</tr>
+<tr><td>EXA-2</td>
+<td><a name="X2">
+</a>This verifies that a Not Defined row will not be imported <br>
+</td>
+<td>1.0-1</td>
+<td>False</td>
+<td>Not Defined</td>
+<td><br></td>
+<td><br></td>
+<td>SCOPE</td>
+<td>Some Documented information</td>
+<td><br></td>
+<td><br></td>
+<td><br></td>
+<td><br></td>
+<td><br></td>
+<td nowrap align="left"><a href = "sample_DOORS_export#X5881"> EXA-2<br> (5881)</a>(IN)<br>
+<small>...</small></td>
+</tr>
+
+
</table>
<DIV align="center"><p><a href = "http://www.ibm.com/software/awdtools/doors/">Produced by DOORS 9.3.0.6</a></DIV>
</body>
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsArtifactExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsArtifactExtractor.java
index e44ee28717..6396979a1a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsArtifactExtractor.java
@@ -70,16 +70,84 @@ public class DoorsArtifactExtractor extends AbstractArtifactExtractor {
CoreAttributeTypes.VerificationEvent,
null,
null,
- null}; // Last
- // one
- // is
- // actually
- // a
- // string
+ null}; // Last one is actually a string
private String guidString = "";
private boolean isRequirement;
private String subsystem;
private String documentApplicability = "";
+ private DataTypeEnum lastDataType = DataTypeEnum.OTHER;
+
+ private static enum RowTypeEnum {
+ ID("ID"),
+ REQUIREMENTS("Requirements"),
+ OBJECT_NUMBER("Object Number"),
+ IS_REQ("Req?"),
+ PARENT_ID("Parent ID"),
+ PARAGRAPH_HEADING("Paragraph Heading"),
+ DOCUMENT_APPLICABILITY("Document Applicability"),
+ VERIFICATION_CRITERIA("Verification Criteria (V-PIDS_Verification)"),
+ CHANGE_STATUS("Change Status"),
+ OBJECT_HEADING("Proposed Object Heading"),
+ OBJECT_TEXT("Proposed Object Text"),
+ CHANGE_RATIONALE("Change Rationale"),
+ LINKS("Links"),
+ GUID("OSEE GUID"),
+ SUBSYSTEM("Subsystem"),
+ DATA_TYPE("Data Type"),
+ OTHER("");
+
+ private final static Map<String, RowTypeEnum> rawStringToRowType = new HashMap<String, RowTypeEnum>();
+
+ public String _rowType;
+
+ RowTypeEnum(String rowType) {
+ _rowType = rowType;
+ }
+
+ public static synchronized RowTypeEnum fromString(String value) {
+ if (rawStringToRowType.isEmpty()) {
+ for (RowTypeEnum enumStatus : RowTypeEnum.values()) {
+ RowTypeEnum.rawStringToRowType.put(enumStatus._rowType, enumStatus);
+ }
+ }
+ RowTypeEnum returnVal = rawStringToRowType.get(value);
+ if (returnVal == null) {
+ if (value.indexOf("Requirements") != -1) {
+ returnVal = REQUIREMENTS;
+ }
+ }
+ return returnVal != null ? returnVal : OTHER;
+ }
+
+ }
+
+ private static enum DataTypeEnum {
+ HEADING("Heading"),
+ INFORMATION("Information"),
+ REQUIREMENT("Requirement"),
+ TABLE("Table"),
+ FIGURE("Figure"),
+ LIST("List"),
+ NOT_DEFINED("Not Defined"),
+ OTHER("");
+
+ public String _dataType;
+ private final static Map<String, DataTypeEnum> rawStringToDataType = new HashMap<String, DataTypeEnum>();
+
+ DataTypeEnum(String dataType) {
+ _dataType = dataType;
+ }
+
+ public static synchronized DataTypeEnum fromString(String value) {
+ if (rawStringToDataType.isEmpty()) {
+ for (DataTypeEnum enumStatus : DataTypeEnum.values()) {
+ DataTypeEnum.rawStringToDataType.put(enumStatus._dataType, enumStatus);
+ }
+ }
+ DataTypeEnum returnVal = rawStringToDataType.get(value);
+ return returnVal != null ? returnVal : OTHER;
+ }
+ }
@Override
public String getDescription() {
@@ -290,8 +358,11 @@ public class DoorsArtifactExtractor extends AbstractArtifactExtractor {
SAXParser parser = new SAXParser();
Handler theHandler = new Handler();
parser.setContentHandler(theHandler);
- parser.parse(fileName);
-
+ try {
+ parser.parse(fileName);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
@Override
@@ -319,49 +390,6 @@ public class DoorsArtifactExtractor extends AbstractArtifactExtractor {
}
}
- private static enum RowTypeEnum {
- ID("ID"),
- REQUIREMENTS("Requirements"),
- OBJECT_NUMBER("Object Number"),
- IS_REQ("Req?"),
- PARENT_ID("Parent ID"),
- PARAGRAPH_HEADING("Paragraph Heading"),
- DOCUMENT_APPLICABILITY("Document Applicability"),
- VERIFICATION_CRITERIA("Verification Criteria (V-PIDS_Verification)"),
- CHANGE_STATUS("Change Status"),
- OBJECT_HEADING("Proposed Object Heading"),
- OBJECT_TEXT("Proposed Object Text"),
- CHANGE_RATIONALE("Change Rationale"),
- LINKS("Links"),
- GUID("OSEE GUID"),
- SUBSYSTEM("Subsystem"),
- OTHER("");
-
- private final static Map<String, RowTypeEnum> rawStringToRowType = new HashMap<String, RowTypeEnum>();
-
- public String _rowType;
-
- RowTypeEnum(String rowType) {
- _rowType = rowType;
- }
-
- public static synchronized RowTypeEnum fromString(String value) {
- if (rawStringToRowType.isEmpty()) {
- for (RowTypeEnum enumStatus : RowTypeEnum.values()) {
- RowTypeEnum.rawStringToRowType.put(enumStatus._rowType, enumStatus);
- }
- }
- RowTypeEnum returnVal = rawStringToRowType.get(value);
- if (returnVal == null) {
- if (value.indexOf("Requirements") != -1) {
- returnVal = REQUIREMENTS;
- }
- }
- return returnVal != null ? returnVal : OTHER;
- }
-
- }
-
public void foundStartOfWorksheet(String sheetName) {
// Nothing to do in DOORS file Leave in in case this changes (it is
// called at start)
@@ -387,7 +415,7 @@ public class DoorsArtifactExtractor extends AbstractArtifactExtractor {
/***************************************************************
* First check the document applicability box, if it is empty this is a header row
*/
- boolean isHeaderRow = false;
+ boolean isHeaderRow = false, foundDataType = false;
int rowIndex;
for (rowIndex = 0; rowIndex < row.length; rowIndex++) {
RowTypeEnum rowType = rowIndexToRowTypeMap.get(rowIndex);
@@ -460,13 +488,50 @@ public class DoorsArtifactExtractor extends AbstractArtifactExtractor {
break;
case IS_REQ:
- isRequirement = rowValue.trim().equals("True");
+ if (!foundDataType) {
+ isRequirement = rowValue.trim().equals("True");
+ }
break;
case SUBSYSTEM:
subsystem = rowValue.trim();
break;
+ case DATA_TYPE:
+ foundDataType = true;
+ DataTypeEnum dataType = DataTypeEnum.fromString(rowValue.trim());
+ switch (dataType) {
+ case HEADING:
+ isRequirement = false;
+ lastDataType = DataTypeEnum.HEADING;
+ break;
+
+ case REQUIREMENT:
+ isRequirement = true;
+ lastDataType = DataTypeEnum.REQUIREMENT;
+ break;
+
+ case TABLE:
+ case INFORMATION:
+ case LIST:
+ case FIGURE:
+ isRequirement = lastDataType.equals(DataTypeEnum.REQUIREMENT);
+ break;
+
+ case NOT_DEFINED:
+ // bad row -- clear the artifact and terminate processing
+ inArtifact = false;
+ theArtifact.clear();
+ return;
+
+ case OTHER:
+ foundDataType = false;
+ lastDataType = DataTypeEnum.OTHER;
+ break;
+ }
+
+ break;
+
case CHANGE_STATUS:
case OBJECT_HEADING:
case OBJECT_TEXT:
@@ -495,6 +560,9 @@ public class DoorsArtifactExtractor extends AbstractArtifactExtractor {
}
private void processArtifact() throws OseeCoreException {
+ if (theArtifact.size() == 0) {
+ return;
+ }
RoughArtifact roughArtifact = new RoughArtifact(RoughArtifactKind.PRIMARY, paragraphName.trim());
roughArtifact.setSectionNumber(paragraphNumber.trim());
roughArtifact.addAttribute(CoreAttributeTypes.ParagraphNumber, paragraphNumber);

Back to the top