summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2010-12-06 12:57:11 (EST)
committer Ryan D. Brooks2010-12-06 12:57:11 (EST)
commit5ed308484c1c1b7842d4d8b7026c1f9e91777339 (patch)
treea63a0e94792802906a4c1800c7c528f954e24162
parentaf120a2f6e6aeacc019416e63f1a1516685cb02d (diff)
downloadorg.eclipse.osee-5ed308484c1c1b7842d4d8b7026c1f9e91777339.zip
org.eclipse.osee-5ed308484c1c1b7842d4d8b7026c1f9e91777339.tar.gz
org.eclipse.osee-5ed308484c1c1b7842d4d8b7026c1f9e91777339.tar.bz2
bug[bgz_331961]: Add PublishInLine attribute support
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_Demo_Suite.java42
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java197
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTestSuite.java23
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/a_with_publish_inline.xml34
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/a_without_publish_inline.xml1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/c_with_publish_inline.xml34
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/c_without_publish_inline.xml57
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/f_with_publish_inline.xml1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/f_without_publish_inline.xml1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java14
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java66
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java38
15 files changed, 457 insertions, 62 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
index 12efb6d..824f058 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
@@ -387,7 +387,7 @@ public class BranchManager {
private static Branch createBranch(BranchType branchType, TransactionRecord parentTransaction, String branchName, String branchGuid, Artifact associatedArtifact, String creationComment, int populateBaseTxFromAddressingQueryId, int destinationBranchId) throws OseeCoreException {
CreateBranchHttpRequestOperation operation =
new CreateBranchHttpRequestOperation(branchType, parentTransaction, branchName, branchGuid,
- associatedArtifact, creationComment, populateBaseTxFromAddressingQueryId, destinationBranchId);
+ associatedArtifact, creationComment, populateBaseTxFromAddressingQueryId, destinationBranchId);
Operations.executeWorkAndCheckStatus(operation);
return operation.getNewBranch();
}
@@ -469,7 +469,7 @@ public class BranchManager {
getCache().storeItems(branches);
}
- public static String toFileName(Branch branch) throws OseeCoreException {
+ public static String toFileName(IOseeBranch branch) throws OseeCoreException {
return BranchUtility.toFileName(branch);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java
index 9349759..bf86711 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchUtility.java
@@ -14,6 +14,7 @@ package org.eclipse.osee.framework.skynet.core.artifact;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
@@ -29,13 +30,13 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
*/
public final class BranchUtility {
- public static String toFileName(Branch branch) throws OseeCoreException {
+ public static String toFileName(IOseeBranch branch) throws OseeCoreException {
if (branch == null) {
throw new OseeArgumentException("branch cannot be null");
}
String branchGuid = branch.getGuid();
if (!GUID.isValid(branchGuid)) {
- throw new OseeStateException("GUID for branch [%s] is invalid", branch.getId());
+ throw new OseeStateException("GUID for branch [%s] is invalid", branch.getName());
}
return encode(branchGuid);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee b/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
index 49b049c..35a9b2e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
+++ b/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
@@ -294,6 +294,7 @@ artifactType "Folder" extends "Artifact" {
artifactType "General Data" extends "Artifact" {
guid "AAMFDhQXfyb2m+jCwlwA"
attribute "General String Data"
+ attribute "PublishInline"
}
artifactType "Support Document" extends "MS Word Template" {
@@ -468,6 +469,7 @@ artifactType "MS Word Template" extends "MS Word" {
attribute "Word Ole Data"
attribute "Page Type"
attribute "Word Template Content"
+ attribute "PublishInline"
}
abstract artifactType "Native Artifact" extends "Artifact" {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_Demo_Suite.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_Demo_Suite.java
index 94c266f..54085d6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_Demo_Suite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/FrameworkUi_Demo_Suite.java
@@ -3,7 +3,7 @@
* 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
+ * http:www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
@@ -30,30 +30,32 @@ import org.eclipse.osee.framework.ui.skynet.test.importer.ImportTestSuite;
import org.eclipse.osee.framework.ui.skynet.test.renderer.RendererTestSuite;
import org.eclipse.osee.framework.ui.skynet.test.util.enumeration.AbstractEnumerationTest;
import org.eclipse.osee.framework.ui.skynet.test.widgets.workflow.WorkPageAdapterTest;
+import org.eclipse.osee.framework.ui.skynet.test.render.word.WordTestSuite;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({//
-BlamXWidgetTest.class, //
- EmailGroupsBlamTest.class, //
- ResultsEditorConverterTest.class, //
- ArtifactPasteConfigurationTest.class, //
- ArtifactPasteOperationTest.class, //
- RelationOrderRendererTest.class, //
- InterArtifactDropTest.class, //
- WordEditTest.class, //
- WordTrackedChangesTest.class, //
- PreviewAndMultiPreviewTest.class, //
- ViewWordChangeAndDiffTest.class, //
- WordArtifactElementExtractorTest.class, //
- AttributeTypeEditPresenterTest.class, //
- ArtifactPromptChangeTest.class, //
- RendererTestSuite.class, //
- WorkPageAdapterTest.class, //
- AbstractEnumerationTest.class, //
- ImportTestSuite.class})
+@Suite.SuiteClasses({
+BlamXWidgetTest.class,
+ EmailGroupsBlamTest.class,
+ ResultsEditorConverterTest.class,
+ ArtifactPasteConfigurationTest.class,
+ ArtifactPasteOperationTest.class,
+ RelationOrderRendererTest.class,
+ InterArtifactDropTest.class,
+ WordEditTest.class,
+ WordTrackedChangesTest.class,
+ PreviewAndMultiPreviewTest.class,
+ ViewWordChangeAndDiffTest.class,
+ WordArtifactElementExtractorTest.class,
+ AttributeTypeEditPresenterTest.class,
+ ArtifactPromptChangeTest.class,
+ RendererTestSuite.class,
+ WorkPageAdapterTest.class,
+ AbstractEnumerationTest.class,
+ ImportTestSuite.class,
+ WordTestSuite.class})
/**
* @author Donald G. Dunne
*/
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java
new file mode 100644
index 0000000..da3aa38
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTemplateProcessorTest.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * 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.ui.skynet.test.render.word;
+
+import static org.eclipse.osee.support.test.util.DemoSawBuilds.SAW_Bld_1;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.ITemplateRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
+import org.eclipse.osee.support.test.util.TestUtil;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author Karol M. Wilk
+ * @link: WordTemplateProcessor
+ */
+public class WordTemplateProcessorTest {
+ private static Artifact myRootArtifact = null;
+ private static String ERROR_MESSAGE =
+ "Found improper %s's WordML in result file. Testing for %s PublishInLine set to true.";
+ private static SevereLoggingMonitor monitorLog = null;
+ private static String C_WITH_PUBLISH_INLINE = null;
+ private static String C_WITHOUT_PUBLISH_INLINE = null;
+ private static String A_WITH_PUBLISH_INLINE = null;
+ private static String A_WITHOUT_PUBLISH_INLINE = null;
+
+ private static String F_STRING_TO_WRAP_IN_WORDML = "F's body content";
+ private static String F_WITH_PUBLISH_INLINE = null;
+ private static String F_WITHOUT_PUBLISH_INLINE = null;
+
+ @Test
+ public void publishInLineOnChild() throws Exception {
+ Artifact artifact_C = myRootArtifact.getDescendant("A").getDescendant("C");
+ artifact_C.setSoleAttributeValue(CoreAttributeTypes.PublishInline, true);
+ artifact_C.setSoleAttributeValue(CoreAttributeTypes.WordTemplateContent, C_WITH_PUBLISH_INLINE);
+ artifact_C.persist();
+
+ String fileName = String.format("WordTemplateProcessorTest_%s_%s.xml", artifact_C, Lib.getDateTimeString());
+ String fullPath = RenderingUtil.getRenderFolder(SAW_Bld_1, PresentationType.PREVIEW).getLocation().toOSString();
+
+ RenderingUtil.setPopupsAllowed(false);
+ RendererManager.open(myRootArtifact, PresentationType.PREVIEW, new VariableMap(ITemplateRenderer.TEMPLATE_OPTION,
+ ITemplateRenderer.PREVIEW_WITH_RECURSE_VALUE, IRenderer.FILE_NAME_OPTION, fileName));
+
+ String fileContents = Lib.fileToString(new File(fullPath, fileName));
+ Assert.assertTrue(String.format(ERROR_MESSAGE, artifact_C, "with"), fileContents.contains(C_WITH_PUBLISH_INLINE));
+ Assert.assertTrue(String.format(ERROR_MESSAGE, artifact_C, "without"),
+ !fileContents.contains(C_WITHOUT_PUBLISH_INLINE));
+ }
+
+ @Test
+ public void publishInLineOnParent() throws Exception {
+ Artifact artifact_A = myRootArtifact.getDescendant("A");
+ artifact_A.setSoleAttributeValue(CoreAttributeTypes.PublishInline, true);
+ artifact_A.setSoleAttributeValue(CoreAttributeTypes.WordTemplateContent, A_WITH_PUBLISH_INLINE);
+ artifact_A.persist();
+
+ String fileName = String.format("WordTemplateProcessorTest_%s_%s.xml", artifact_A, Lib.getDateTimeString());
+ String fullPath = RenderingUtil.getRenderFolder(SAW_Bld_1, PresentationType.PREVIEW).getLocation().toOSString();
+
+ RenderingUtil.setPopupsAllowed(false);
+ RendererManager.open(myRootArtifact, PresentationType.PREVIEW, new VariableMap(ITemplateRenderer.TEMPLATE_OPTION,
+ ITemplateRenderer.PREVIEW_WITH_RECURSE_VALUE, IRenderer.FILE_NAME_OPTION, fileName));
+
+ String fileContents = Lib.fileToString(new File(fullPath, fileName));
+ Assert.assertTrue(String.format(ERROR_MESSAGE, artifact_A, "with"), fileContents.contains(A_WITH_PUBLISH_INLINE));
+ Assert.assertTrue(String.format(ERROR_MESSAGE, artifact_A, "without"),
+ !fileContents.contains(A_WITHOUT_PUBLISH_INLINE));
+ }
+
+ /**
+ * The GeneralStringData argument in this case is just plain string as <br/>
+ * WordTemplateProcessor will wrap it in a <w:p>..whatever..</w:p> xml.
+ */
+ @Test
+ public void publishInLineNonWordArtifact() throws Exception {
+ Artifact artifact_F = myRootArtifact.getDescendant("F");
+ artifact_F.setSoleAttributeValue(CoreAttributeTypes.PublishInline, true);
+ artifact_F.setSoleAttributeValue(CoreAttributeTypes.GeneralStringData, F_STRING_TO_WRAP_IN_WORDML);
+ artifact_F.persist();
+
+ String fileName = String.format("WordTemplateProcessorTest_%s_%s.xml", artifact_F, Lib.getDateTimeString());
+ String fullPath = RenderingUtil.getRenderFolder(SAW_Bld_1, PresentationType.PREVIEW).getLocation().toOSString();
+
+ RenderingUtil.setPopupsAllowed(false);
+ RendererManager.open(myRootArtifact, PresentationType.PREVIEW, new VariableMap(ITemplateRenderer.TEMPLATE_OPTION,
+ ITemplateRenderer.PREVIEW_WITH_RECURSE_VALUE, IRenderer.FILE_NAME_OPTION, fileName));
+
+ String fileContents = Lib.fileToString(new File(fullPath, fileName));
+ Assert.assertTrue(String.format(ERROR_MESSAGE, artifact_F, "with"), fileContents.contains(F_WITH_PUBLISH_INLINE));
+ Assert.assertTrue(String.format(ERROR_MESSAGE, artifact_F, "without"),
+ !fileContents.contains(F_WITHOUT_PUBLISH_INLINE));
+ }
+
+ @BeforeClass
+ public static void setUpOnce() throws Exception {
+ monitorLog = TestUtil.severeLoggingStart();
+
+ //load contents of C's with publish in line
+ C_WITH_PUBLISH_INLINE = getResourceData("c_with_publish_inline.xml");
+ Assert.assertFalse(C_WITH_PUBLISH_INLINE.isEmpty());
+
+ //load contents of C's without publish in line
+ C_WITHOUT_PUBLISH_INLINE = getResourceData("c_without_publish_inline.xml");
+ Assert.assertFalse(C_WITHOUT_PUBLISH_INLINE.isEmpty());
+
+ A_WITH_PUBLISH_INLINE = getResourceData("a_with_publish_inline.xml");
+ Assert.assertFalse(A_WITH_PUBLISH_INLINE.isEmpty());
+
+ A_WITHOUT_PUBLISH_INLINE = getResourceData("a_without_publish_inline.xml");
+ Assert.assertFalse(A_WITHOUT_PUBLISH_INLINE.isEmpty());
+
+ F_WITH_PUBLISH_INLINE = getResourceData("f_with_publish_inline.xml");
+ Assert.assertFalse(F_WITH_PUBLISH_INLINE.isEmpty());
+
+ F_WITHOUT_PUBLISH_INLINE = getResourceData("f_without_publish_inline.xml");
+ Assert.assertFalse(F_WITHOUT_PUBLISH_INLINE.isEmpty());
+
+ //@formatter:off
+ /*
+ setup artifact tree of this form:
+ A
+ |---- C
+ | |
+ | -- D
+ B
+ |
+ |
+ E
+ |
+ |
+ F
+ */
+ //@formatter:on
+
+ myRootArtifact =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.Requirement, SAW_Bld_1, "WordTemplateProcessorTest_Root");
+ Artifact artifactA = ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, SAW_Bld_1, "A");
+ myRootArtifact.addChild(artifactA);
+
+ artifactA.addChild(ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, SAW_Bld_1, "C"));
+ artifactA.addChild(ArtifactTypeManager.addArtifact(CoreArtifactTypes.Requirement, SAW_Bld_1, "D"));
+
+ myRootArtifact.addChild(ArtifactTypeManager.addArtifact(CoreArtifactTypes.Requirement, SAW_Bld_1, "B"));
+
+ myRootArtifact.addChild(ArtifactTypeManager.addArtifact(CoreArtifactTypes.Requirement, SAW_Bld_1, "E"));
+
+ myRootArtifact.addChild(ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralData, SAW_Bld_1, "F"));
+
+ myRootArtifact.persist();
+ }
+
+ @AfterClass
+ public static void tearDownOnce() throws Exception {
+ TestUtil.severeLoggingEnd(monitorLog);
+ new PurgeArtifacts(myRootArtifact.getChildren()).execute();
+ new PurgeArtifacts(Collections.singletonList(myRootArtifact)).execute();
+ }
+
+ private static String getResourceData(String name) throws IOException {
+ InputStream inputStream = null;
+ try {
+ inputStream = WordTemplateProcessorTest.class.getResourceAsStream(name);
+ String data = Lib.inputStreamToString(inputStream);
+ Assert.assertTrue(Strings.isValid(data));
+ return data;
+ } finally {
+ Lib.close(inputStream);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTestSuite.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTestSuite.java
new file mode 100644
index 0000000..c7503b5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/WordTestSuite.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.ui.skynet.test.render.word;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({WordTemplateProcessorTest.class})
+/**
+ * @author Karol M. Wilk
+ */
+public class WordTestSuite {
+ //
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/a_with_publish_inline.xml b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/a_with_publish_inline.xml
new file mode 100644
index 0000000..06c6d04
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/a_with_publish_inline.xml
@@ -0,0 +1,34 @@
+<wx:sub-section>
+ <w:p>
+ <w:r>
+ <w:t>This is A's body paragraph...</w:t>
+ </w:r>
+ </w:p>
+ <w:p>
+ </w:p>
+ <w:p>
+ <w:pPr>
+ <w:rPr>
+ <w:vanish/>
+ </w:rPr>
+ </w:pPr>
+ <w:r>
+ <w:rPr>
+ <w:vanish/>
+ </w:rPr>
+ <w:fldChar w:fldCharType="begin"/>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:vanish/>
+ </w:rPr>
+ <w:instrText>LISTNUM"listreset"\l1\s0</w:instrText>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:vanish/>
+ </w:rPr>
+ <w:fldChar w:fldCharType="end"/><wx:t wx:val="1."/>
+ </w:r>
+ </w:p>
+</wx:sub-section>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/a_without_publish_inline.xml b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/a_without_publish_inline.xml
new file mode 100644
index 0000000..05d9156
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/a_without_publish_inline.xml
@@ -0,0 +1 @@
+<wx:sub-section><w:p><w:pPr><w:pStyle w:val="Heading2"/><w:listPr><wx:t wx:val="1.1" wx:wTabBefore="540" wx:wTabAfter="90"/><wx:font wx:val="Times New Roman"/></w:listPr></w:pPr><w:r><w:t>A</w:t></w:r></w:p><w:p><w:r><w:t> Development Assurance Level: </w:t></w:r><w:r><w:t>E</w:t></w:r></w:p><w:p><w:r><w:t> Qualification Method: </w:t></w:r><w:r><w:t>Unspecified</w:t></w:r></w:p><w:p><w:r><w:t> Subsystem: </w:t></w:r><w:r><w:t>Unspecified</w:t></w:r></w:p><w:p><w:r><w:t> Technical Performance Parameter: </w:t></w:r><w:r><w:t>no</w:t></w:r></w:p>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/c_with_publish_inline.xml b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/c_with_publish_inline.xml
new file mode 100644
index 0000000..0b68e87
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/c_with_publish_inline.xml
@@ -0,0 +1,34 @@
+<wx:sub-section>
+ <w:p>
+ <w:r>
+ <w:t>This is C's body paragraph...</w:t>
+ </w:r>
+ </w:p>
+ <w:p>
+ </w:p>
+ <w:p>
+ <w:pPr>
+ <w:rPr>
+ <w:vanish/>
+ </w:rPr>
+ </w:pPr>
+ <w:r>
+ <w:rPr>
+ <w:vanish/>
+ </w:rPr>
+ <w:fldChar w:fldCharType="begin"/>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:vanish/>
+ </w:rPr>
+ <w:instrText>LISTNUM"listreset"\l1\s0</w:instrText>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:vanish/>
+ </w:rPr>
+ <w:fldChar w:fldCharType="end"/><wx:t wx:val="1."/>
+ </w:r>
+ </w:p>
+</wx:sub-section>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/c_without_publish_inline.xml b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/c_without_publish_inline.xml
new file mode 100644
index 0000000..0e87603
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/c_without_publish_inline.xml
@@ -0,0 +1,57 @@
+<wx:sub-section>
+ <w:p>
+ <w:pPr>
+ <w:pStyle w:val="Heading3"/><w:listPr>
+ <wx:t wx:val="1.1.1" wx:wTabBefore="540" wx:wTabAfter="90"/>
+ <wx:font wx:val="Times New Roman"/></w:listPr>
+ </w:pPr>
+ <w:r>
+ <w:t>C</w:t>
+ </w:r>
+ </w:p>
+ <w:p>
+ <w:r>
+ <w:t> CSCI: </w:t>
+ </w:r>
+ <w:r>
+ <w:t>Unspecified</w:t>
+ </w:r>
+ </w:p>
+ <w:p>
+ <w:r>
+ <w:t> Development Assurance Level: </w:t>
+ </w:r>
+ <w:r>
+ <w:t>E</w:t>
+ </w:r></w:p>
+ <w:p>
+ <w:r>
+ <w:t> Partition: </w:t>
+ </w:r>
+ <w:r>
+ <w:t>Unspecified</w:t>
+ </w:r>
+ </w:p>
+ <w:p>
+ <w:r>
+ <w:t> Qualification Method: </w:t>
+ </w:r><w:r><w:t>Unspecified</w:t>
+ </w:r>
+ </w:p>
+ <w:p>
+ <w:r>
+ <w:t> Subsystem: </w:t>
+ </w:r>
+ <w:r>
+ <w:t>Unspecified</w:t>
+ </w:r>
+ </w:p>
+ <w:p>
+ <w:r>
+ <w:t> Technical Performance Parameter: </w:t>
+ </w:r>
+ <w:r>
+ <w:t>no</w:t>
+ </w:r>
+ </w:p>
+</wx:sub-section>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/f_with_publish_inline.xml b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/f_with_publish_inline.xml
new file mode 100644
index 0000000..8865f01
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/f_with_publish_inline.xml
@@ -0,0 +1 @@
+<wx:sub-section><w:p><w:r><w:t> General String Data: </w:t></w:r><w:r><w:t>F's body content</w:t></w:r></w:p><w:p><w:r><w:t> PublishInline: </w:t></w:r><w:r><w:t>yes</w:t></w:r></w:p></wx:sub-section> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/f_without_publish_inline.xml b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/f_without_publish_inline.xml
new file mode 100644
index 0000000..6b95bb7
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/render/word/f_without_publish_inline.xml
@@ -0,0 +1 @@
+<wx:sub-section><w:p><w:pPr><w:pStyle w:val="Heading2"/><w:listPr><wx:t wx:val="1.4" wx:wTabBefore="540" wx:wTabAfter="90"/><wx:font wx:val="Times New Roman"/></w:listPr></w:pPr><w:r><w:t>F</w:t></w:r></w:p><w:p><w:r><w:t> General String Data: </w:t></w:r><w:r><w:t>F's body content</w:t></w:r></w:p></wx:sub-section>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
index 2cd73b8..68f1a32 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
@@ -16,18 +16,19 @@ import java.util.Random;
import java.util.Set;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
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.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.plugin.core.util.OseeData;
import org.eclipse.osee.framework.skynet.core.UserManager;
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.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchUtility;
import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
import org.eclipse.osee.framework.skynet.core.word.WordUtil;
import org.eclipse.osee.framework.ui.skynet.preferences.MsWordPreferencePage;
@@ -86,6 +87,11 @@ public final class RenderingUtil {
}
public static String getFilenameFromArtifact(FileSystemRenderer renderer, Artifact artifact, PresentationType presentationType) throws OseeCoreException {
+ String fileName = renderer.getStringOption(IRenderer.FILE_NAME_OPTION);
+ if (Strings.isValid(fileName)) {
+ return fileName;
+ }
+
StringBuilder name = new StringBuilder(100);
if (artifact != null) {
@@ -113,10 +119,10 @@ public final class RenderingUtil {
return name.toString();
}
- public static IFolder getRenderFolder(Branch branch, PresentationType presentationType) throws OseeCoreException {
+ public static IFolder getRenderFolder(IOseeBranch branch, PresentationType presentationType) throws OseeCoreException {
try {
IFolder baseFolder = ensureRenderFolderExists(presentationType);
- IFolder renderFolder = baseFolder.getFolder(BranchManager.toFileName(branch));
+ IFolder renderFolder = baseFolder.getFolder(BranchUtility.toFileName(branch));
if (!renderFolder.exists()) {
renderFolder.create(true, true, null);
}
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 40585c3..bdb4047 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
@@ -17,10 +17,10 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
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.jdk.core.util.Strings;
import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -55,26 +55,32 @@ public class WordMLProducer extends Producer {
private int flattenedLevelCount;
private final Map<String, Integer> alphabetMap;
- public WordMLProducer(Appendable strB) {
- this.strB = strB;
- this.outlineNumber = new int[10]; // word supports 9 levels of outlining; index this array from 1 to 9
- this.outlineLevel = 0;
- this.flattenedLevelCount = 0;
+ private static final String DEFAULT_FONT = "Times New Roman";
+
+ public WordMLProducer(Appendable str) {
+ this.strB = str;
+ outlineNumber = new int[10]; // word supports 9 levels of outlining; index this array from 1 to 9
+ outlineLevel = 0;
+ flattenedLevelCount = 0;
- this.alphabetMap = new HashMap<String, Integer>();
+ alphabetMap = new HashMap<String, Integer>();
alphabetMap.put("A.0", 1);
alphabetMap.put("B.0", 2);
alphabetMap.put("C.0", 3);
}
+ public CharSequence startOutlineSubSection() throws OseeCoreException {
+ CharSequence paragraphNumber = startOutlineSubSection(DEFAULT_FONT, null, null);
+ return paragraphNumber;
+ }
+
public CharSequence startOutlineSubSection(CharSequence font, CharSequence headingText, String outlineType) throws OseeCoreException {
if (okToStartSubsection()) {
outlineNumber[++outlineLevel]++;
CharSequence paragraphNumber = getOutlineNumber();
startOutlineSubSection((outlineType != null ? outlineType : "Heading") + outlineLevel, paragraphNumber, font,
headingText);
-
return paragraphNumber;
} else {
flattenedLevelCount++;
@@ -93,16 +99,20 @@ public class WordMLProducer extends Producer {
}
public void startOutlineSubSection(CharSequence style, CharSequence outlineNumber, CharSequence font, CharSequence headingText) throws OseeCoreException {
+ //startSubSection();
append("<wx:sub-section>");
- append("<w:p><w:pPr><w:pStyle w:val=\"");
- append(style);
- append("\"/><w:listPr><wx:t wx:val=\"");
- append(outlineNumber);
- append("\" wx:wTabBefore=\"540\" wx:wTabAfter=\"90\"/><wx:font wx:val=\"");
- append(font);
- append("\"/></w:listPr></w:pPr><w:r><w:t>");
- append(Xml.escape(headingText));
- append("</w:t></w:r></w:p>");
+ if (Strings.isValid(headingText)) {
+ startParagraph();
+ append("<w:pPr>");
+ writeParagraphStyle(style);
+ append("<w:listPr><wx:t wx:val=\"");
+ append(outlineNumber);
+ append("\" wx:wTabBefore=\"540\" wx:wTabAfter=\"90\"/><wx:font wx:val=\"");
+ append(font);
+ append("\"/></w:listPr></w:pPr>");
+ writeHeadingText(headingText);
+ endParagraph();
+ }
}
public void setPageBreak() throws OseeCoreException {
@@ -115,6 +125,18 @@ public class WordMLProducer extends Producer {
append("</w:p>");
}
+ private void writeParagraphStyle(CharSequence style) throws OseeCoreException {
+ append("<w:pStyle w:val=\"");
+ append(style);
+ append("\"/>");
+ }
+
+ private void writeHeadingText(CharSequence headingText) throws OseeCoreException {
+ append("<w:r><w:t>");
+ append(Xml.escape(headingText));
+ append("</w:t></w:r>");
+ }
+
public String setHeadingNumbers(String outlineNumber, String template, String outlineType) {
boolean appendixOutlineType = outlineType != null && outlineType.equalsIgnoreCase("APPENDIX");
if (outlineNumber == null) {
@@ -186,7 +208,7 @@ public class WordMLProducer extends Producer {
}
public void createSubDoc(String fileName) throws OseeCoreException {
- if (fileName == null || fileName.length() == 0) {
+ if (Strings.isValid(fileName)) {
throw new IllegalArgumentException("The file name can not be null or empty.");
}
@@ -194,7 +216,7 @@ public class WordMLProducer extends Producer {
}
public void createHyperLinkDoc(String fileName) throws OseeCoreException {
- if (fileName == null || fileName.length() == 0) {
+ if (Strings.isValid(fileName)) {
throw new IllegalArgumentException("The file name can not be null or empty.");
}
@@ -266,9 +288,9 @@ public class WordMLProducer extends Producer {
}
public void addParagraph(CharSequence text) throws OseeCoreException {
- append("<w:p><w:r><w:t>");
- append(Xml.escape(text));
- append("</w:t></w:r></w:p>");
+ startParagraph();
+ addTextInsideParagraph(text);
+ endParagraph();
}
public void addParagraphBold(CharSequence text) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
index e67f5f5..14101f2 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.ui.skynet.render.word;
+import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.WordTemplateContent;
import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED;
import java.io.InputStream;
import java.nio.charset.CharacterCodingException;
@@ -65,6 +66,7 @@ import org.eclipse.swt.program.Program;
* @author Jeff C. Phillips
* @author Ryan D. Brooks
* @author Andrew M. Finkbeiner
+ * @link WordTemplateProcessorTest
*/
public class WordTemplateProcessor {
private static final String ARTIFACT = "Artifact";
@@ -230,7 +232,7 @@ public class WordTemplateProcessor {
private void processArtifactSet(VariableMap variableMap, final String artifactElement, final List<Artifact> artifacts, final WordMLProducer wordMl, final String outlineType, PresentationType presentationType) throws OseeCoreException {
nonTemplateArtifacts.clear();
- if (outlineNumber != null) {
+ if (Strings.isValid(outlineNumber)) {
wordMl.setNextParagraphNumberTo(outlineNumber);
}
@@ -239,6 +241,7 @@ public class WordTemplateProcessor {
for (Artifact artifact : artifacts) {
processObjectArtifact(variableMap, artifact, wordMl, outlineType, presentationType, artifacts.size() > 1);
}
+
//maintain a list of artifacts that have been processed so we do not have duplicates.
processedArtifacts.clear();
}
@@ -367,11 +370,18 @@ public class WordTemplateProcessor {
if (!processedArtifacts.contains(artifact)) {
handleLandscapeArtifactSectionBreak(artifact, wordMl, multipleArtifacts);
+ boolean publishInline = artifact.getSoleAttributeValue(CoreAttributeTypes.PublishInline, false);
if (outlining) {
String headingText = artifact.getSoleAttributeValue(headingAttributeType, "");
- CharSequence paragraphNumber =
- wordMl.startOutlineSubSection("Times New Roman", headingText, outlineType);
+
+ CharSequence paragraphNumber = null;
+
+ if (publishInline) {
+ paragraphNumber = wordMl.startOutlineSubSection();
+ } else {
+ paragraphNumber = wordMl.startOutlineSubSection("Times New Roman", headingText, outlineType);
+ }
VariableMap options = renderer.getOptions();
if (renderer.getBooleanOption(WordTemplateRenderer.UPDATE_PARAGRAPH_NUMBER_OPTION)) {
@@ -381,7 +391,9 @@ public class WordTemplateProcessor {
}
}
}
- processAttributes(variableMap, artifact, wordMl, presentationType, multipleArtifacts);
+
+ processAttributes(variableMap, artifact, wordMl, presentationType, multipleArtifacts, publishInline);
+
if (recurseChildren) {
for (Artifact childArtifact : artifact.getChildren()) {
processObjectArtifact(variableMap, childArtifact, wordMl, outlineType, presentationType,
@@ -413,7 +425,7 @@ public class WordTemplateProcessor {
}
}
- private void processAttributes(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
+ private void processAttributes(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts, boolean publishInLine) throws OseeCoreException {
for (AttributeElement attributeElement : attributeElements) {
String attributeName = attributeElement.getAttributeName();
@@ -421,14 +433,14 @@ public class WordTemplateProcessor {
for (IAttributeType attributeType : RendererManager.getAttributeTypeOrderList(artifact)) {
if (!outlining || !attributeType.equals(headingAttributeType)) {
processAttribute(variableMap, artifact, wordMl, attributeElement, attributeType, true,
- presentationType, multipleArtifacts);
+ presentationType, multipleArtifacts, publishInLine);
}
}
} else {
AttributeType attributeType = AttributeTypeManager.getType(attributeName);
if (artifact.isAttributeTypeValid(attributeType)) {
processAttribute(variableMap, artifact, wordMl, attributeElement, attributeType, false,
- presentationType, multipleArtifacts);
+ presentationType, multipleArtifacts, publishInLine);
}
}
@@ -436,7 +448,7 @@ public class WordTemplateProcessor {
wordMl.setPageLayout(artifact);
}
- private void processAttribute(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, AttributeElement attributeElement, IAttributeType attributeType, boolean allAttrs, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
+ private void processAttribute(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, AttributeElement attributeElement, IAttributeType attributeType, boolean allAttrs, PresentationType presentationType, boolean multipleArtifacts, boolean publishInLine) throws OseeCoreException {
// This is for SRS Publishing. Do not publish unspecified attributes
if (!allAttrs && (attributeType.equals(CoreAttributeTypes.Partition) || attributeType.equals(CoreAttributeTypes.SafetyCriticality))) {
if (artifact.isAttributeTypeValid(CoreAttributeTypes.Partition)) {
@@ -449,7 +461,7 @@ public class WordTemplateProcessor {
}
//Create a wordTemplateContent for new guys when opening them for edit.
- if (attributeType.equals(CoreAttributeTypes.WordTemplateContent) && presentationType == PresentationType.SPECIALIZED_EDIT) {
+ if (attributeType.equals(WordTemplateContent) && presentationType == PresentationType.SPECIALIZED_EDIT) {
artifact.getOrInitializeSoleAttributeValue(attributeType);
}
@@ -471,8 +483,10 @@ public class WordTemplateProcessor {
}
}
- RendererManager.renderAttribute(attributeType, presentationType, artifact, variableMap, wordMl,
- attributeElement);
+ if (!(publishInLine && artifact.isAttributeTypeValid(WordTemplateContent)) || attributeType.equals(WordTemplateContent)) {
+ RendererManager.renderAttribute(attributeType, presentationType, artifact, variableMap, wordMl,
+ attributeElement);
+ }
}
}
@@ -538,4 +552,4 @@ public class WordTemplateProcessor {
});
}
}
-} \ No newline at end of file
+}