Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBranden Phillips2020-06-18 16:57:00 -0400
committerBranden Phillips2020-06-18 18:21:00 -0400
commit68468db900ea68678aa1953773dccd6e2f5b5062 (patch)
tree9f8464573d7e48022fe1e95fc5808282aa9ff09a
parent555f27a2e1051186687161151c8f8a2d77bd2d07 (diff)
downloadorg.eclipse.osee-68468db900ea68678aa1953773dccd6e2f5b5062.tar.gz
org.eclipse.osee-68468db900ea68678aa1953773dccd6e2f5b5062.tar.xz
org.eclipse.osee-68468db900ea68678aa1953773dccd6e2f5b5062.zip
refactor[TW17412]: Remove duplicated method and seperate RenderWTC
Change-Id: Idd61b1385c856eae24447b0571394b52bf704fce Signed-off-by: Branden Phillips <branden.w.phillips@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java61
1 files changed, 5 insertions, 56 deletions
diff --git a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java
index d31aa20b485..eaf57437c35 100644
--- a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java
+++ b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java
@@ -116,8 +116,6 @@ public class MSWordTemplatePublisher {
protected final Set<ArtifactId> emptyFolders = new HashSet<>();
protected final Map<ArtifactReadable, CharSequence> artParagraphNumbers = new HashMap<>();
protected final List<ArtifactTypeToken> excludeArtifactTypes = new LinkedList<>();
- protected final Map<ArtifactId, String> artifactData = new HashMap<>();
- protected final List<String> hyperlinkedGuids = new LinkedList<>();
//Error Variables
protected final List<PublishingArtifactError> errorLog = new LinkedList<>();
@@ -722,48 +720,11 @@ public class MSWordTemplatePublisher {
* Uses WordTemplateContentRendererHandler to render the word ml. Also handles OSEE_Link errors if there are
* artifacts that are linking to artifacts that aren't included in the publish.
*/
- protected void renderWordTemplateContent(AttributeTypeToken attributeType, ArtifactReadable artifact, PresentationType presentationType, WordMLWriter producer, String format, String label) {
- WordMLWriter wordMl = producer;
- String data = null;
-
- LinkType linkType = publishingOptions.linkType;
+ protected void renderWordTemplateContent(AttributeTypeToken attributeType, ArtifactReadable artifact, PresentationType presentationType, WordMLWriter wordMl, String format, String label) {
String footer = getArtifactFooter(artifact);
- if (label.length() > 0) {
- wordMl.addParagraph(label);
- }
-
- TransactionToken txId = null;
- if (artifact.isHistorical()) {
- txId = orcsApi.getTransactionFactory().getTx(artifact.getTransaction());
- } else {
- txId = TransactionToken.SENTINEL;
- }
-
- WordTemplateContentData wtcData = new WordTemplateContentData();
- wtcData.setArtId(artifact.getUuid());
- wtcData.setBranch(artifact.getBranch());
- wtcData.setFooter(footer);
- wtcData.setIsEdit(presentationType == PresentationType.SPECIALIZED_EDIT);
- wtcData.setLinkType(linkType != null ? linkType.toString() : null);
- wtcData.setTxId(txId);
- wtcData.setPresentationType(presentationType);
- wtcData.setViewId(publishingOptions.view);
- wtcData.setPermanentLinkUrl(new ArtifactUrlServer(orcsApi).getSelectedPermanentLinkUrl());
-
- Pair<String, Set<String>> content = null;
- try {
- WordTemplateContentRendererHandler rendererHandler = new WordTemplateContentRendererHandler(orcsApi, logger);
- content = rendererHandler.renderWordML(wtcData);
- } catch (Exception ex) {
- errorLog.add(new PublishingArtifactError(artifact.getId(), artifact.getName(), artifact.getArtifactType(),
- ex.toString()));
- }
-
- if (content != null) {
- data = content.getFirst();
- processLinkErrors(artifact, data, content.getSecond());
- }
+ String data =
+ getWordTemplateContentData(attributeType, artifact, presentationType, wordMl, format, label, footer);
if (data != null) {
wordMl.addWordMl(data);
@@ -773,19 +734,11 @@ public class MSWordTemplatePublisher {
wordMl.resetListValue();
}
- /**
- * This is a TEMPORARY test method for publishing. The idea is that this method will be called before any writing is
- * done for publish, populating the Word Content (artifactData) map, so the word ml can be parsed and create a
- * seperate data structure of which artifacts will be bookmarked. The artifactData map will then be used later to
- * write the word ml, removing any un-needed bookmarks. Duplicated code for now for testing this idea, will be
- * written fully implemented after successful test.
- */
- protected void populateArtifactData(AttributeTypeToken attributeType, ArtifactReadable artifact, PresentationType presentationType, WordMLWriter producer, String format, String label) {
+ protected String getWordTemplateContentData(AttributeTypeToken attributeType, ArtifactReadable artifact, PresentationType presentationType, WordMLWriter producer, String format, String label, String footer) {
WordMLWriter wordMl = producer;
String data = null;
LinkType linkType = publishingOptions.linkType;
- String footer = getArtifactFooter(artifact);
if (label.length() > 0) {
wordMl.addParagraph(label);
@@ -823,7 +776,7 @@ public class MSWordTemplatePublisher {
processLinkErrors(artifact, data, content.getSecond());
}
- artifactData.put(artifact, data);
+ return data;
}
/**
@@ -907,10 +860,6 @@ public class MSWordTemplatePublisher {
if (!bookmarkedIds.contains(id) && !hyperlinkedIds.containsKey(id)) {
hyperlinkedIds.put(id, artifact);
}
- //TEMPORARY Test, this structure stores ALL hyperlinked guids, not just ones that aren't linked
- if (!hyperlinkedGuids.contains(id)) {
- hyperlinkedGuids.add(id);
- }
}
}
}

Back to the top