summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarol M. Wilk2010-12-13 18:57:56 (EST)
committer Ryan D. Brooks2010-12-13 18:57:56 (EST)
commit5969f9af1dc14085a87f8acfdccdde0b68ddd0eb (patch)
tree76d2fad73546fb758991b989259ec37a9ea3201f
parent743f19575bb60ca9938bae027c1bd3743f4bcad6 (diff)
downloadorg.eclipse.osee-5969f9af1dc14085a87f8acfdccdde0b68ddd0eb.zip
org.eclipse.osee-5969f9af1dc14085a87f8acfdccdde0b68ddd0eb.tar.gz
org.eclipse.osee-5969f9af1dc14085a87f8acfdccdde0b68ddd0eb.tar.bz2
bug[bgz_332344]: Add WordML hlink support to artifact importing
-rw-r--r--plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/ArtifactExtractorTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java37
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMlResolutionGuiTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordOutlineTest.java12
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/tableOfContentsHyperlinkTest.xml169
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/operations/SourceToRoughArtifactOperation.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/AbstractArtifactExtractor.java34
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/ExcelArtifactExtractor.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractor.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NativeDocumentExtractor.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NullDelegate.java48
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WholeWordDocumentExtractor.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java41
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java58
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataExtractor.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/importer/ArtifactImportWizardTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportOperationFactory.java13
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java24
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java5
21 files changed, 301 insertions, 179 deletions
diff --git a/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java b/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java
index 225ba3b..0312f45 100644
--- a/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java
+++ b/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java
@@ -501,7 +501,7 @@ public class PopulateDemoActions extends XNavigateItemAction {
extractor.setDelegate(new WordOutlineExtractorDelegate());
IOperation operation =
- ArtifactImportOperationFactory.createOperation(file, systemReq, extractor, artifactResolver, false);
+ ArtifactImportOperationFactory.createOperation(file, systemReq, null, extractor, artifactResolver, false);
Operations.executeWorkAndCheckStatus(operation);
// Validate that something was imported
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/ArtifactExtractorTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/ArtifactExtractorTest.java
index 686fb36..da8fe71 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/ArtifactExtractorTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/ArtifactExtractorTest.java
@@ -179,7 +179,7 @@ public class ArtifactExtractorTest {
RoughArtifactUtil.resetCollector(expectedCollector);
URL url = Lib.getUrlFromString(BASE_DATA_PATH + testData.getSourceData());
- extractor.process(url.toURI(), actualCollector);
+ extractor.process(null, url.toURI(), actualCollector);
URL expectedData = Lib.getUrlFromString(BASE_DATA_PATH + testData.getExpectedData());
RoughArtifactUtil.loadDataFrom(expectedData, expectedCollector);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java
index 104bb78..fb1f513 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMLExtractorDelegateTableOfContentsTest.java
@@ -15,42 +15,51 @@ import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import junit.framework.Assert;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.skynet.core.importing.parsers.WordOutlineExtractorDelegate;
import org.junit.Test;
/**
- * Tests for if table of contents links pass as valid outline numbers, outline titles, ultimately forming artifacts.
+ * Tests if a table of contents with hlinks gets detected, if it does, warning should be enabled.
*
- * @link:WordOutlineExtractorDelegate
+ * @link WordOutlineExtractorDelegate
* @author Karol M. Wilk
*/
-public class WordMLExtractorDelegateTableOfContentsTest {
+public final class WordMLExtractorDelegateTableOfContentsTest {
private static final Pattern PARAGRAPHREGEX = Pattern.compile("<w:p[ >].*?</w:p>", Pattern.DOTALL);
private static final String TABLE_OF_CONTENTS_FILE = "tableOfContentsHyperlinkTest.xml";
private final WordOutlineExtractorDelegate delegate = new WordOutlineExtractorDelegate();
+ private class TestOperationReporter extends OperationReporter {
+ public final StringBuilder warningMsgs = new StringBuilder();
+
+ @Override
+ public void report(String... row) {
+ for (String warningMessage : row) {
+ warningMsgs.append(warningMessage);
+ }
+ }
+ }
+
@Test
public void tableOfContentsLinksInput() throws Exception {
delegate.initialize();
+
+ TestOperationReporter reporter = new TestOperationReporter();
+
Matcher matcher = PARAGRAPHREGEX.matcher(getFileAsString(TABLE_OF_CONTENTS_FILE));
boolean foundSomething = false;
- if (matcher.find()) {
+ while (matcher.find()) {
foundSomething = true;
- try {
- delegate.processContent(null, false, false, null, null, null, matcher.group(), false);
- } catch (OseeCoreException ex) {
- //we should get an exception because
- Assert.assertTrue(true);
- }
+ delegate.processContent(reporter, null, false, false, null, null, null, matcher.group(), false);
}
+
+ Assert.assertTrue("Warnings generated and Table of Contents in WordML should be detected",
+ reporter.warningMsgs.length() > 0);
Assert.assertTrue(foundSomething);
- Assert.assertTrue(delegate.getLastHeaderNumber().isEmpty());
- Assert.assertTrue(delegate.getLastHeaderName().isEmpty());
- Assert.assertTrue(delegate.getLastContent().isEmpty());
}
private static String getFileAsString(String nameOfFile) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMlResolutionGuiTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMlResolutionGuiTest.java
index 8fc8732..2ad5971 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMlResolutionGuiTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordMlResolutionGuiTest.java
@@ -75,7 +75,7 @@ public class WordMlResolutionGuiTest {
foundSomething = true;
String singleWp = matcher.group();
//TODO: pass in the real testCollector
- delegate.processContent(null, false, false, null, null, null, singleWp, false);
+ delegate.processContent(null, null, false, false, null, null, null, singleWp, false);
}
//TODO:
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordOutlineTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordOutlineTest.java
index 7472ca1..a683bfd 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordOutlineTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/WordOutlineTest.java
@@ -113,7 +113,7 @@ public final class WordOutlineTest {
while (matcher.find()) {
foundSomething = true;
String data = matcher.group();
- delegate.processContent(null, false, false, null, null, null, data, false);
+ delegate.processContent(null, null, false, false, null, null, null, data, false);
String headerNumber = delegate.getLastHeaderNumber().trim();
String headerName = delegate.getLastHeaderName().trim();
@@ -159,15 +159,15 @@ public final class WordOutlineTest {
}
public String getHeaderNumber() {
- return this.headerNumber;
+ return headerNumber;
}
public String getHeaderName() {
- return this.headerName;
+ return headerName;
}
public String getContent() {
- return this.content;
+ return content;
}
@Override
@@ -218,8 +218,8 @@ public final class WordOutlineTest {
@Override
public String toString() {
- return "DelegateData [headerNumber=" + headerNumber + ", headerName=" + headerName + ", content=" + content + "]";
+ return String.format("DelegateData [headerNumber=[%s], headerName=[%s], content=[%s]]", headerNumber,
+ headerName, content);
}
-
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/tableOfContentsHyperlinkTest.xml b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/tableOfContentsHyperlinkTest.xml
index ce5a4fc..82959e0 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/tableOfContentsHyperlinkTest.xml
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/importing/parsers/tableOfContentsHyperlinkTest.xml
@@ -1,73 +1,96 @@
-<w:p wsp:rsidR="00BF241C" wsp:rsidRDefault="00FA3583">
- <w:pPr>
- <w:pStyle w:val="TOC2"/>
- <w:tabs>
- <w:tab w:val="right" w:leader="dot" w:pos="9350"/>
- </w:tabs>
- <w:rPr>
- <w:noProof/>
- <w:sz w:val="24"/>
- <w:sz-cs w:val="24"/>
- </w:rPr>
- </w:pPr>
- <w:hlink w:bookmark="_s7290252">
- <w:r wsp:rsidR="00BF241C" wsp:rsidRPr="00373B6F">
- <w:rPr>
- <w:rStyle w:val="Hyperlink"/>
- <w:noProof/>
- </w:rPr>
- <w:t>1.1 Identification</w:t>
- </w:r>
- <w:r wsp:rsidR="00BF241C">
- <w:rPr>
- <w:noProof/>
- <w:webHidden/>
- </w:rPr>
- <w:tab wx:wTab="105" wx:tlc="dot" wx:cTlc="1"/>
- </w:r>
- <w:r>
- <w:rPr>
- <w:noProof/>
- <w:webHidden/>
- </w:rPr>
- <w:fldChar w:fldCharType="begin">
- <w:fldData>CNDJ6nn5us4RjIIAqgBLqQsCAAAACAAAAA4AAABfAFQAbwBjADIANQA3ADIAOQAwADIANQAyAAAA
-</w:fldData>
- </w:fldChar>
- </w:r>
- <w:r wsp:rsidR="00BF241C">
- <w:rPr>
- <w:noProof/>
- <w:webHidden/>
- </w:rPr>
- <w:instrText> PAGEREF _Toc257290252 \h </w:instrText>
- </w:r>
- <w:r wsp:rsidR="00D10692">
- <w:rPr>
- <w:noProof/>
- </w:rPr>
- </w:r>
- <w:r>
- <w:rPr>
- <w:noProof/>
- <w:webHidden/>
- </w:rPr>
- <w:fldChar w:fldCharType="separate"/>
- </w:r>
- <w:r wsp:rsidR="00AE30F8">
- <w:rPr>
- <w:noProof/>
- <w:webHidden/>
- </w:rPr>
- <w:t>1</w:t>
- </w:r>
- <w:r>
- <w:rPr>
- <w:noProof/>
- <w:webHidden/>
- </w:rPr>
- <w:fldChar w:fldCharType="end"/>
- </w:r>
- </w:hlink>
-</w:p>
-
+<w:p wsp:rsidR="00E90F3E" wsp:rsidRDefault="002C2AE9"><w:pPr><w:pStyle w:val="para"/><w:tabs><w:tab w:val="left" w:pos="1497"/></w:tabs><w:ind w:first-line="0"/><w:jc w:val="left"/></w:pPr><w:hlink w:dest="http://sun803.msc.az.boeing.com:8092/osee/client/loopback?guid=AAABICX5U5sArAbUHJPyaw&amp;cmd=open.artifact&amp;branchId=3248&amp;sessionId=RdU5CfL%2BxBp6bakPWdwA&amp;context=osee%2Floopback&amp;isDeleted=false"><w:r wsp:rsidR="00E90F3E"><w:rPr><w:rStyle w:val="Hyperlink"/><w:color w:val="auto"/></w:rPr><w:t>Testing testing testing</w:t></w:r></w:hlink><w:r wsp:rsidR="00E90F3E"><w:t>Testing more text.</w:t></w:r></w:p>
+<w:p wsp:rsidR="00BF241C" wsp:rsidRDefault="00FA3583">
+ <w:pPr>
+ <w:pStyle w:val="TOC2"/>
+ <w:tabs>
+ <w:tab w:val="right" w:leader="dot" w:pos="9350"/>
+ </w:tabs>
+ <w:rPr>
+ <w:noProof/>
+ <w:sz w:val="24"/>
+ <w:sz-cs w:val="24"/>
+ </w:rPr>
+ </w:pPr>
+ <w:hlink w:bookmark="_s7290252">
+ <w:r wsp:rsidR="00BF241C" wsp:rsidRPr="00373B6F">
+ <w:rPr>
+ <w:rStyle w:val="Hyperlink"/>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>2 Identification</w:t>
+ </w:r>
+ <w:r wsp:rsidR="00BF241C">
+ <w:rPr>
+ <w:noProof/>
+ <w:webHidden/>
+ </w:rPr>
+ <w:tab wx:wTab="105" wx:tlc="dot" wx:cTlc="1"/>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ <w:webHidden/>
+ </w:rPr>
+ <w:fldChar w:fldCharType="begin">
+ <w:fldData>CNDJ6nn5us4RjIIAqgBLqQsCAAAACAAAAA4AAABfAFQAbwBjADIANQA3ADIAOQAwADIANQAyAAAA
+</w:fldData>
+ </w:fldChar>
+ </w:r>
+ <w:r wsp:rsidR="00BF241C">
+ <w:rPr>
+ <w:noProof/>
+ <w:webHidden/>
+ </w:rPr>
+ <w:instrText> PAGEREF _Toc257290252 \h </w:instrText>
+ </w:r>
+ <w:r wsp:rsidR="00D10692">
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ <w:webHidden/>
+ </w:rPr>
+ <w:fldChar w:fldCharType="separate"/>
+ </w:r>
+ <w:r wsp:rsidR="00AE30F8">
+ <w:rPr>
+ <w:noProof/>
+ <w:webHidden/>
+ </w:rPr>
+ <w:t>1</w:t>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ <w:webHidden/>
+ </w:rPr>
+ <w:fldChar w:fldCharType="end"/>
+ </w:r>
+ </w:hlink>
+</w:p>
+<w:p wsp:rsidR="00E90F3E" wsp:rsidRDefault="002C2AE9" wsp:rsidP="003D3532">
+ <w:pPr>
+ <w:listPr>
+ <w:ilvl w:val="0"/>
+ <w:ilfo w:val="32"/>
+ <wx:t wx:val="o" wx:wTabBefore="1140" wx:wTabAfter="240"/>
+ <wx:font wx:val="Courier New"/>
+ </w:listPr>
+ <w:tabs>
+ <w:tab w:val="clear" w:pos="780"/><w:tab w:val="list" w:pos="1500"/>
+ </w:tabs>
+ <w:ind w:left="1500"/>
+ </w:pPr>
+ <w:hlink w:dest="http://www.eclipse.org/osee&amp;isDeleted=false">
+ <w:r wsp:rsidR="00E90F3E">
+ <w:rPr>
+ <w:rStyle w:val="Hyperlink"/>
+ <w:color w:val="auto"/>
+ </w:rPr>
+ <w:t>abc.test.script.tech_approach_sample</w:t>
+ </w:r>
+ </w:hlink>
+</w:p>
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/operations/SourceToRoughArtifactOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/operations/SourceToRoughArtifactOperation.java
index 017c5dc..9756eea 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/operations/SourceToRoughArtifactOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/operations/SourceToRoughArtifactOperation.java
@@ -16,6 +16,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
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.parsers.IArtifactExtractor;
@@ -26,15 +27,17 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator;
*/
public class SourceToRoughArtifactOperation extends AbstractOperation {
+ private final OperationReporter reporter;
private final IArtifactExtractor extractor;
private final File sourceFile;
private final RoughArtifactCollector collector;
- public SourceToRoughArtifactOperation(IArtifactExtractor extractor, File sourceFile, RoughArtifactCollector collector) {
+ public SourceToRoughArtifactOperation(OperationReporter reporter, IArtifactExtractor extractor, File sourceFile, RoughArtifactCollector collector) {
super("Extract artifact data from source", Activator.PLUGIN_ID);
this.extractor = extractor;
this.sourceFile = sourceFile;
this.collector = collector;
+ this.reporter = reporter;
}
@Override
@@ -75,7 +78,7 @@ public class SourceToRoughArtifactOperation extends AbstractOperation {
private void processFile(File file, RoughArtifactCollector collector, RoughArtifact parent) throws OseeCoreException {
RoughArtifactCollector tempCollector = new RoughArtifactCollector(parent);
try {
- extractor.process(file.toURI(), tempCollector);
+ extractor.process(reporter, file.toURI(), tempCollector);
} catch (Exception ex) {
OseeExceptions.wrapAndThrow(ex);
}
@@ -83,5 +86,4 @@ public class SourceToRoughArtifactOperation extends AbstractOperation {
collector.addAllRoughArtifacts(tempCollector.getRoughArtifacts());
collector.addAllRoughRelations(tempCollector.getRoughRelations());
}
-
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/AbstractArtifactExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/AbstractArtifactExtractor.java
index 4006b9f..b809540 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/AbstractArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/AbstractArtifactExtractor.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.skynet.core.importing.parsers;
import java.net.URI;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifact;
import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
@@ -21,13 +22,15 @@ import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifact
*/
public abstract class AbstractArtifactExtractor implements IArtifactExtractor {
- private IArtifactExtractorDelegate delegate;
+ private static final IArtifactExtractorDelegate NULL_DELEGATE = new NullDelegate();
+
+ private IArtifactExtractorDelegate delegate = NULL_DELEGATE;
protected AbstractArtifactExtractor() {
- this.delegate = null;
+ // Protect Constructor
}
- protected abstract void extractFromSource(URI source, RoughArtifactCollector collector) throws Exception;
+ protected abstract void extractFromSource(OperationReporter reporter, URI source, RoughArtifactCollector collector) throws Exception;
@Override
public String toString() {
@@ -40,40 +43,37 @@ public abstract class AbstractArtifactExtractor implements IArtifactExtractor {
}
@Override
- public void setDelegate(IArtifactExtractorDelegate delegate) {
- this.delegate = delegate;
+ public final void setDelegate(IArtifactExtractorDelegate delegate) {
+ this.delegate = delegate != null ? delegate : NULL_DELEGATE;
}
@Override
- public IArtifactExtractorDelegate getDelegate() {
+ public final IArtifactExtractorDelegate getDelegate() {
return delegate;
}
@Override
- public boolean hasDelegate() {
- return getDelegate() != null;
+ public final boolean hasDelegate() {
+ return delegate instanceof NullDelegate ? false : true;
}
private void checkDelegate() throws OseeCoreException {
if (isDelegateRequired() && !hasDelegate()) {
- throw new OseeStateException("Delegate is required but is null");
+ throw new OseeStateException("Delegate is required but is null delegate");
}
}
@Override
- public final void process(URI source, RoughArtifactCollector collector) throws Exception {
+ public final void process(OperationReporter reporter, URI source, RoughArtifactCollector collector) throws Exception {
checkDelegate();
- if (hasDelegate()) {
- getDelegate().initialize();
- }
+
+ delegate.initialize();
try {
- extractFromSource(source, collector);
+ extractFromSource(reporter, source, collector);
connectParentChildRelations(collector);
connectCollectorParent(collector);
} finally {
- if (hasDelegate()) {
- getDelegate().dispose();
- }
+ delegate.dispose();
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/ExcelArtifactExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/ExcelArtifactExtractor.java
index ea4bbfc..6e77c58 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/ExcelArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/ExcelArtifactExtractor.java
@@ -23,6 +23,7 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.jdk.core.type.DoubleKeyHashMap;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -72,7 +73,7 @@ public class ExcelArtifactExtractor extends AbstractArtifactExtractor {
}
@Override
- protected void extractFromSource(URI source, RoughArtifactCollector collector) throws Exception {
+ protected void extractFromSource(OperationReporter reporter, URI source, RoughArtifactCollector collector) throws Exception {
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.setContentHandler(new ExcelSaxHandler(new ExcelRowProcessor(collector), true));
xmlReader.parse(new InputSource(new InputStreamReader(source.toURL().openStream(), "UTF-8")));
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractor.java
index 98f5291..4c047b5 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractor.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.skynet.core.importing.parsers;
import java.io.FileFilter;
import java.net.URI;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
/**
@@ -23,7 +24,7 @@ public interface IArtifactExtractor {
public abstract String getDescription();
- public abstract void process(URI source, RoughArtifactCollector collector) throws Exception;
+ public abstract void process(OperationReporter reporter, URI source, RoughArtifactCollector collector) throws Exception;
public abstract FileFilter getFileFilter();
@@ -36,4 +37,5 @@ public interface IArtifactExtractor {
public IArtifactExtractorDelegate getDelegate();
public boolean hasDelegate();
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java
index d0cced4..6df9669 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.skynet.core.importing.parsers;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
/**
@@ -49,7 +50,8 @@ public interface IArtifactExtractorDelegate {
* and initialize it with data from the content, or to append the content to the last, or a prior created
* RoughArtifact.
*/
- public void processContent(RoughArtifactCollector collector, boolean forceBody, boolean forcePrimaryType, String headerNumber, String listIdentifier, String paragraphStyle, String content, boolean isParagraph) throws OseeCoreException;
+ public void processContent(OperationReporter reporter, RoughArtifactCollector collector, boolean forceBody, boolean forcePrimaryType, String headerNumber, String listIdentifier, String paragraphStyle, String content, boolean isParagraph) throws OseeCoreException;
public void finish();
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NativeDocumentExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NativeDocumentExtractor.java
index 06340c6..c5df5ae 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NativeDocumentExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NativeDocumentExtractor.java
@@ -14,6 +14,7 @@ import java.io.File;
import java.io.FileFilter;
import java.net.URI;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
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;
@@ -27,7 +28,7 @@ public class NativeDocumentExtractor extends AbstractArtifactExtractor {
}
@Override
- protected void extractFromSource(URI source, RoughArtifactCollector collector) {
+ protected void extractFromSource(OperationReporter reporter, URI source, RoughArtifactCollector collector) {
String extension = Lib.getExtension(source.toASCIIString());
String name = Lib.removeExtension(new File(source).getName());
@@ -56,4 +57,5 @@ public class NativeDocumentExtractor extends AbstractArtifactExtractor {
public boolean usesTypeList() {
return true;
}
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NullDelegate.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NullDelegate.java
new file mode 100644
index 0000000..b5b630a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/NullDelegate.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.skynet.core.importing.parsers;
+
+import org.eclipse.osee.framework.core.operation.OperationReporter;
+import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
+
+public final class NullDelegate implements IArtifactExtractorDelegate {
+
+ @Override
+ public boolean isApplicable(IArtifactExtractor parser) {
+ return false;
+ }
+
+ @Override
+ public void initialize() {
+ //
+ }
+
+ @Override
+ public void dispose() {
+ //
+ }
+
+ @Override
+ public String getName() {
+ return "Null Delegate";
+ }
+
+ @Override
+ public void processContent(OperationReporter reporter, RoughArtifactCollector collector, boolean forceBody, boolean forcePrimaryType, String headerNumber, String listIdentifier, String paragraphStyle, String content, boolean isParagraph) {
+ //
+ }
+
+ @Override
+ public void finish() {
+ //
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WholeWordDocumentExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WholeWordDocumentExtractor.java
index 773df6d..44eb10b 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WholeWordDocumentExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WholeWordDocumentExtractor.java
@@ -15,6 +15,7 @@ import java.io.FileFilter;
import java.net.URI;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
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;
@@ -27,7 +28,7 @@ public class WholeWordDocumentExtractor extends AbstractArtifactExtractor {
}
@Override
- protected void extractFromSource(URI source, RoughArtifactCollector collector) throws Exception {
+ protected void extractFromSource(OperationReporter reporter, URI source, RoughArtifactCollector collector) throws Exception {
if (source == null) {
throw new OseeArgumentException("importFile can not be null");
}
@@ -56,4 +57,5 @@ public class WholeWordDocumentExtractor extends AbstractArtifactExtractor {
public boolean usesTypeList() {
return true;
}
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java
index 79305ae..6ff680e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java
@@ -23,6 +23,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.jdk.core.util.Readers;
import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
import org.eclipse.osee.framework.skynet.core.word.WordUtil;
@@ -56,27 +57,21 @@ public class WordOutlineExtractor extends AbstractArtifactExtractor {
private static final int ATTRIBUTE_BLOCK_GROUP = 4;
private static final int CONTENT_GROUP = 8;
- private final Matcher reqNumberMatcher;
- private final Matcher reqListMatcher;
- private final Stack<String> currentListStack;
- private final int maxExtractionDepth;
+ private final Matcher reqNumberMatcher = Pattern.compile("(\\d+\\.)*(\\d+\\.?)\\s*").matcher("");
+ private final Matcher reqListMatcher = Pattern.compile("\\w+\\)", Pattern.CASE_INSENSITIVE).matcher("");
+ private final Stack<String> currentListStack = new Stack<String>();
+ private final int maxExtractionDepth = 0;
- private Stack<String> clonedCurrentListStack;
+ private Stack<String> clonedCurrentListStack = new Stack<String>();
private int lastDepthNumber;
- private String headerNumber;
- private String listIdentifier;
+ private String headerNumber = "";
+ private String listIdentifier = "";
private boolean forceBody;
private boolean forcePrimaryType;
private String paragraphStyle;
public WordOutlineExtractor() {
- this.headerNumber = "";
- this.listIdentifier = "";
- this.reqNumberMatcher = Pattern.compile("(\\d+\\.)*(\\d+\\.?)\\s*").matcher("");
- this.reqListMatcher = Pattern.compile("\\w+\\)", Pattern.CASE_INSENSITIVE).matcher("");
- this.currentListStack = new Stack<String>();
- this.clonedCurrentListStack = new Stack<String>();
- this.maxExtractionDepth = 0;
+ //
}
@Override
@@ -114,7 +109,7 @@ public class WordOutlineExtractor extends AbstractArtifactExtractor {
}
@Override
- protected void extractFromSource(URI source, RoughArtifactCollector collector) throws OseeCoreException, IOException {
+ protected void extractFromSource(OperationReporter reporter, URI source, RoughArtifactCollector collector) throws OseeCoreException, IOException {
Reader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(source.toURL().openStream(), "UTF-8"));
@@ -167,7 +162,7 @@ public class WordOutlineExtractor extends AbstractArtifactExtractor {
listIdentifier = "";
paragraphStyle = null;
parseContentDetails(content, new Stack<String>());
- delegate.processContent(collector, forceBody, forcePrimaryType, headerNumber, listIdentifier,
+ delegate.processContent(reporter, collector, forceBody, forcePrimaryType, headerNumber, listIdentifier,
paragraphStyle, content.toString(), element == PARAGRAPH_TAG);
}
}
@@ -181,18 +176,14 @@ public class WordOutlineExtractor extends AbstractArtifactExtractor {
}
private void parseContentDetails(CharSequence content, Stack<String> parentElementNames) {
-
Matcher matcher = internalAttributeElementsPattern.matcher(content);
- String elementNamespace;
- String elementName;
- String elementAttributes;
- String elementContent;
while (matcher.find()) {
- elementName = matcher.group(ELEMENT_NAME_GROUP);
- elementNamespace = matcher.group(NAMESPACE_GROUP);
- elementAttributes = matcher.group(ATTRIBUTE_BLOCK_GROUP) == null ? "" : matcher.group(ATTRIBUTE_BLOCK_GROUP);
- elementContent = matcher.group(CONTENT_GROUP) == null ? "" : matcher.group(CONTENT_GROUP);
+ String elementName = matcher.group(ELEMENT_NAME_GROUP);
+ String elementNamespace = matcher.group(NAMESPACE_GROUP);
+ String elementAttributes =
+ matcher.group(ATTRIBUTE_BLOCK_GROUP) == null ? "" : matcher.group(ATTRIBUTE_BLOCK_GROUP);
+ String elementContent = matcher.group(CONTENT_GROUP) == null ? "" : matcher.group(CONTENT_GROUP);
if (elementName.equals("forceBodyOn")) {
forceBody = true;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java
index 6c389bc..396c5ca 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java
@@ -25,6 +25,7 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifact;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifactKind;
@@ -33,7 +34,7 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.word.WordUtil;
/**
- * Test: @link: WordOutlineTest
+ * Test: @link WordOutlineTest
*
* @author Karol M. Wilk
*/
@@ -44,12 +45,21 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
// Node: <wx:t wx:val="1.1.1 "/>
private static final Pattern LIST_ITEM_REGEX = Pattern.compile("<wx:t wx:val=\"([0-9.]+\\s*)\".*/>");
private static final Pattern OUTLINE_NUMBER = Pattern.compile("((?>\\d+\\.)+\\d*)\\s*");
- private static final Pattern HYPERLINK_PATTERN = Pattern.compile("<w:hlink .*>.*?</w:hlink>", Pattern.DOTALL);
+
+ // This assumes that the user uses a generated Table of Contents from Word and does not come up with
+ // his/hers own version of of a style can call it "TOC\d+"
+ private static final Pattern TOC_HYPERLINK_PATTERN = Pattern.compile(".*<w:pStyle w:val=\"TOC\\d+?\"/>.*",
+ Pattern.DOTALL);
+ private boolean possibleTableOfContents;
+
+ private static String detectedTableOfContentsReportError =
+ "Table of Contents found in document. Please remove per the spec on: \n http://wiki.eclipse.org/OSEE/HowTo/ImportArtifactsFromWordML";
public enum ContentType {
CONTENT,
OUTLINE_TITLE
};
+
/**
* Keeps state whether on what user decided last
*/
@@ -57,7 +67,7 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
/**
* Keeps state whether user was asked for help.
*/
- private boolean userAskedForHelp = false;
+ private boolean userAskedForHelp;
private Map<String, RoughArtifact> duplicateCatcher;
@@ -69,7 +79,7 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
private StringBuffer lastHeaderName;
private StringBuffer lastContent;
- private boolean initalized = false;
+ private boolean initalized;
private final OutlineResolution outlineResolution = new OutlineResolution();
private IConflictResolvingGui conflictResolvingGui = null;
@@ -122,7 +132,8 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
roughArtifact = null;
wordFormattedContent = new StringBuilder();
initalized = true;
-
+ possibleTableOfContents = false;
+ userAskedForHelp = false;
}
/**
@@ -137,12 +148,20 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
lastHeaderName = null;
lastContent = null;
initalized = false;
+ userAskedForHelp = false;
+ possibleTableOfContents = false;
}
@Override
- public final void processContent(RoughArtifactCollector collector, boolean forceBody, boolean forcePrimaryType, String headerNumber, String listIdentifier, String paragraphStyle, String content, boolean isParagraph) throws OseeCoreException {
+ public final void processContent(OperationReporter opReporter, RoughArtifactCollector collector, boolean forceBody, boolean forcePrimaryType, String headerNumber, String listIdentifier, String paragraphStyle, String content, boolean isParagraph) throws OseeCoreException {
+ if (Strings.isValid(content) && initalized) {
+ if (!possibleTableOfContents) {
+ possibleTableOfContents = TOC_HYPERLINK_PATTERN.matcher(content).matches();
+ if (possibleTableOfContents && opReporter != null) {
+ opReporter.report(detectedTableOfContentsReportError);
+ }
+ }
- if (Strings.isValid(content) && initalized && !HYPERLINK_PATTERN.matcher(content).find()) {
StringBuilder outlineNumber = new StringBuilder(); //Number i.e. 1.1
StringBuilder outlineName = new StringBuilder(); //Title i.e. Scope
StringBuilder outlineContent = null; // Content, text, table content, etc.
@@ -165,9 +184,8 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
} else {
throw new OseeCoreException(
"%s::processContent() Either passed in content is invalid or *Delegate hasn't been initialized...",
- this.toString());
+ toString());
}
-
}
/**
@@ -196,7 +214,6 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
/**
* Gets content and attempts to extract outline number and title, if it fails with regular regex, it tries
* specializedOutlineNumberTitleExtract()
- *
*/
private boolean processOutlineNumberAndName(String content, StringBuilder outlineNumber, StringBuilder outlineName) throws OseeCoreException {
Matcher listItemMatcher = LIST_ITEM_REGEX.matcher(content);
@@ -344,31 +361,31 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
@Override
public String getName() {
- return "QuickSilver ICDs and General Outline Documents";
+ return "General Outline Documents";
}
public String getLastHeaderNumber() {
return getBufferString(lastHeaderNumber);
}
- private void setLastHeaderNumber(String lastHeaderNumber) {
- this.lastHeaderNumber.append(lastHeaderNumber);
+ private void setLastHeaderNumber(String headerNumber) {
+ lastHeaderNumber.append(headerNumber);
}
public String getLastHeaderName() {
return getBufferString(lastHeaderName);
}
- private void setLastHeaderName(String lastHeaderName) {
- this.lastHeaderName.append(lastHeaderName);
+ private void setLastHeaderName(String headerName) {
+ lastHeaderName.append(headerName);
}
public String getLastContent() {
return getBufferString(lastContent);
}
- private void setLastContent(String lastContent) {
- this.lastContent.append(lastContent);
+ private void setLastContent(String content) {
+ lastContent.append(content);
}
private String getBufferString(StringBuffer builder) {
@@ -376,14 +393,15 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
}
private void resetLastHeaderNumber() {
- this.lastHeaderNumber.setLength(0);
+ lastHeaderNumber.setLength(0);
}
private void resetLastHeaderName() {
- this.lastHeaderName.setLength(0);
+ lastHeaderName.setLength(0);
}
private void resetLastContent() {
- this.lastContent.setLength(0);
+ lastContent.setLength(0);
}
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataExtractor.java
index 9348d7a..6bfe1b6 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataExtractor.java
@@ -14,8 +14,8 @@ import java.io.File;
import java.io.FileFilter;
import java.io.InputStreamReader;
import java.net.URI;
-
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
@@ -29,7 +29,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
public class XmlDataExtractor extends AbstractArtifactExtractor {
@Override
- protected void extractFromSource(URI source, RoughArtifactCollector collector) throws Exception {
+ protected void extractFromSource(OperationReporter reporter, URI source, RoughArtifactCollector collector) throws Exception {
IArtifactType primaryArtifactType = ArtifactTypeManager.getType(Lib.removeExtension(new File(source).getName()));
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.setContentHandler(new XmlDataSaxHandler(collector, primaryArtifactType));
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/importer/ArtifactImportWizardTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/importer/ArtifactImportWizardTest.java
index f01f506..2a25d92 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/importer/ArtifactImportWizardTest.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/importer/ArtifactImportWizardTest.java
@@ -123,7 +123,7 @@ public final class ArtifactImportWizardTest {
collector.reset();
IOperation operation =
- ArtifactImportOperationFactory.createArtifactAndRoughToRealOperation(inputExcelFile, myRootArtifact,
+ ArtifactImportOperationFactory.createArtifactAndRoughToRealOperation(inputExcelFile, myRootArtifact, null,
new ExcelArtifactExtractor(), resolver, collector, Arrays.asList(CoreArtifactTypes.SystemRequirement),
true, true, false);
Operations.executeWork(operation);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportOperationFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportOperationFactory.java
index e1d69ff..603d043 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportOperationFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportOperationFactory.java
@@ -21,6 +21,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.core.operation.CompositeOperation;
import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifact;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifactKind;
@@ -45,24 +46,24 @@ public final class ArtifactImportOperationFactory {
super();
}
- public static IOperation createOperation(File sourceFile, Artifact destinationArtifact, IArtifactExtractor extractor, IArtifactImportResolver resolver, boolean stopOnError) throws OseeCoreException {
+ public static IOperation createOperation(File sourceFile, Artifact destinationArtifact, OperationReporter reporter, IArtifactExtractor extractor, IArtifactImportResolver resolver, boolean stopOnError) throws OseeCoreException {
SkynetTransaction transaction =
new SkynetTransaction(destinationArtifact.getBranch(), "Artifact Import Wizard transaction");
RoughArtifactCollector collector = new RoughArtifactCollector(new RoughArtifact(RoughArtifactKind.PRIMARY));
List<IOperation> ops = new ArrayList<IOperation>();
- ops.add(new SourceToRoughArtifactOperation(extractor, sourceFile, collector));
+ ops.add(new SourceToRoughArtifactOperation(reporter, extractor, sourceFile, collector));
ops.add(new RoughToRealArtifactOperation(transaction, destinationArtifact, collector, resolver, false));
ops.add(new ArtifactValidationCheckOperation(destinationArtifact.getDescendants(), stopOnError));
ops.add(new CompleteArtifactImportOperation(transaction, destinationArtifact));
return new CompositeOperation("Artifact Import", SkynetGuiPlugin.PLUGIN_ID, ops);
}
- public static IOperation createArtifactAndRoughToRealOperation(File sourceFile, Artifact destinationArtifact, IArtifactExtractor extractor, IArtifactImportResolver resolver, RoughArtifactCollector collector, Collection<IArtifactType> selectionArtifactTypes, boolean stopOnError, boolean deleteUnMatched, boolean runFilterByAttributes) {
+ public static IOperation createArtifactAndRoughToRealOperation(File sourceFile, Artifact destinationArtifact, OperationReporter reporter, IArtifactExtractor extractor, IArtifactImportResolver resolver, RoughArtifactCollector collector, Collection<IArtifactType> selectionArtifactTypes, boolean stopOnError, boolean deleteUnMatched, boolean runFilterByAttributes) {
List<IOperation> ops = new ArrayList<IOperation>();
ops.add(createArtifactsCompOperation(
"Artifact Import - SourceToRoughArtifact, FilterArtifactTypesByAttributeTypes", sourceFile,
- destinationArtifact, extractor, collector, selectionArtifactTypes, runFilterByAttributes));
+ destinationArtifact, reporter, extractor, collector, selectionArtifactTypes, runFilterByAttributes));
ops.add(createRoughToRealOperation(
"Artifact Import - RoughToRealArtifactOperation, ArtifactValidationCheckOperation, CompleteArtifactImportOperation",
destinationArtifact, resolver, stopOnError, collector, deleteUnMatched));
@@ -73,9 +74,9 @@ public final class ArtifactImportOperationFactory {
/**
* @see ArtifactImportPage
*/
- public static IOperation createArtifactsCompOperation(String opDescription, File sourceFile, Artifact destinationArtifact, IArtifactExtractor extractor, RoughArtifactCollector collector, Collection<IArtifactType> selectionArtifactTypes, boolean runFilterByAttributes) {
+ public static IOperation createArtifactsCompOperation(String opDescription, File sourceFile, Artifact destinationArtifact, OperationReporter reporter, IArtifactExtractor extractor, RoughArtifactCollector collector, Collection<IArtifactType> selectionArtifactTypes, boolean runFilterByAttributes) {
List<IOperation> ops = new ArrayList<IOperation>();
- ops.add(new SourceToRoughArtifactOperation(extractor, sourceFile, collector));
+ ops.add(new SourceToRoughArtifactOperation(reporter, extractor, sourceFile, collector));
if (runFilterByAttributes) {
ops.add(new FilterArtifactTypesByAttributeTypes(destinationArtifact.getBranch(), collector,
selectionArtifactTypes));
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
index 60fc2d8..bcf14cb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
@@ -18,12 +18,14 @@ import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.OperationReporter;
import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -83,6 +85,8 @@ public class ArtifactImportPage extends WizardDataTransferPage {
private final SelectionLatch selectionLatch;
private final Collection<IArtifactType> selectedArtifactTypes;
+ private static StringBuilder operationReportMessages;
+
protected ArtifactImportPage() {
super(PAGE_NAME);
selectedArtifactTypes = new ArrayList<IArtifactType>();
@@ -107,6 +111,8 @@ public class ArtifactImportPage extends WizardDataTransferPage {
setDescription("Import artifacts into Define");
setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ARTIFACT_IMPORT_WIZARD));
+ operationReportMessages = new StringBuilder();
+
}
public RoughArtifactCollector getCollectedArtifacts() {
@@ -428,9 +434,18 @@ public class ArtifactImportPage extends WizardDataTransferPage {
final File sourceFile = selectionLatch.currentSelected.sourceFile;
final IArtifactExtractor extractor = selectionLatch.currentSelected.extractor;
+ operationReportMessages.setLength(0);
+
IOperation op =
ArtifactImportOperationFactory.createArtifactsCompOperation("Extracting data from source", sourceFile,
- destinationArtifact, extractor, collector, selectedArtifactTypes, true);
+ destinationArtifact, new OperationReporter() {
+ @Override
+ public void report(String... row) {
+ for (String warningMessage : row) {
+ operationReportMessages.append(warningMessage);
+ }
+ };
+ }, extractor, collector, selectedArtifactTypes, true);
selectedArtifactTypes.clear();
@@ -473,6 +488,13 @@ public class ArtifactImportPage extends WizardDataTransferPage {
return false;
}
+ //grab the error here and
+ if (operationReportMessages.length() != 0) {
+ setMessage(operationReportMessages.toString(), IMessageProvider.WARNING);
+ } else {
+ setMessage("", IMessageProvider.NONE);
+ }
+
if (status[0].isOK()) {
setErrorMessage(null);
} else {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
index bdb4047..54d956a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
@@ -58,7 +58,7 @@ public class WordMLProducer extends Producer {
private static final String DEFAULT_FONT = "Times New Roman";
public WordMLProducer(Appendable str) {
- this.strB = str;
+ strB = str;
outlineNumber = new int[10]; // word supports 9 levels of outlining; index this array from 1 to 9
outlineLevel = 0;
flattenedLevelCount = 0;
@@ -88,7 +88,7 @@ public class WordMLProducer extends Producer {
OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Outline level flattened, outline can only go 9 levels deep");
return startOutlineSubSection(font, headingText, outlineType);
}
- };
+ }
private void append(CharSequence value) throws OseeCoreException {
try {
@@ -99,7 +99,6 @@ public class WordMLProducer extends Producer {
}
public void startOutlineSubSection(CharSequence style, CharSequence outlineNumber, CharSequence font, CharSequence headingText) throws OseeCoreException {
- //startSubSection();
append("<wx:sub-section>");
if (Strings.isValid(headingText)) {
startParagraph();