Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.skynet')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.java95
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.java135
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.java88
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java26
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.java28
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java40
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java118
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java51
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.java271
13 files changed, 0 insertions, 944 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
index 207e3898bd8..c66e43ee598 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
@@ -223,7 +223,6 @@ Export-Package: org.eclipse.osee.framework.ui.skynet,
org.eclipse.osee.framework.ui.skynet.render.compare,
org.eclipse.osee.framework.ui.skynet.render.dsl,
org.eclipse.osee.framework.ui.skynet.render.word,
- org.eclipse.osee.framework.ui.skynet.render.word.template,
org.eclipse.osee.framework.ui.skynet.results,
org.eclipse.osee.framework.ui.skynet.results.example,
org.eclipse.osee.framework.ui.skynet.results.html,
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 38f583e2e42..fcad84f9a98 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -166,9 +166,6 @@
<extension id="word" point="org.eclipse.osee.framework.ui.skynet.ArtifactRenderer">
<Renderer classname="org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer"/>
</extension>
- <extension id="tis" point="org.eclipse.osee.framework.ui.skynet.ArtifactRenderer">
- <Renderer classname="org.eclipse.osee.framework.ui.skynet.render.TisRenderer"/>
- </extension>
<extension id="url" point="org.eclipse.osee.framework.ui.skynet.ArtifactRenderer">
<Renderer classname="org.eclipse.osee.framework.ui.skynet.render.UrlRenderer"/>
</extension>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.java
deleted file mode 100644
index 3994f919c95..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render;
-
-import static org.eclipse.osee.framework.core.enums.PresentationType.DEFAULT_OPEN;
-import static org.eclipse.osee.framework.core.enums.PresentationType.PREVIEW;
-import java.io.InputStream;
-import java.nio.charset.CharacterCodingException;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.PresentationType;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.io.CharBackedInputStream;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.MenuCmdDef;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.BasicTemplateAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.ITemplateAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.SRSSpecialPublishingAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.TISAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.WordAttributeTypeAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.WordTemplateManager;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class TisRenderer extends WordTemplateRenderer {
-
- @Override
- public TisRenderer newInstance() {
- return new TisRenderer();
- }
-
- @Override
- public int getApplicabilityRating(PresentationType presentationType, Artifact artifact, Object... objects) throws OseeCoreException {
- if (artifact.getArtifactType().inheritsFrom(CoreArtifactTypes.TestInformationSheet) && presentationType.matches(
- DEFAULT_OPEN, PREVIEW)) {
- return SPECIALIZED_MATCH;
- }
- return NO_MATCH;
- }
-
- @Override
- public void addMenuCommandDefinitions(ArrayList<MenuCmdDef> commands, Artifact artifact) {
- ImageDescriptor imageDescriptor = ImageManager.getProgramImageDescriptor("doc");
- commands.add(new MenuCmdDef(CommandGroup.PREVIEW, PREVIEW, "MS Word TIS Preview", imageDescriptor));
- }
-
- @Override
- public String getName() {
- return "MS Word TIS Preview";
- }
-
- @Override
- public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
- Artifact template;
-
- if (artifacts.isEmpty()) {
- // Still need to get a default template with a null artifact list
- template = getTemplate(null, presentationType);
- } else {
- Artifact firstArtifact = artifacts.iterator().next();
- template = getTemplate(firstArtifact, presentationType);
- }
-
- List<ITemplateAttributeHandler> handlers = new ArrayList<>();
- handlers.add(new SRSSpecialPublishingAttributeHandler());
- handlers.add(new TISAttributeHandler());
- handlers.add(new WordAttributeTypeAttributeHandler());
- handlers.add(new BasicTemplateAttributeHandler());
- WordTemplateManager wtm = new WordTemplateManager(template.getSoleAttributeValue(CoreAttributeTypes.WholeWordContent), handlers);
- CharBackedInputStream charBak = null;
- try {
- charBak = new CharBackedInputStream();
- WordMLProducer wordMl = new WordMLProducer(charBak);
- wtm.processArtifacts(wordMl, artifacts);
- } catch (CharacterCodingException ex) {
- OseeCoreException.wrapAndThrow(ex);
- }
- return charBak;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java
deleted file mode 100644
index ed72b9ee3d1..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import java.util.List;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class AddTemplateText implements ITemplateTask {
-
- private final String template;
- private final int begin;
- private final int end;
-
- public AddTemplateText(int begin, int end, String template) {
- this.template = template;
- this.end = end;
- this.begin = begin;
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException {
- wordMl.addWordMl(template.subSequence(begin, end));
- }
-
- @Override
- public boolean isTypeNameWildcard() {
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.java
deleted file mode 100644
index 31ddbde3ade..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.core.data.RelationTypeSide;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class ArtifactProcessing implements ITemplateTask {
-
- private final List<ITemplateTask> innerTasks;
- private boolean outlining;
- private boolean recurseChildren;
- private RelationTypeSide outlineRelation;
- private String headingAttributeName;
- private String outlineNumber;
- private String cleanedText;
- private String artifactSetName;
-
- private static final Matcher outlineElementsMatcher = Pattern.compile("<((\\w+:)?(Outline))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher internalOutlineElementsMatcher =
- Pattern.compile("<((\\w+:)?(HeadingAttribute|RecurseChildren|Number))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher setNameMatcher =
- Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
-
- public ArtifactProcessing(List<ITemplateTask> innerTasks, String artifactSection, String elementType) {
- this.innerTasks = innerTasks;
- extractInformation(artifactSection, elementType);
- }
-
- @Override
- public boolean isTypeNameWildcard() {
- return false;
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) {
- // do nothing
- }
-
- public List<ITemplateTask> getTasks() {
- return innerTasks;
- }
-
- private void extractInformation(String artifactElement, String type) {
- if (type.equals("Artifact")) {
- setNameMatcher.reset(artifactElement);
- setNameMatcher.find();
- artifactSetName = WordUtil.textOnly(setNameMatcher.group(2));
- artifactElement = setNameMatcher.replaceAll("");
- }
- outlineElementsMatcher.reset(artifactElement);
-
- if (outlineElementsMatcher.find()) {
- internalOutlineElementsMatcher.reset(outlineElementsMatcher.group(4));
- outlining = true;
- recurseChildren = false;
- outlineRelation = CoreRelationTypes.Default_Hierarchical__Child;
-
- while (internalOutlineElementsMatcher.find()) {
- String elementType = internalOutlineElementsMatcher.group(3);
- String value = WordUtil.textOnly(internalOutlineElementsMatcher.group(4));
-
- if (elementType.equals("HeadingAttribute")) {
- headingAttributeName = value;
- } else if (elementType.equals("RecurseChildren")) {
- recurseChildren = Boolean.parseBoolean(value);
- } else if (elementType.equals("Number")) {
- outlineNumber = value;
- }
- }
- } else {
- outlining = false;
- recurseChildren = false;
- outlineRelation = null;
- headingAttributeName = null;
- }
- cleanedText = outlineElementsMatcher.replaceAll("");
- }
-
- public List<ITemplateTask> getInnerTasks() {
- return innerTasks;
- }
-
- public boolean isOutlining() {
- return outlining;
- }
-
- public boolean isRecurseChildren() {
- return recurseChildren;
- }
-
- public RelationTypeSide getOutlineRelation() {
- return outlineRelation;
- }
-
- public String getHeadingAttributeName() {
- return headingAttributeName;
- }
-
- public String getOutlineNumber() {
- return outlineNumber;
- }
-
- public String getText() {
- return this.cleanedText;
- }
-
- /**
- * @return the artifactSetName
- */
- public String getArtifactSetName() {
- return artifactSetName;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.java
deleted file mode 100644
index 930101a127e..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public final class BasicTemplateAttributeHandler implements ITemplateAttributeHandler {
-
- private final Set<String> ignoreAttributeExtensions;
-
- public BasicTemplateAttributeHandler() {
- this.ignoreAttributeExtensions = new HashSet<>();
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute templateAttribute) throws OseeCoreException {
- AttributeType attributeType = AttributeTypeManager.getType(templateAttribute.getName());
- Collection<Attribute<Object>> attributes = artifact.getAttributes(attributeType);
- if (!attributes.isEmpty()) {
- Attribute<Object> attribute = attributes.iterator().next();
- attributeType = attribute.getAttributeType();
-
- // check if the attribute descriptor name is in the ignore list.
- if (ignoreAttributeExtensions.contains(attributeType.getName())) {
- return;
- }
-
- if (templateAttribute.isParagrapthWrap()) {
- wordMl.startParagraph();
- }
- // assumption: the label is of the form <w:r><w:t> text </w:t></w:r>
- // if (allAttrs) {
- if (templateAttribute.hasLabel()) {
- wordMl.addWordMl("<w:r><w:t> " + templateAttribute.getName() + ": </w:t></w:r>");
- }
- // } else {
- // if (templateAttribute.hasLabel()) {
- // wordMl.addParagraph(templateAttribute.getLabel());
- // }
- //
- String valueList;
- if (attributeType.equals(CoreAttributeTypes.WordTemplateContent)) {
- wordMl.addWordMl((String) attribute.getValue());
- } else {
- valueList = Collections.toString(", ", artifact.getAttributes(attributeType));
- if (templateAttribute.hasFormatting()) {
- if (templateAttribute.getFormat().contains(">x<")) {
- wordMl.addWordMl(templateAttribute.getFormat().replace(">x<", ">" + valueList + "<"));
- }
- } else {
- wordMl.addTextInsideParagraph(valueList);
- }
- }
- if (templateAttribute.isParagrapthWrap()) {
- wordMl.endParagraph();
- }
-
- }
- }
-
- @Override
- public boolean canHandle(Artifact artifact, TemplateAttribute attribute) {
- return true;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java
deleted file mode 100644
index 6a12e07c550..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public interface ITemplateAttributeHandler {
-
- void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) throws OseeCoreException;
-
- boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException;
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.java
deleted file mode 100644
index cf90089e6e7..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import java.util.List;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public interface ITemplateTask {
-
- void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException;
-
- boolean isTypeNameWildcard();
-
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.java
deleted file mode 100644
index 1c1208950d8..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import org.eclipse.osee.framework.core.data.AttributeId;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class SRSSpecialPublishingAttributeHandler implements ITemplateAttributeHandler {
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) {
- // do nothing
- }
-
- @Override
- public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
- // This is for SRS Publishing. Do not publish unspecified attributes
- if (attribute.getName().equals(CoreAttributeTypes.Partition.getName()) || attribute.getName().equals(
- CoreAttributeTypes.SeverityCategory.getName())) {
- for (Attribute<?> partition : artifact.getAttributes(CoreAttributeTypes.Partition)) {
- if (partition.getValue().equals(AttributeId.UNSPECIFIED)) {
- return true;
- }
- }
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java
deleted file mode 100644
index fbfa92b4f6f..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class TISAttributeHandler implements ITemplateAttributeHandler {
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
- for (Artifact requirement : artifact.getRelatedArtifacts(CoreRelationTypes.Verification__Requirement)) {
- wordMl.addParagraphBold(
- requirement.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, "") + "\t" + requirement.getName());
- String str = requirement.getSoleAttributeValue(CoreAttributeTypes.WordTemplateContent);
- wordMl.addWordMl(str);
- }
- }
-
- @Override
- public boolean canHandle(Artifact artifact, TemplateAttribute attribute) {
- return attribute.getName().equals("TIS Traceability");
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java
deleted file mode 100644
index 3e2251cd5ea..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class TemplateAttribute implements ITemplateTask {
-
- private static Matcher trimTags = Pattern.compile("(<.*?>)").matcher("");
-
- private String name;
- private String label;
- private String editable;
- private String format;
- private String outline;
- private boolean paragraphWrap = true;
-
- public TemplateAttribute() {
- // do nothing
- }
-
- public TemplateAttribute(TemplateAttribute copyMe, String name) {
- this.editable = copyMe.editable;
- this.format = copyMe.format;
- this.label = copyMe.label;
- this.outline = copyMe.outline;
- this.name = name;
- this.paragraphWrap = copyMe.paragraphWrap;
- }
-
- public void addName(String name) {
- trimTags.reset(name);
- this.name = trimTags.replaceAll("");
- }
-
- public void addLabel(String label) {
- this.label = label;
- }
-
- public void addEditable(String editable) {
- this.editable = editable;
- }
-
- public void addFormat(String format) {
- this.format = format;
- }
-
- public void addNOutline(String outline) {
- this.outline = outline;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException {
- for (ITemplateAttributeHandler handler : handlers) {
- if (handler.canHandle(artifact, this)) {
- handler.process(wordMl, artifact, this);
- return;
- }
- }
- // throw new Exception(String.format("There was not a valid handler for Artifact[%s] and TemplateAttribute[%s].",
- // artifact.toString(), this.toString()));
- System.out.println(String.format("There was not a valid handler for Artifact[%s] and TemplateAttribute[%s].",
- artifact.toString(), this.toString()));
- }
-
- public String getLabel() {
- return this.label;
- }
-
- public String getFormat() {
- return this.format;
- }
-
- public boolean hasFormatting() {
- return this.format != null && this.format.length() > 0;
- }
-
- public boolean hasLabel() {
- return this.label != null && this.label.length() > 0;
- }
-
- @Override
- public boolean isTypeNameWildcard() {
- return getName().equals("*");
- }
-
- public void addParagraphWrap(String group) {
- trimTags.reset(group);
- String value = trimTags.replaceAll("");
- this.paragraphWrap = Boolean.parseBoolean(value);
- }
-
- public boolean isParagrapthWrap() {
- return this.paragraphWrap;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java
deleted file mode 100644
index 87f2710d36e..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public final class WordAttributeTypeAttributeHandler implements ITemplateAttributeHandler {
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute templateAttribute) throws OseeCoreException {
- Collection<Attribute<Object>> attributes =
- artifact.getAttributes(AttributeTypeManager.getType(templateAttribute.getName()));
-
- if (!attributes.isEmpty()) {
- Attribute<Object> attribute = attributes.iterator().next();
-
- if (templateAttribute.hasLabel()) {
- wordMl.addParagraph(templateAttribute.getLabel());
- }
-
- wordMl.addWordMl(Xml.escape(attribute.toString()));
- wordMl.resetListValue();
- }
- }
-
- @Override
- public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
- boolean goodAttributeType = attribute.equals(CoreAttributeTypes.WordTemplateContent);
- boolean goodArtifact = artifact.isAttributeTypeValid(CoreAttributeTypes.WordTemplateContent);
- return goodAttributeType && goodArtifact;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.java
deleted file mode 100644
index 56da7b761e9..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.ui.skynet.render.word.template;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.core.data.AttributeTypeToken;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class WordTemplateManager {
-
- // private static final Matcher setNameMatcher =
- // Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- // private static final Matcher headElementsMatcher =
- // Pattern.compile("<((\\w+:)(Artifact|Extension_Processor))>(.*?)</\\1>",
- // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- //
- // private static final Matcher artifactMatcher = Pattern.compile(
- // "<\\w+?:Artifact>(.*?)</\\w+?:Artifact>",
- // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
- // .matcher("");
- //
- // private static final Matcher internalMatcher = Pattern.compile(
- // "<\\w*?(Label|Outline|Name|Format|Editable)>(.*?)</\\1>",
- // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
- // .matcher("");
- // private static final Matcher attributeMatcher = Pattern.compile(
- // "<((\\w+:)?(Attribute))>(.*?)</\\3>",
- // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
- // .matcher("");
-
- private static final Matcher setNameMatcher =
- Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher headElementsMatcher =
- Pattern.compile("<((\\w+:)?(Artifact|Extension_Processor))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher attributeElementsMatcher = Pattern.compile("<((\\w+:)?(Attribute))>(.*?)</\\3>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher internalAttributeElementsMatcher =
- Pattern.compile("<((\\w+:)?(Label|Outline|Name|Format|Editable|ParagraphWrap))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
-
- enum XmlAttributeType {
- Label,
- Outline,
- Name,
- Format,
- Editable,
- ParagraphWrap
- }
-
- private String template;
- private final String artifactSetName;
- private final List<ITemplateTask> tasks = new ArrayList<>();
- private final List<ITemplateAttributeHandler> attributeHandlers;
-
- public WordTemplateManager(String template, List<ITemplateAttributeHandler> attributeHandlers) {
- // this.template = sanatize(template);
- this.template = template;
- this.attributeHandlers = attributeHandlers;
- this.artifactSetName = getArtifactSetName();
- // preProcessTemplatePositions();
-
- }
-
- private String getArtifactSetName() {
- String artifactSetName = "";
- headElementsMatcher.reset(template);
-
- if (headElementsMatcher.find()) {
- String elementType = headElementsMatcher.group(3);
- String elementValue = headElementsMatcher.group(4);
-
- if (elementType.equals("Artifact")) {
- setNameMatcher.reset(elementValue);
- setNameMatcher.find();
- artifactSetName = WordUtil.textOnly(setNameMatcher.group(2));
- }
- }
- return artifactSetName;
- }
-
- private void preProcessTemplateInsideArtifactTag(String text, List<ITemplateTask> innerTasks) {
- String newtext = text;//trimUnwantedText(text);
- attributeElementsMatcher.reset(newtext);
- int last = 0;
- while (attributeElementsMatcher.find()) {
- int start = attributeElementsMatcher.start();
- innerTasks.add(new AddTemplateText(last, start, newtext));
- int end = attributeElementsMatcher.end();
- last = end;
- TemplateAttribute processAttribute = new TemplateAttribute();
- innerTasks.add(processAttribute);
- String internal = attributeElementsMatcher.group(4);
- internalAttributeElementsMatcher.reset(internal);
- while (internalAttributeElementsMatcher.find()) {
- String type = internalAttributeElementsMatcher.group(3);
- switch (XmlAttributeType.valueOf(type)) {
- case Label:
- processAttribute.addLabel(internalAttributeElementsMatcher.group(4));
- break;
- case Editable:
- processAttribute.addEditable(internalAttributeElementsMatcher.group(4));
- break;
- case Format:
- processAttribute.addFormat(internalAttributeElementsMatcher.group(4));
- break;
- case Name:
- processAttribute.addName(internalAttributeElementsMatcher.group(4));
- break;
- case Outline:
- processAttribute.addNOutline(internalAttributeElementsMatcher.group(4));
- break;
- case ParagraphWrap:
- processAttribute.addParagraphWrap(internalAttributeElementsMatcher.group(4));
- break;
- default:
- break;
- }
- }
- }
- innerTasks.add(new AddTemplateText(last, newtext.length(), newtext));
- }
-
- private void preProcessTemplatePositions() {
- headElementsMatcher.reset(template);
- int last = 0;
- while (headElementsMatcher.find()) {
- int start = headElementsMatcher.start();
- tasks.add(new AddTemplateText(last, start, template));
- int end = headElementsMatcher.end();
- last = end;
- List<ITemplateTask> innerTasks = new ArrayList<>();
- String artifactSection = headElementsMatcher.group(4);
- String elementType = headElementsMatcher.group(3);
-
- ArtifactProcessing artifactProcessing = new ArtifactProcessing(innerTasks, artifactSection, elementType);
- tasks.add(artifactProcessing);
- preProcessTemplateInsideArtifactTag(artifactProcessing.getText(), innerTasks);
-
- }
- tasks.add(new AddTemplateText(last, template.length(), template));
- }
-
- public String getArtifactSet() {
- return this.artifactSetName;
- }
-
- public void processArtifacts(WordMLProducer wordMl, List<Artifact> artifacts) throws OseeCoreException {
- String outlineNumber = peekAtFirstArtifactToGetParagraphNumber(template, artifacts);
- template = wordMl.setHeadingNumbers(outlineNumber, template, null);
- preProcessTemplatePositions();
-
- for (ITemplateTask task : tasks) {
- if (task instanceof ArtifactProcessing) {
- ArtifactProcessing artifactProcessingTask = (ArtifactProcessing) task;
-
- if (artifactProcessingTask.isRecurseChildren()) {
- artifacts = recurseArtifactChildren(artifacts);
- }
- List<ITemplateTask> artifactAttributeTasks = ((ArtifactProcessing) task).getTasks();
- for (Artifact artifact : artifacts) {
-
- boolean performedOutLining = false;
-
- if (artifactProcessingTask.isOutlining()) {
- performedOutLining = true;
-
- String headingText = artifact.getSoleAttributeValue(
- AttributeTypeManager.getType(artifactProcessingTask.getHeadingAttributeName()), "");
- wordMl.startOutlineSubSection("Times New Roman", headingText, null);
- }
-
- List<ITemplateTask> actualTasks = preProcessTemplateTasks(artifactAttributeTasks, artifact);
- for (ITemplateTask inner : actualTasks) {
- inner.process(wordMl, artifact, attributeHandlers);
- }
-
- if (performedOutLining) {
- wordMl.endOutlineSubSection();
- }
-
- wordMl.setPageLayout(artifact);
- }
- } else {
- task.process(wordMl, null, attributeHandlers);
- }
- }
- }
-
- private List<Artifact> recurseArtifactChildren(List<Artifact> artifacts) throws OseeCoreException {
- List<Artifact> arts = new ArrayList<>();
- for (Artifact art : artifacts) {
- recursiveChildResolver(art, arts);
- }
- return arts;
- }
-
- private void recursiveChildResolver(Artifact artifact, List<Artifact> arts) throws OseeCoreException {
- arts.add(artifact);
- for (Artifact child : artifact.getChildren()) {
- recursiveChildResolver(child, arts);
- }
- }
-
- /**
- * This method expands wildcard(*) attribute names into all of the attribute types of a particular artifact.
- */
- private List<ITemplateTask> preProcessTemplateTasks(List<ITemplateTask> tasks, Artifact artifact) throws OseeCoreException {
- List<ITemplateTask> newTasks = new ArrayList<>();
- for (ITemplateTask task : tasks) {
- if (task instanceof TemplateAttribute && ((TemplateAttribute) task).isTypeNameWildcard()) {
- TemplateAttribute attributeTask = (TemplateAttribute) task;
- for (AttributeTypeToken attributeType : artifact.getAttributeTypes()) {
- newTasks.add(new TemplateAttribute(attributeTask, attributeType.getName()));
- }
- } else {
- newTasks.add(task);
- }
- }
- return newTasks;
- }
-
- private String peekAtFirstArtifactToGetParagraphNumber(String template, List<Artifact> artifacts) throws OseeCoreException {
- Pattern headElementsPattern = Pattern.compile("<((\\w+:)?(Artifact|Extension_Processor))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- String startParagraphNumber = "1";
- Matcher matcher = headElementsPattern.matcher(template);
-
- if (matcher.find()) {
- String elementType = matcher.group(3);
- String elementValue = matcher.group(4);
-
- if (elementType.equals("Artifact")) {
- // Matcher setNameMatcher = setNamePattern.matcher(elementValue);
- setNameMatcher.reset(elementValue);
- setNameMatcher.find();
-
- if (!artifacts.isEmpty()) {
- Artifact artifact = artifacts.iterator().next();
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.ParagraphNumber)) {
- if (!artifact.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, "").equals("")) {
- startParagraphNumber = artifact.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, "");
- }
- }
- }
- }
- }
- return startParagraphNumber;
- }
-
-}

Back to the top