Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid W. Miller2018-06-28 17:39:38 -0400
committerDavid Miller2018-07-05 13:46:19 -0400
commit1f989066546699811e28fe625bcd78b2eb246b0d (patch)
tree4e8dc546f2b71c4fa4cf542d9921010d3dd81af0
parentf05cc2123910c88d5a4c1120e3aae3b427bc9c27 (diff)
downloadorg.eclipse.osee-1f989066546699811e28fe625bcd78b2eb246b0d.tar.gz
org.eclipse.osee-1f989066546699811e28fe625bcd78b2eb246b0d.tar.xz
org.eclipse.osee-1f989066546699811e28fe625bcd78b2eb246b0d.zip
refinement[ats_TW9739]: Update to improve Doors Word import
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsWordOutlineExtractor.java13
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java13
2 files changed, 17 insertions, 9 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsWordOutlineExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsWordOutlineExtractor.java
index c8fb027ff7..f715146e14 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsWordOutlineExtractor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsWordOutlineExtractor.java
@@ -40,7 +40,13 @@ public class DoorsWordOutlineExtractor extends WordOutlineExtractorDelegate {
setContent(); // finishes the previous rough artifact
String number = String.format("%s.0.%d", lastHeaderNumber.toString(), lastReqNumber++);
- roughArtifact = new RoughArtifact(getRoughArtifactType(newName.toString()));
+ String name = newName.toString();
+ if (name.contains("<w")) { // remove invalid tags from names
+ name = name.replaceAll("<[^>]+>", "");
+ }
+ roughArtifact = new RoughArtifact(getRoughArtifactType(name));
+ roughArtifact.setName(name);
+
if (collector != null) {
collector.addRoughArtifact(roughArtifact);
}
@@ -48,11 +54,10 @@ public class DoorsWordOutlineExtractor extends WordOutlineExtractorDelegate {
roughArtifact.setSectionNumber(number);
roughArtifact.addAttribute(CoreAttributeTypes.ParagraphNumber, number);
}
- String name = newName.toString();
- roughArtifact.setName(name);
Matcher match = doorsIdPattern.matcher(name);
if (match.find()) {
- roughArtifact.addAttribute(CoreAttributeTypes.StaticId, match.group(1));
+ String toSet = match.group(1);
+ roughArtifact.addAttribute(CoreAttributeTypes.StaticId, toSet);
}
roughArtifact.addAttribute(CoreAttributeTypes.PublishInline, "True");
wordFormattedContent.append(newContent.toString());
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 ee79358fa2..82ae11c975 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
@@ -17,7 +17,6 @@ import java.util.regex.Pattern;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
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;
@@ -126,7 +125,10 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
if (newOutlineNumber) {
setContent();
String number = outlineNumber.toString();
- roughArtifact = setUpNewArtifact(collector, number);
+ roughArtifact = setUpNewArtifact(collector, number, logger);
+ if (roughArtifact == null) {
+ return;
+ }
previousNamedArtifact = roughArtifact;
processHeadingText(roughArtifact, WordUtil.textOnly(outlineName.toString()));
roughArtMeta.put(number, paragraphStyle);
@@ -315,7 +317,7 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
/**
* Checks if another artifact with the same outlineNumber was created
*/
- private RoughArtifact setUpNewArtifact(RoughArtifactCollector collector, String outlineNumber) throws OseeCoreException {
+ private RoughArtifact setUpNewArtifact(RoughArtifactCollector collector, String outlineNumber, OperationLogger logger) throws OseeCoreException {
RoughArtifact duplicateArtifact = duplicateCatcher.get(outlineNumber);
if (duplicateArtifact == null) {
RoughArtifact roughArtifact = new RoughArtifact(RoughArtifactKind.PRIMARY);
@@ -331,8 +333,9 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate
return roughArtifact;
} else {
String previousArtifcatName = previousNamedArtifact != null ? previousNamedArtifact.getName() : "null";
- throw new OseeStateException("Paragraph %s found more than once following \"%s\" which is a duplicate of %s",
- outlineNumber, previousArtifcatName, duplicateArtifact.getName());
+ logger.log("Paragraph %s found more than once following \"%s\" which is a duplicate of %s", outlineNumber,
+ previousArtifcatName, duplicateArtifact.getName());
+ return null;
}
}

Back to the top