Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2017-08-29 13:50:44 -0400
committerMorgan E. Cook2017-09-05 13:03:59 -0400
commit90416c4e7c9c9414c2f10d4ea8a2069e1b5d83f4 (patch)
tree0b4283a350b0e887ca05432cdc061e6c85ea91d3
parentce26ce9fee2df6c29722c9ab623a88716537a009 (diff)
downloadorg.eclipse.osee-90416c4e7c9c9414c2f10d4ea8a2069e1b5d83f4.tar.gz
org.eclipse.osee-90416c4e7c9c9414c2f10d4ea8a2069e1b5d83f4.tar.xz
org.eclipse.osee-90416c4e7c9c9414c2f10d4ea8a2069e1b5d83f4.zip
refactor: Move OseeLinkBuilder to define.report.api
Signed-off-by: Morgan E. Cook <morgan.e.cook@boeing.com> Change-Id: I07f9b8de30a22cef209412e6e44f810842a98df7
-rw-r--r--plugins/org.eclipse.osee.define.report.api/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/OseeLinkBuilder.java (renamed from plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/OseeLinkBuilder.java)46
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordImageArtifactElementExtractor.java1
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordMlLinkHandler.java1
4 files changed, 45 insertions, 5 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 d270923d8b..09d31ad6fe 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
@@ -11,8 +11,10 @@ Import-Package: javax.ws.rs,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.model.datarights,
+ org.eclipse.osee.framework.core.model.type,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.framework.jdk.core.util.xml,
org.eclipse.osee.framework.logging,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
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.api/src/org/eclipse/osee/define/report/api/OseeLinkBuilder.java
index 531ced048f..b584b378b1 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.api/src/org/eclipse/osee/define/report/api/OseeLinkBuilder.java
@@ -8,14 +8,20 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.define.report.internal.wordupdate;
+package org.eclipse.osee.define.report.api;
+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.core.model.type.LinkType;
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;
@@ -135,9 +141,13 @@ 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, String permanentUrl) {
+ return getWordMlLink(destLinkType, artifact, txId, sessionId, PresentationType.DEFAULT_OPEN, permanentUrl);
+ }
+
+ 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);
}
@@ -152,16 +162,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 = 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/WordImageArtifactElementExtractor.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordImageArtifactElementExtractor.java
index 03409946eb..19b5befc7c 100644
--- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordImageArtifactElementExtractor.java
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordImageArtifactElementExtractor.java
@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.eclipse.osee.define.report.api.OseeLinkBuilder;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
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 e9d6aa1d2c..f67e347187 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
@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.osee.define.report.api.OseeLinkBuilder;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.BranchType;

Back to the top