Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-07-23 18:41:54 +0000
committerRoberto E. Escobar2014-08-28 23:59:39 +0000
commitf1793fa5225a919eae89cc33792c5c097272fcbc (patch)
treeafe5701db64dd0572aef58062f62129fb0dd7579 /plugins
parent1514ba34eb0b8bc59d718b46717f62afd0056d31 (diff)
downloadorg.eclipse.osee-f1793fa5225a919eae89cc33792c5c097272fcbc.tar.gz
org.eclipse.osee-f1793fa5225a919eae89cc33792c5c097272fcbc.tar.xz
org.eclipse.osee-f1793fa5225a919eae89cc33792c5c097272fcbc.zip
feature[ats_ATS81344]: Tag embedded OSEE_LINK guids
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java32
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessorTest.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.data.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.expected.txt1
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.tags.txt26
5 files changed, 60 insertions, 2 deletions
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java
index 36275028989..53df31f5a3b 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java
@@ -28,6 +28,8 @@ public class XmlTextInputStream extends BufferedInputStream {
private static final String END_WORDML_TEXT = "</w:t>";
private static final String LINE_BREAK = "<w:br/>";
private static final String TAB_REGEX = "<w:tab( .+)?/>";
+ private static final char[] OSEE_LINK_BEGIN = "OSEE_LINK(".toCharArray();
+ private static final char OSEE_LINK_END = ')';
private IReadHelper readHelper;
@@ -196,6 +198,8 @@ public class XmlTextInputStream extends BufferedInputStream {
private boolean lastCollect;
private boolean lastIsCarriageReturn;
private boolean lastIsStartOfParagraph;
+ private int linkIdx;
+ private boolean foundLink;
public WordMlReadHelper() {
buffer = new StringBuilder();
@@ -210,21 +214,36 @@ public class XmlTextInputStream extends BufferedInputStream {
lastCollect = false;
lastIsStartOfParagraph = false;
lastIsCarriageReturn = false;
+ foundLink = false;
+ linkIdx = 0;
}
@Override
public int process(int value) throws IOException {
isStartOfParagraph = false;
isBreak = false;
+
if ((char) value == '<') {
partOfTag = true;
buffer.append((char) value);
+ } else {
+ linkIdx = (char) value == OSEE_LINK_BEGIN[linkIdx] ? linkIdx + 1 : 0;
}
- while ((partOfTag || isCarriageReturn || isStartOfParagraph != true && collect != true && isBreak != true) && available() > 0) {
+
+ while ((partOfTag || isCarriageReturn || isStartOfParagraph != true && collect != true && isBreak != true && foundLink != true) && available() > 0) {
value = readFromOriginalBuffer();
if ((char) value == '<') {
partOfTag = true;
+ } else if ((char) value == OSEE_LINK_BEGIN[linkIdx++]) {
+ // check if we've matched all characters for OSEE_LINK
+ if (OSEE_LINK_BEGIN.length == linkIdx) {
+ foundLink = true;
+ linkIdx = 0;
+ }
+ } else {
+ linkIdx = 0;
}
+
if (partOfTag) {
buffer.append((char) value);
}
@@ -257,11 +276,21 @@ public class XmlTextInputStream extends BufferedInputStream {
if ((char) value == '<') {
partOfTag = true;
buffer.append((char) value);
+ } else {
+ if ((char) value != OSEE_LINK_BEGIN[linkIdx++]) {
+ linkIdx = 0;
+ }
}
}
}
}
+ if (foundLink && (char) value == OSEE_LINK_END) {
+ // end of OSEE_LINK
+ foundLink = false;
+ linkIdx = 0;
+ }
+
if (available() <= 0) {
value = -1;
}
@@ -290,4 +319,5 @@ public class XmlTextInputStream extends BufferedInputStream {
lastIsCarriageReturn = isCarriageReturn;
}
}
+
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessorTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessorTest.java
index a1543683b0e..8b775f56ac3 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessorTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessorTest.java
@@ -93,7 +93,7 @@ public class TagProcessorTest {
List<Object[]> data = new ArrayList<Object[]>();
TagProcessor tagProcess = new TagProcessor(new EnglishLanguage(new MockLog()), new TagEncoder());
- for (int index = 1; index <= 8; index++) {
+ for (int index = 1; index <= 9; index++) {
String name = "test" + index;
String rawData = getResource(name + ".data.xml");
String expectedParsed = getResource(name + ".expected.txt");
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.data.xml b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.data.xml
new file mode 100644
index 00000000000..602a64dc972
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.data.xml
@@ -0,0 +1 @@
+<w:p wsp:rsidP="00E54E52" wsp:rsidR="006A3C0C" wsp:rsidRDefault="00506B7C"><w:r wsp:rsidRPr="00EB2959"><w:t>The robot API shall provide method(s) to initialize the interface.</w:t></w:r><w:r><w:t> </w:t></w:r><w:r wsp:rsidRPr="00EB2959"><w:t>For the </w:t></w:r><w:proofErr w:type="spellStart"></w:proofErr><w:r wsp:rsidRPr="00EB2959"><w:t>daVinci</w:t></w:r><w:proofErr w:type="spellEnd"></w:proofErr><w:r wsp:rsidRPr="00EB2959"><w:t> research API, this would encompass t</w:t></w:r><w:r><w:t>he stream management functions.</w:t></w:r></w:p><w:p wsp:rsidP="00E54E52" wsp:rsidR="00311E6F" wsp:rsidRDefault="00311E6F"></w:p><w:p wsp:rsidP="00E54E52" wsp:rsidR="00311E6F" wsp:rsidRDefault="00311E6F">OSEE_LINK(Ab3mWLAAUAwN2lhOnbQA)</w:p><w:p wsp:rsidP="00E54E52" wsp:rsidR="001201CD" wsp:rsidRDefault="00A958CB" wsp:rsidRPr="00EB2959">OSEE_LINK(Ab3mWNSjlFJ1o6C6kdgA)<w:proofErr w:type="spellEnd"></w:proofErr></w:p><w:p wsp:rsidR="00BF5DD9" wsp:rsidRDefault="001201CD"><w:r><w:rPr><w:noProof></w:noProof></w:rPr></w:r></w:p> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.expected.txt b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.expected.txt
new file mode 100644
index 00000000000..5425dd3ac80
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.expected.txt
@@ -0,0 +1 @@
+The robot API shall provide method(s) to initialize the interface. For the daVinci research API, this would encompass the stream management functions. Ab3mWLAAUAwN2lhOnbQA Ab3mWNSjlFJ1o6C6kdgA \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.tags.txt b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.tags.txt
new file mode 100644
index 00000000000..e0494aea443
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test9.tags.txt
@@ -0,0 +1,26 @@
+the 3866
+robot 1796984
+api 4986
+shall 1260313
+provide 248764311
+method 14097140
+to 378
+initialize 867415039
+the 3866
+interface -889652386
+for 6511
+the 3866
+davinci 315964589
+research 495647224
+api 4986
+this 103194
+would 867197
+encompass -1686803105
+the 3866
+stream 21690809
+management -185551435
+function 1463473599
+ab3mwlaauawn2lhonbqa -1153474629
+ab3mwlaauawn2lhonbqa 49077
+ab3mwnsjlfj1o6c6kdga -41975813
+ab3mwnsjlfj1o6c6kdga 45311 \ No newline at end of file

Back to the top