Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid W. Miller2018-05-22 15:13:26 -0400
committerDavid W. Miller2018-06-07 13:26:20 -0400
commit6abefe5e8757e7c7cb284ae33550d727c1f5d429 (patch)
tree640c6ea889095101941dcd5301b5cadb84dc1cbf
parente99584fedb1b4cd358686213e11aaec73f609988 (diff)
downloadorg.eclipse.osee-6abefe5e8757e7c7cb284ae33550d727c1f5d429.tar.gz
org.eclipse.osee-6abefe5e8757e7c7cb284ae33550d727c1f5d429.tar.xz
org.eclipse.osee-6abefe5e8757e7c7cb284ae33550d727c1f5d429.zip
feature[ats_TW8283]: Update SRS Publish slave template
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java13
-rw-r--r--plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishWithSpecifiedTemplate.java7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java43
3 files changed, 30 insertions, 33 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java
index dff5e057d2d..bedac4f507c 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordTemplateRendererTest.java
@@ -438,13 +438,14 @@ public class WordTemplateRendererTest {
String contents;
try {
contents = getFileAsString(resultPath);
+ System.out.println(contents);
Assert.assertTrue("Paragraph Number & Name Link not found",
contents.contains("<w:r><w:rPr><w:rStyle w:val=\"Hyperlink\"/></w:rPr><w:t>2.1 Hardware</w:t></w:r>"));
basicDocumentCheck(contents, tabString, false, false);
- Assert.assertTrue("Paragraph Number 2 is not updated", contents.contains(
- "<w:r><w:t>Notes</w:t></w:r></w:p><w:p><w:r><w:t>Applicability: Base</w:t></w:r></w:p><w:p><w:r><w:t> Paragraph Number: </w:t></w:r><w:r><w:t>2</w:t></w:r>"));
- Assert.assertTrue("Paragraph Number 2.1 is not updated", contents.contains(
- "<w:r><w:t>More Notes</w:t></w:r></w:p><w:p><w:r><w:t>Applicability: Base</w:t></w:r></w:p><w:p><w:r><w:t> Paragraph Number: </w:t></w:r><w:r><w:t>2.1</w:t></w:r>"));
+ Assert.assertTrue("Paragraph Number 2 is not updated",
+ contents.contains("<w:p><w:r><w:t> Paragraph Number: </w:t></w:r><w:r><w:t>2</w:t></w:r>"));
+ Assert.assertTrue("Paragraph Number 2.1 is not updated",
+ contents.contains("<w:p><w:r><w:t> Paragraph Number: </w:t></w:r><w:r><w:t>2.1</w:t></w:r>"));
Matcher m = findBlankPage.matcher(contents);
int counter = 0;
while (m.find()) {
@@ -622,8 +623,8 @@ public class WordTemplateRendererTest {
try {
String contents = getFileAsString(resultPath);
basicDocumentCheck(contents, "", false, true);
- Assert.assertTrue("Appears to have Field Code Diff", contents.contains(
- "<w:r><w:rPr><w:rStyle w:val=\"Hyperlink\"/></w:rPr><w:t>Hardware Functions</w:t></w:r></w:hlink>"));
+ Assert.assertTrue("Appears to have Field Code Diff",
+ contents.contains("<w:r><w:rPr><w:rStyle w:val=\"Hyperlink\"/></w:rPr><w:t>Hardware"));
} catch (IOException ex) {
// Do nothing - test failed
} finally {
diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishWithSpecifiedTemplate.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishWithSpecifiedTemplate.java
index a9ff7572a46..6391ef30834 100644
--- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishWithSpecifiedTemplate.java
+++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishWithSpecifiedTemplate.java
@@ -86,7 +86,6 @@ public class PublishWithSpecifiedTemplate extends AbstractBlam {
private final String IS_ARTIFACTS = "IS Artifacts";
private final String PUBLISH_AS_DIFF = "Publish As Diff";
private final String WAS_BRANCH = "WAS Branch";
- private final String INCLUDE_ARTIFACT_UUIDS = "Include Artifact UUIDs";
private final String ORCS_QUERY = "Orcs Query";
private final String VIEW = "Branch View (For IS Artifacts)";
@@ -101,7 +100,6 @@ public class PublishWithSpecifiedTemplate extends AbstractBlam {
boolean useArtifactNameInLinks = variableMap.getBoolean(USE_ARTIFACT_NAMES);
boolean useParagraphNumbersInLinks = variableMap.getBoolean(USE_PARAGRAPH_NUMBERS);
- variableMap.getBoolean(INCLUDE_ARTIFACT_UUIDS);
if (!useParagraphNumbersInLinks && !useArtifactNameInLinks) {
throw new OseeArgumentException("Please select at least one Document Link Format");
@@ -163,8 +161,6 @@ public class PublishWithSpecifiedTemplate extends AbstractBlam {
variableMap.getBranch(WAS_BRANCH),
"Publish As Diff",
variableMap.getValue(PUBLISH_AS_DIFF),
- "INCLUDE UUIDS",
- variableMap.getValue(INCLUDE_ARTIFACT_UUIDS),
"linkType",
linkType,
WordTemplateRenderer.UPDATE_PARAGRAPH_NUMBER_OPTION,
@@ -289,9 +285,6 @@ public class PublishWithSpecifiedTemplate extends AbstractBlam {
builder.append(String.format(
"<xWidgets><XWidget xwidgetType=\"XCheckBox\" horizontalLabel=\"true\" labelAfter=\"true\" displayName=\"%s\" />",
UPDATE_PARAGRAPH_NUMBERS));
- builder.append(String.format(
- "<XWidget xwidgetType=\"XCheckBox\" horizontalLabel=\"true\" labelAfter=\"true\" displayName=\"%s\" />",
- INCLUDE_ARTIFACT_UUIDS));
builder.append("<XWidget xwidgetType=\"XLabel\" displayName=\"Document Link Format:\"/>");
builder.append(String.format(
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 1c2f9df2e42..442990bc9b8 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
@@ -238,7 +238,7 @@ public class WordTemplateProcessor {
masterTemplateArtifact.getRelatedArtifacts(CoreRelationTypes.SupportingInfo_SupportingInfo);
String masterTemplateStyles = "";
- if (masterTemplateRelatedArtifacts != null) {
+ if (masterTemplateRelatedArtifacts != null && !masterTemplateRelatedArtifacts.isEmpty()) {
if (masterTemplateRelatedArtifacts.size() == 1) {
masterTemplateStyles += masterTemplateRelatedArtifacts.get(0).getSoleAttributeValueAsString(
CoreAttributeTypes.WholeWordContent, "");
@@ -477,23 +477,25 @@ public class WordTemplateProcessor {
private void parseMetadataOptions(String metadataOptions) {
try {
JSONObject jsonObject = new JSONObject(metadataOptions);
+ JSONObject options = null;
if (!jsonObject.has("MetadataOptions")) {
return;
}
JSONArray optionsArray = jsonObject.getJSONArray("MetadataOptions");
- JSONObject options = optionsArray.getJSONObject(0);
-
- metadataType = options.getString("Type");
- metadataFormat = options.getString("Format");
- metadataLabel = options.getString("Label");
+ for (int i = 0; i < optionsArray.length(); i++) {
+ options = optionsArray.getJSONObject(i);
- MetadataElement metadataElement = new MetadataElement();
+ metadataType = options.getString("Type");
+ metadataFormat = options.getString("Format");
+ metadataLabel = options.getString("Label");
- metadataElement.setElements(metadataType, metadataFormat, metadataLabel);
- metadataElements.add(metadataElement);
+ MetadataElement metadataElement = new MetadataElement();
+ metadataElement.setElements(metadataType, metadataFormat, metadataLabel);
+ metadataElements.add(metadataElement);
+ }
} catch (JSONException ex) {
OseeCoreException.wrapAndThrow(ex);
}
@@ -597,17 +599,11 @@ public class WordTemplateProcessor {
boolean publishInline = artifact.getSoleAttributeValue(CoreAttributeTypes.PublishInline, false);
boolean startedSection = false;
boolean templateOnly = renderer.getBooleanOption("TEMPLATE ONLY");
- boolean includeUUIDs = renderer.getBooleanOption("INCLUDE UUIDS");
if (!ignoreArtifact && !ignoreArtType) {
if (outlining && !templateOnly) {
String headingText = artifact.getSoleAttributeValue(headingAttributeType, "");
- if (includeUUIDs) {
- String UUIDtext = String.format(" <UUID = %s>", artifact.getArtId());
- headingText = headingText.concat(UUIDtext);
- }
-
Boolean mergeTag = (Boolean) renderer.getOption(ITemplateRenderer.ADD_MERGE_TAG);
if (mergeTag != null && mergeTag) {
headingText = headingText.concat(" [MERGED]");
@@ -701,7 +697,7 @@ public class WordTemplateProcessor {
private void processMetadata(Artifact artifact, WordMLProducer wordMl) {
for (MetadataElement metadataElement : metadataElements) {
- processMetadata(artifact, wordMl, metadataElement.getType(), metadataElement.getFormat());
+ processMetadata(artifact, wordMl, metadataElement);
}
}
@@ -726,9 +722,11 @@ public class WordTemplateProcessor {
}
}
- private void processMetadata(Artifact artifact, WordMLProducer wordMl, String name, String format) {
+ private void processMetadata(Artifact artifact, WordMLProducer wordMl, MetadataElement element) {
wordMl.startParagraph();
-
+ String name = element.getType();
+ String format = element.getFormat();
+ String label = element.getLabel();
String value = "";
if (name.equals(APPLICABILITY)) {
ApplicabilityToken applicabilityToken = applicabilityTokens.get(artifact.getApplicablityId());
@@ -738,8 +736,13 @@ public class WordTemplateProcessor {
} else if (name.equals(ARTIFACT_ID)) {
value = artifact.getIdString();
}
- if (format.contains(">x<")) {
- wordMl.addWordMl(format.replace(">x<", ">" + Xml.escape(name + ": " + value).toString() + "<"));
+ if (!format.isEmpty() || !label.isEmpty()) {
+ if (label.contains(">x<")) {
+ wordMl.addWordMl(label.replace(">x<", ">" + Xml.escape(name + ": ").toString() + "<"));
+ }
+ if (format.contains(">x<")) {
+ wordMl.addWordMl(format.replace(">x<", ">" + Xml.escape(value).toString() + "<"));
+ }
} else {
wordMl.addTextInsideParagraph(name + ": " + value);
}

Back to the top