Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2017-08-07 17:35:51 -0400
committerMorgan E. Cook2017-08-07 18:05:02 -0400
commitdc8cb34328ae6b8dd7cb7ae8f506b4c022bf0953 (patch)
tree24c600dfb4b81887c6acb2458e3882737c8d188b
parent24acb1951e9a19c419f489008d9ee8d92c62e401 (diff)
downloadorg.eclipse.osee-dc8cb34328ae6b8dd7cb7ae8f506b4c022bf0953.tar.gz
org.eclipse.osee-dc8cb34328ae6b8dd7cb7ae8f506b4c022bf0953.tar.xz
org.eclipse.osee-dc8cb34328ae6b8dd7cb7ae8f506b4c022bf0953.zip
bug: Fix wordML link handler0.25.0.v201708081347-NR
Signed-off-by: Morgan E. Cook <morgan.e.cook@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.define.report.api/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordTemplateContentData.java19
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/OseeLinkBuilder.java41
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordMlLinkHandler.java14
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordTemplateContentRendererHandler.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactURL.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java5
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java2
9 files changed, 75 insertions, 17 deletions
diff --git a/plugins/org.eclipse.osee.define.report.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.define.report.api/META-INF/MANIFEST.MF
index a59c7190e5..ae56329c4b 100644
--- a/plugins/org.eclipse.osee.define.report.api/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.define.report.api/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@ Export-Package: org.eclipse.osee.define.report.api
Import-Package: javax.ws.rs,
javax.ws.rs.core,
org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
org.json
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordTemplateContentData.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordTemplateContentData.java
index 9621e9ab6d..85b292e8ae 100644
--- a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordTemplateContentData.java
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/WordTemplateContentData.java
@@ -14,6 +14,7 @@ package org.eclipse.osee.define.report.api;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
+import org.eclipse.osee.framework.core.enums.PresentationType;
/**
* @author Morgan E. Cook
@@ -29,6 +30,8 @@ public class WordTemplateContentData {
private String sessionId;
private String oseeLink;
private ArtifactId viewId;
+ private PresentationType presentationType;
+ private String permanentLinkUrl;
public Long getArtId() {
return artId;
@@ -101,4 +104,20 @@ public class WordTemplateContentData {
public void setViewId(ArtifactId viewId) {
this.viewId = viewId;
}
+
+ public PresentationType getPresentationType() {
+ return presentationType;
+ }
+
+ public void setPresentationType(PresentationType presentationType) {
+ this.presentationType = presentationType;
+ }
+
+ public String getPermanentLinkUrl() {
+ return permanentLinkUrl;
+ }
+
+ public void setPermanentLinkUrl(String permanentLinkUrl) {
+ this.permanentLinkUrl = permanentLinkUrl;
+ }
}
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/OseeLinkBuilder.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/OseeLinkBuilder.java
index ae7448383c..aee24c9b40 100644
--- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/OseeLinkBuilder.java
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/OseeLinkBuilder.java
@@ -10,11 +10,17 @@
*******************************************************************************/
package org.eclipse.osee.define.report.internal.wordupdate;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.OseeServerContext;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
+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.HttpUrlBuilder;
import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -134,9 +140,9 @@ public class OseeLinkBuilder {
return String.format(OSEE_LINK_MARKER, guid);
}
- public String getWordMlLink(LinkType destLinkType, ArtifactReadable artifact, TransactionId txId, String sessionId, String oseeLink) throws OseeCoreException {
+ public String getWordMlLink(LinkType destLinkType, ArtifactReadable artifact, TransactionId txId, String sessionId, PresentationType presentationType, String permanentUrl) throws OseeCoreException {
String linkFormat = getLinkFormat(destLinkType);
- String linkId = getLinkId(destLinkType, artifact, txId, sessionId, oseeLink);
+ String linkId = getLinkId(destLinkType, artifact, txId, sessionId, presentationType, permanentUrl);
String linkText = getLinkText(destLinkType, artifact);
return String.format(linkFormat, linkId, linkText);
}
@@ -151,17 +157,42 @@ public class OseeLinkBuilder {
return toReturn;
}
- private String getLinkId(LinkType destLinkType, ArtifactReadable artifact, TransactionId tx, String sessionId, String oseeLink) throws OseeCoreException {
+ private String getLinkId(LinkType destLinkType, ArtifactReadable artifact, TransactionId tx, String sessionId, PresentationType presentationType, String permanentUrl) throws OseeCoreException {
String toReturn;
if (destLinkType == LinkType.OSEE_SERVER_LINK) {
- toReturn = escapeXml(oseeLink);
- toReturn = toReturn.replaceAll("INSERTGUID", artifact.getGuid());
+ toReturn = escapeXml(getOseeLink(artifact, presentationType, sessionId, permanentUrl));
} else {
toReturn = artifact.getGuid();
}
return toReturn;
}
+ private String getOseeLink(ArtifactReadable artifact, PresentationType presentationType, String sessionId, String permanentUrl) {
+ Map<String, String> parameters = new HashMap<>();
+ parameters.put("sessionId", sessionId);
+ parameters.put("context", "osee/loopback");
+ parameters.put("guid", artifact.getGuid());
+ parameters.put("branchUuid", String.valueOf(artifact.getBranch().getGuid()));
+ parameters.put("isDeleted", String.valueOf(artifact.isDeleted()));
+
+ if (artifact.isHistorical() && presentationType != PresentationType.DIFF && presentationType != PresentationType.F5_DIFF) {
+ parameters.put("transactionId", String.valueOf(artifact.getTransaction()));
+ }
+
+ parameters.put("cmd", "open.artifact");
+ URL url = null;
+
+ try {
+ String urlString =
+ HttpUrlBuilder.createURL(permanentUrl, OseeServerContext.CLIENT_LOOPBACK_CONTEXT, parameters);
+ url = new URL(urlString);
+ } catch (Exception ex) {
+ throw OseeCoreException.wrap(ex);
+ }
+
+ return url.toString();
+ }
+
private String getLinkText(LinkType linkType, ArtifactReadable artifact) throws OseeCoreException {
StringBuilder builder = new StringBuilder();
if (isParagraphRequired(linkType)) {
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordMlLinkHandler.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordMlLinkHandler.java
index 1c5a3e777f..ab085f5e84 100644
--- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordMlLinkHandler.java
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordMlLinkHandler.java
@@ -21,6 +21,7 @@ import java.util.regex.Pattern;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.PresentationType;
import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -107,7 +108,7 @@ public class WordMlLinkHandler {
HashCollection<String, MatchRange> matchMap = parseOseeWordMLLinks(content);
if (!matchMap.isEmpty()) {
modified = modifiedContent(queryFactory, linkType, source, content, matchMap, true, TransactionId.SENTINEL,
- null, null, null);
+ null, null, null, null);
}
return modified;
}
@@ -118,7 +119,7 @@ public class WordMlLinkHandler {
* @param content input
* @return processed input
*/
- public static String link(QueryFactory queryFactory, LinkType destLinkType, ArtifactReadable source, String content, TransactionId txId, String sessionId, String oseeLink, Set<String> unknownGuids) throws OseeCoreException {
+ public static String link(QueryFactory queryFactory, LinkType destLinkType, ArtifactReadable source, String content, TransactionId txId, String sessionId, Set<String> unknownGuids, PresentationType presentationType, String permanentUrl) throws OseeCoreException {
LinkType linkType = checkLinkType(destLinkType);
String modified = content;
@@ -136,8 +137,8 @@ public class WordMlLinkHandler {
OSEE_LINK_PATTERN.reset();
if (!matchMap.isEmpty()) {
- modified = modifiedContent(queryFactory, linkType, source, content, matchMap, false, txId, sessionId, oseeLink,
- unknownGuids);
+ modified = modifiedContent(queryFactory, linkType, source, content, matchMap, false, txId, sessionId,
+ unknownGuids, presentationType, permanentUrl);
}
if (linkType != LinkType.OSEE_SERVER_LINK) {
@@ -208,7 +209,7 @@ public class WordMlLinkHandler {
return Collections.setComplement(guidsFromLinks, artGuids);
}
- private static String modifiedContent(QueryFactory queryFactory, LinkType destLinkType, ArtifactReadable source, String original, HashCollection<String, MatchRange> matchMap, boolean isUnliking, TransactionId txId, String sessionId, String oseeLink, Set<String> unknown) throws OseeCoreException {
+ private static String modifiedContent(QueryFactory queryFactory, LinkType destLinkType, ArtifactReadable source, String original, HashCollection<String, MatchRange> matchMap, boolean isUnliking, TransactionId txId, String sessionId, Set<String> unknown, PresentationType presentationType, String permanentUrl) throws OseeCoreException {
BranchId branch = source.getBranch();
ChangeSet changeSet = new ChangeSet(original);
List<ArtifactReadable> artifactsFromSearch = null;
@@ -257,7 +258,8 @@ public class WordMlLinkHandler {
if (isUnliking) {
replaceWith = linkBuilder.getOseeLinkMarker(artifact.getGuid());
} else {
- replaceWith = linkBuilder.getWordMlLink(destLinkType, artifact, txId, sessionId, oseeLink);
+ replaceWith =
+ linkBuilder.getWordMlLink(destLinkType, artifact, txId, sessionId, presentationType, permanentUrl);
}
changeSet.replace(match.start(), match.end(), replaceWith);
}
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordTemplateContentRendererHandler.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordTemplateContentRendererHandler.java
index 2c91d17391..5c0c192e8b 100644
--- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordTemplateContentRendererHandler.java
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordTemplateContentRendererHandler.java
@@ -77,9 +77,8 @@ public class WordTemplateContentRendererHandler {
data = WordUtilities.reassignBinDataID(data);
LinkType link = wtcData.getLinkType() != null ? LinkType.valueOf(wtcData.getLinkType()) : null;
-
data = WordMlLinkHandler.link(orcsApi.getQueryFactory(), link, artifact, data, wtcData.getTxId(),
- wtcData.getSessionId(), wtcData.getOseeLink(), unknownGuids);
+ wtcData.getSessionId(), unknownGuids, wtcData.getPresentationType(), wtcData.getPermanentLinkUrl());
data = WordUtilities.reassignBookMarkID(data);
// remove any existing footers and replace with the current one
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactURL.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactURL.java
index d23c8adf67..37d9a11c29 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactURL.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactURL.java
@@ -35,7 +35,7 @@ public class ArtifactURL {
Map<String, String> parameters = new HashMap<>();
parameters.put("sessionId", ClientSessionManager.getSessionId());
parameters.put("context", "osee/loopback");
- parameters.put("guid", "INSERTGUID");
+ parameters.put("guid", artifact.getGuid());
parameters.put("branchUuid", String.valueOf(artifact.getBranch().getGuid()));
parameters.put("isDeleted", String.valueOf(artifact.isDeleted()));
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
index 081f4e0a0b..98845d8406 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
@@ -173,8 +173,6 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
txId = TransactionId.SENTINEL;
}
- String oseeLink = ArtifactURL.getOpenInOseeLink(artifact, presentationType).toString();
-
WordTemplateContentData wtcData = new WordTemplateContentData();
wtcData.setArtId(artifact.getUuid());
wtcData.setBranch(artifact.getBranch());
@@ -183,9 +181,10 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
wtcData.setLinkType(linkType != null ? linkType.toString() : null);
wtcData.setTxId(txId);
wtcData.setSessionId(ClientSessionManager.getSessionId());
- wtcData.setOseeLink(oseeLink);
+ wtcData.setPresentationType(presentationType);
ArtifactId view = (ArtifactId) getOption(IRenderer.VIEW_ID);
wtcData.setViewId(view == null ? ArtifactId.SENTINEL : view);
+ wtcData.setPermanentLinkUrl(ArtifactURL.getSelectedPermanenrLinkUrl());
Pair<String, Set<String>> content = null;
try {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
index ddb862273b..04284f9fe6 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
@@ -347,4 +347,9 @@ public class ArtifactReadOnlyImpl extends AbstractProxied<Artifact> implements A
return childIds;
}
+ @Override
+ public boolean isHistorical() {
+ return getProxiedObject().getOrcsData().getVersion().isHistorical();
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java
index e4c6e991b2..445938857b 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java
@@ -106,4 +106,6 @@ public interface ArtifactReadable extends ArtifactToken, HasTransaction, OrcsRea
Collection<Long> getRelatedIds(RelationTypeSide relationTypeSide);
+ boolean isHistorical();
+
}

Back to the top