Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid W. Miller2018-06-11 20:05:05 +0000
committerDavid W. Miller2018-06-15 17:38:40 +0000
commite96667644e68f17397d60cf0073583f059ce8e83 (patch)
tree409bf5708a1d672c7364fb253a085af7b8083faa /plugins
parentc261b18312105396b5821098a7289e44b26a8688 (diff)
downloadorg.eclipse.osee-e96667644e68f17397d60cf0073583f059ce8e83.tar.gz
org.eclipse.osee-e96667644e68f17397d60cf0073583f059ce8e83.tar.xz
org.eclipse.osee-e96667644e68f17397d60cf0073583f059ce8e83.zip
refinement[ats_TW9856]: Update types imported in F-18 importer
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactKind.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/DoorsWordOutlineExtractor.java50
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java18
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactResolverFactory.java3
4 files changed, 61 insertions, 12 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactKind.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactKind.java
index 968b84097f2..59416ea58f8 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactKind.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactKind.java
@@ -16,5 +16,7 @@ package org.eclipse.osee.framework.skynet.core.importing;
public enum RoughArtifactKind {
PRIMARY,
SECONDARY,
+ TERTIARY,
+ QUATERNARY,
CONTAINER
}
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 22df67f6498..c8fb027ff7a 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
@@ -28,6 +28,8 @@ import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifact
*/
public class DoorsWordOutlineExtractor extends WordOutlineExtractorDelegate {
private static final Pattern reqnamePattern = Pattern.compile("(\\{[^}]+\\})(.*?</w:p>)");
+ private static final Pattern outlinePattern = Pattern.compile("(\\{[^}]+\\})");
+ private static final Pattern doorsIdPattern = Pattern.compile("\\{[^-]+\\-([^}]+)\\}");
private int lastReqNumber = 1;
@Override
@@ -37,7 +39,8 @@ public class DoorsWordOutlineExtractor extends WordOutlineExtractorDelegate {
if (needsNewArt(content, newName, newContent)) {
setContent(); // finishes the previous rough artifact
String number = String.format("%s.0.%d", lastHeaderNumber.toString(), lastReqNumber++);
- roughArtifact = new RoughArtifact(RoughArtifactKind.PRIMARY);
+
+ roughArtifact = new RoughArtifact(getRoughArtifactType(newName.toString()));
if (collector != null) {
collector.addRoughArtifact(roughArtifact);
}
@@ -45,7 +48,12 @@ public class DoorsWordOutlineExtractor extends WordOutlineExtractorDelegate {
roughArtifact.setSectionNumber(number);
roughArtifact.addAttribute(CoreAttributeTypes.ParagraphNumber, number);
}
- roughArtifact.setName(newName.toString());
+ String name = newName.toString();
+ roughArtifact.setName(name);
+ Matcher match = doorsIdPattern.matcher(name);
+ if (match.find()) {
+ roughArtifact.addAttribute(CoreAttributeTypes.StaticId, match.group(1));
+ }
roughArtifact.addAttribute(CoreAttributeTypes.PublishInline, "True");
wordFormattedContent.append(newContent.toString());
previousNamedArtifact = roughArtifact;
@@ -54,6 +62,31 @@ public class DoorsWordOutlineExtractor extends WordOutlineExtractorDelegate {
}
}
+ private RoughArtifactKind getRoughArtifactType(String newName) {
+ RoughArtifactKind toReturn = RoughArtifactKind.PRIMARY;
+ if (newName.contains("Doc Dsc")) {
+ toReturn = RoughArtifactKind.TERTIARY;
+ } else if (newName.contains("Dsg Dsc")) {
+ toReturn = RoughArtifactKind.QUATERNARY;
+ }
+ return toReturn;
+ }
+
+ @Override
+ public void processHeadingText(RoughArtifact roughArtifact, String headingText) throws OseeCoreException {
+ roughArtifact.setRoughArtifactKind(RoughArtifactKind.SECONDARY);
+ Matcher match = outlinePattern.matcher(headingText);
+ if (match.find()) {
+ roughArtifact.setName(headingText.substring(0, match.start(1)).trim());
+ Matcher matchId = doorsIdPattern.matcher(headingText);
+ if (matchId.find()) {
+ roughArtifact.addAttribute(CoreAttributeTypes.StaticId, matchId.group(1));
+ }
+ return;
+ }
+ roughArtifact.setName(headingText.trim());
+ }
+
@Override
protected boolean checkSectionNumber(String sectionNumber) {
if (sectionNumber.contains(".0.")) {
@@ -73,19 +106,16 @@ public class DoorsWordOutlineExtractor extends WordOutlineExtractorDelegate {
}
private boolean needsNewArt(String content, StringBuilder newName, StringBuilder newContent) {
+ if (content.contains("####")) {
+ return false; // special case for match in description
+ }
Matcher match = reqnamePattern.matcher(content);
- boolean again = false;
- while (match.find()) {
- if (again) {
- throw new OseeCoreException("new Artifact processor found too many requirement names in this block: %s",
- content);
- }
- again = true;
+ if (match.find()) {
String begin = content.substring(0, match.start(1));
newName.append(content.substring(match.start(1), match.start(2)));
String endString = content.substring(match.start(2), match.end(2));
newContent.append(begin + endString);
- return true;
+ return true; // only finds the first one
}
return false;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java
index 3e3fd47095f..89c99cb2ab7 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java
@@ -11,8 +11,8 @@
package org.eclipse.osee.framework.skynet.core.importing.resolvers;
import java.util.logging.Level;
-import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -29,11 +29,23 @@ public class NewArtifactImportResolver implements IArtifactImportResolver {
private final IRoughArtifactTranslator translator;
private final IArtifactType primaryArtifactType;
private final IArtifactType secondaryArtifactType;
+ private final IArtifactType tertiaryArtifactType;
+ private final IArtifactType quaternaryArtifactType;
public NewArtifactImportResolver(IRoughArtifactTranslator translator, IArtifactType primaryArtifactType, IArtifactType secondaryArtifactType) {
this.translator = translator;
this.primaryArtifactType = primaryArtifactType;
this.secondaryArtifactType = secondaryArtifactType;
+ this.tertiaryArtifactType = secondaryArtifactType;
+ this.quaternaryArtifactType = secondaryArtifactType;
+ }
+
+ public NewArtifactImportResolver(IRoughArtifactTranslator translator, IArtifactType primaryArtifactType, IArtifactType secondaryArtifactType, IArtifactType tertiaryArtifactType, IArtifactType quaternaryArtifactType) {
+ this.translator = translator;
+ this.primaryArtifactType = primaryArtifactType;
+ this.secondaryArtifactType = secondaryArtifactType;
+ this.tertiaryArtifactType = tertiaryArtifactType;
+ this.quaternaryArtifactType = quaternaryArtifactType;
}
protected IRoughArtifactTranslator getTranslator() {
@@ -58,6 +70,10 @@ public class NewArtifactImportResolver implements IArtifactImportResolver {
return primaryArtifactType;
case SECONDARY:
return secondaryArtifactType;
+ case TERTIARY:
+ return tertiaryArtifactType;
+ case QUATERNARY:
+ return quaternaryArtifactType;
case CONTAINER:
return CoreArtifactTypes.Folder;
default:
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactResolverFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactResolverFactory.java
index 040577f5a1f..cdb9f94e713 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactResolverFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactResolverFactory.java
@@ -49,7 +49,8 @@ public final class ArtifactResolverFactory {
public static IArtifactImportResolver createAlwaysNewArtifacts(IArtifactType primaryArtifactType, IArtifactType secondaryArtifactType) {
IRoughArtifactTranslator translator = new RoughArtifactTranslatorImpl();
- return new NewArtifactImportResolver(translator, primaryArtifactType, secondaryArtifactType);
+ return new NewArtifactImportResolver(translator, primaryArtifactType, secondaryArtifactType,
+ CoreArtifactTypes.Design, CoreArtifactTypes.SubsystemDesign);
}
public static IArtifactImportResolver createResolver(ArtifactCreationStrategy strategy, IArtifactType primaryArtifactType, Collection<AttributeTypeToken> nonChangingAttributes, boolean createNewIfNotExist, boolean deleteUnmatchedArtifacts) {

Back to the top