Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2014-09-10 23:25:56 +0000
committerRoberto E. Escobar2014-10-01 21:04:29 +0000
commit9b48b24a397568ab7a7ba063e78556f00cb0a12e (patch)
tree7a27ae851409949c2e3bc35e080c0905e5b0066d
parenta835c2a78fb433c3dbb26912431a78a8b93ec215 (diff)
downloadorg.eclipse.osee-9b48b24a397568ab7a7ba063e78556f00cb0a12e.tar.gz
org.eclipse.osee-9b48b24a397568ab7a7ba063e78556f00cb0a12e.tar.xz
org.eclipse.osee-9b48b24a397568ab7a7ba063e78556f00cb0a12e.zip
feature[ats_ATS97427]: Move Data Rights logic to Server
-rw-r--r--features/org.eclipse.osee.framework.feature/feature.xml12
-rw-r--r--features/org.eclipse.osee.x.server.feature/feature.xml7
-rw-r--r--plugins/org.eclipse.osee.define.report.api/.classpath7
-rw-r--r--plugins/org.eclipse.osee.define.report.api/.project28
-rw-r--r--plugins/org.eclipse.osee.define.report.api/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.osee.define.report.api/build.properties4
-rw-r--r--plugins/org.eclipse.osee.define.report.api/pom.xml17
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRight.java40
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightAnchor.java58
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightEntry.java48
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightId.java67
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightInput.java57
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightResult.java111
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DefineApi.java20
-rw-r--r--plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/PageOrientation.java36
-rw-r--r--plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.define.report/OSGI-INF/define.api.impl.xml9
-rw-r--r--plugins/org.eclipse.osee.define.report/OSGI-INF/osee.define.report.xml1
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DataRightBuilder.java135
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DataRightsResource.java48
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DefineApiImpl.java48
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/OseeReportApplication.java11
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/ArtifactDataRightsProvider.java87
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/DataRightProviderImpl.java64
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java11
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java124
-rw-r--r--plugins/org.eclipse.osee.x.server.parent/pom.xml1
29 files changed, 903 insertions, 169 deletions
diff --git a/features/org.eclipse.osee.framework.feature/feature.xml b/features/org.eclipse.osee.framework.feature/feature.xml
index 396a93a22dd..9efa3211936 100644
--- a/features/org.eclipse.osee.framework.feature/feature.xml
+++ b/features/org.eclipse.osee.framework.feature/feature.xml
@@ -136,14 +136,14 @@
install-size="0"
version="0.0.0"
unpack="false"/>
-
+
<plugin
id="org.eclipse.osee.jaxrs.client"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
-
+
<plugin
id="org.eclipse.osee.account.rest.client"
download-size="0"
@@ -185,4 +185,12 @@
install-size="0"
version="0.0.0"
unpack="false"/>
+
+ <plugin
+ id="org.eclipse.osee.define.report.api"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/features/org.eclipse.osee.x.server.feature/feature.xml b/features/org.eclipse.osee.x.server.feature/feature.xml
index 21337b31231..95c1a247002 100644
--- a/features/org.eclipse.osee.x.server.feature/feature.xml
+++ b/features/org.eclipse.osee.x.server.feature/feature.xml
@@ -68,4 +68,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.osee.define.report.api"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/plugins/org.eclipse.osee.define.report.api/.classpath b/plugins/org.eclipse.osee.define.report.api/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.define.report.api/.project b/plugins/org.eclipse.osee.define.report.api/.project
new file mode 100644
index 00000000000..b48cbd58b0b
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.define.report.api</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
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
new file mode 100644
index 00000000000..3b0388ba5c9
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Define Report API (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.define.report.api
+Bundle-Version: 0.19.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Export-Package: org.eclipse.osee.define.report.api
diff --git a/plugins/org.eclipse.osee.define.report.api/build.properties b/plugins/org.eclipse.osee.define.report.api/build.properties
new file mode 100644
index 00000000000..34d2e4d2dad
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.define.report.api/pom.xml b/plugins/org.eclipse.osee.define.report.api/pom.xml
new file mode 100644
index 00000000000..c278b66c3a1
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/pom.xml
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.x.server.parent</artifactId>
+ <version>0.19.0-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.define.report.api</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSEE Define Report API- (Incubation)</name>
+
+</project>
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRight.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRight.java
new file mode 100644
index 00000000000..2f40a7efe3f
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRight.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.api;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Angel Avila
+ */
+@XmlRootElement
+public class DataRight {
+
+ private DataRightId id;
+ private String content;
+
+ public DataRightId getId() {
+ return id;
+ }
+
+ public void setId(DataRightId id) {
+ this.id = id;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightAnchor.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightAnchor.java
new file mode 100644
index 00000000000..4b87e14000a
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightAnchor.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.api;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Angel Avila
+ */
+@XmlRootElement
+public class DataRightAnchor {
+
+ private String id;
+ private DataRightId dataRightId;
+ private boolean needsPageBreak;
+ private boolean isNextDifferent;
+
+ public boolean isNextDifferent() {
+ return isNextDifferent;
+ }
+
+ public void setNextDifferent(boolean isNextDifferent) {
+ this.isNextDifferent = isNextDifferent;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public DataRightId getDataRightId() {
+ return dataRightId;
+ }
+
+ public void setDataRightId(DataRightId rightId) {
+ this.dataRightId = rightId;
+ }
+
+ public boolean isNeedsPageBreak() {
+ return needsPageBreak;
+ }
+
+ public void setNeedsPageBreak(boolean needsPageBreak) {
+ this.needsPageBreak = needsPageBreak;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightEntry.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightEntry.java
new file mode 100644
index 00000000000..6d8779dee77
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightEntry.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.api;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Angel Avila
+ */
+
+@XmlRootElement
+public class DataRightEntry {
+ private String guid;
+ private String classification;
+ private PageOrientation orientation;
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public String getClassification() {
+ return classification;
+ }
+
+ public void setClassification(String classification) {
+ this.classification = classification;
+ }
+
+ public PageOrientation getOrientation() {
+ return orientation;
+ }
+
+ public void setOrientation(PageOrientation orientation) {
+ this.orientation = orientation;
+ }
+}
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightId.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightId.java
new file mode 100644
index 00000000000..a1cc508c2bc
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightId.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.api;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Angel Avila
+ */
+
+@XmlRootElement
+public class DataRightId {
+
+ private String id;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ DataRightId other = (DataRightId) obj;
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ } else if (!id.equals(other.id)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "DataRightId [id=" + id + "]";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightInput.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightInput.java
new file mode 100644
index 00000000000..a11a147679a
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightInput.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.api;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ * @author Angel Avila
+ */
+@XmlRootElement
+public class DataRightInput implements Iterable<DataRightEntry> {
+
+ @XmlTransient
+ private List<DataRightEntry> data;
+
+ public List<DataRightEntry> getData() {
+ if (data == null) {
+ data = new ArrayList<DataRightEntry>();
+ }
+ return data;
+ }
+
+ public void setData(List<DataRightEntry> data) {
+ this.data = data;
+ }
+
+ public boolean isEmpty() {
+ return data == null || data.isEmpty();
+ }
+
+ public void addData(String guid, String classification, PageOrientation orientation) {
+ DataRightEntry toAdd = new DataRightEntry();
+ toAdd.setClassification(classification);
+ toAdd.setGuid(guid);
+ toAdd.setOrientation(orientation);
+
+ getData().add(toAdd);
+ }
+
+ @Override
+ public Iterator<DataRightEntry> iterator() {
+ return data.iterator();
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightResult.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightResult.java
new file mode 100644
index 00000000000..feab82bfd17
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DataRightResult.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.api;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ * @author Angel Avila
+ */
+@XmlRootElement
+public class DataRightResult {
+ private static final String NEW_PAGE_TEMPLATE =
+ "<w:p><w:pPr><w:spacing w:after=\"0\"/><w:sectPr>%s</w:sectPr></w:pPr></w:p>";
+ private static final String SAME_PAGE_TEMPLATE = "<w:sectPr>%s</w:sectPr>";
+
+ @XmlTransient
+ private List<DataRightAnchor> dataRightAnchors;
+
+ @XmlTransient
+ private List<DataRight> dataRights;
+
+ private Map<DataRightId, DataRight> dataRightIdToDataRight;
+
+ private Map<String, DataRightAnchor> guidToAnchor;
+
+ @XmlElement
+ public Collection<DataRightAnchor> getDataRightAnchors() {
+ if (dataRightAnchors == null) {
+ dataRightAnchors = new ArrayList<DataRightAnchor>();
+ }
+ return dataRightAnchors;
+ }
+
+ public void setDataRightAnchors(List<DataRightAnchor> dataRightAnchors) {
+ this.dataRightAnchors = dataRightAnchors;
+ }
+
+ @XmlElement
+ public Collection<DataRight> getDataRights() {
+ if (dataRights == null) {
+ dataRights = new ArrayList<DataRight>();
+ }
+ return dataRights;
+ }
+
+ public void setDataRights(List<DataRight> dataRights) {
+ this.dataRights = dataRights;
+ }
+
+ public String getContent(String guid, PageOrientation orientation) {
+
+ checkInitialized();
+ String toReturn;
+
+ DataRightAnchor anchor = guidToAnchor.get(guid);
+ DataRightId key = anchor.getDataRightId();
+ boolean needsPageBreak = anchor.isNeedsPageBreak();
+ boolean isNextDifferent = anchor.isNextDifferent();
+
+ DataRight dataRight = dataRightIdToDataRight.get(key);
+ String partialFooter = dataRight.getContent();
+
+ if (orientation.isLandscape()) {
+ toReturn = partialFooter;
+ } else if (isNextDifferent || needsPageBreak) {
+ if (needsPageBreak) {
+ toReturn = String.format(NEW_PAGE_TEMPLATE, partialFooter);
+ } else {
+ toReturn = String.format(SAME_PAGE_TEMPLATE, partialFooter);
+ }
+ } else {
+ toReturn = "";
+ }
+
+ return toReturn;
+ }
+
+ public void reset() {
+ dataRightIdToDataRight = null;
+ guidToAnchor = null;
+ }
+
+ private void checkInitialized() {
+ if (dataRightIdToDataRight == null || guidToAnchor == null) {
+ dataRightIdToDataRight = new HashMap<DataRightId, DataRight>();
+ guidToAnchor = new HashMap<String, DataRightAnchor>();
+ for (DataRightAnchor anchor : dataRightAnchors) {
+ guidToAnchor.put(anchor.getId(), anchor);
+ }
+
+ for (DataRight dataRight : dataRights) {
+ dataRightIdToDataRight.put(dataRight.getId(), dataRight);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DefineApi.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DefineApi.java
new file mode 100644
index 00000000000..67d02728b73
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/DefineApi.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.api;
+
+/**
+ * @author Angel Avila
+ */
+public interface DefineApi {
+
+ DataRightResult getDataRights(DataRightInput request);
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/PageOrientation.java b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/PageOrientation.java
new file mode 100644
index 00000000000..d4996621a07
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report.api/src/org/eclipse/osee/define/report/api/PageOrientation.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.api;
+
+/**
+ * @author Angel Avila
+ */
+public enum PageOrientation {
+ LANDSCAPE,
+ PORTRAIT;
+
+ public boolean isPortrait() {
+ return this == PORTRAIT;
+ }
+
+ public boolean isLandscape() {
+ return this == LANDSCAPE;
+ }
+
+ public static PageOrientation fromString(String value) {
+ PageOrientation toReturn = PORTRAIT;
+ if (LANDSCAPE.name().equalsIgnoreCase(value)) {
+ toReturn = LANDSCAPE;
+ }
+
+ return toReturn;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF
index 05cdc8724fc..4154b8039b1 100644
--- a/plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.define.report/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)",
javax.ws.rs,
javax.ws.rs.core,
org.eclipse.osee.app,
+ org.eclipse.osee.define.report.api,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.jdk.core.type,
diff --git a/plugins/org.eclipse.osee.define.report/OSGI-INF/define.api.impl.xml b/plugins/org.eclipse.osee.define.report/OSGI-INF/define.api.impl.xml
new file mode 100644
index 00000000000..00a2ba15896
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report/OSGI-INF/define.api.impl.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop">
+ <implementation class="org.eclipse.osee.define.report.internal.DefineApiImpl"/>
+ <reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <service>
+ <provide interface="org.eclipse.osee.define.report.api.DefineApi"/>
+ </service>
+ </scr:component>
diff --git a/plugins/org.eclipse.osee.define.report/OSGI-INF/osee.define.report.xml b/plugins/org.eclipse.osee.define.report/OSGI-INF/osee.define.report.xml
index 37d2534a18e..11988591262 100644
--- a/plugins/org.eclipse.osee.define.report/OSGI-INF/osee.define.report.xml
+++ b/plugins/org.eclipse.osee.define.report/OSGI-INF/osee.define.report.xml
@@ -6,6 +6,7 @@
</service>
<reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
<reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setDefineApi" cardinality="1..1" interface="org.eclipse.osee.define.report.api.DefineApi" name="DefineApi" policy="static"/>
<property name="osee.trace.myII.C_Test_Scripts.primary.regexs" type="String">[^_&quot;]CSID\s*\{\d+\s+(.+)\}
[^_&quot;]CSID\s*(\{[^\{\}]+\})
[^_&quot;]SubDD\s*\{\d+\s*(.+)\}
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DataRightBuilder.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DataRightBuilder.java
new file mode 100644
index 00000000000..9ece9ded06d
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DataRightBuilder.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.internal;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.osee.define.report.api.DataRight;
+import org.eclipse.osee.define.report.api.DataRightAnchor;
+import org.eclipse.osee.define.report.api.DataRightEntry;
+import org.eclipse.osee.define.report.api.DataRightId;
+import org.eclipse.osee.define.report.api.DataRightInput;
+import org.eclipse.osee.define.report.api.DataRightResult;
+import org.eclipse.osee.framework.core.data.IArtifactToken;
+import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.search.QueryBuilder;
+import org.eclipse.osee.orcs.search.QueryFactory;
+
+/**
+ * @author Angel Avila
+ */
+public class DataRightBuilder {
+
+ private final OrcsApi orcsApi;
+
+ private static final IArtifactToken MAPPING_ARTIFACT = TokenFactory.createArtifactToken("AOkJ_kFNbEXCS7UjmfwA",
+ "DataRightsFooters", CoreArtifactTypes.GeneralData);
+
+ public DataRightBuilder(OrcsApi orcsApi) {
+ this.orcsApi = orcsApi;
+ }
+
+ public DataRightResult getDataRights(DataRightInput request) {
+ QueryFactory queryFactory = orcsApi.getQueryFactory(null);
+ QueryBuilder query = queryFactory.fromBranch(CoreBranches.COMMON);
+
+ DataRightResult mapping = new DataRightResult();
+
+ Map<String, DataRight> classificationsToDataRights = getClassificationToDataRights(query);
+ mapping.getDataRights().addAll(classificationsToDataRights.values());
+ findMatchForAll(request.iterator(), mapping.getDataRightAnchors(), classificationsToDataRights);
+ return mapping;
+ }
+
+ private void findMatchForAll(Iterator<DataRightEntry> iterator, Collection<DataRightAnchor> anchors, Map<String, DataRight> classificationsToDataRight) {
+ DataRightEntry currentArtifact = iterator.next();
+ while (currentArtifact != null) {
+ String classification = currentArtifact.getClassification();
+
+ boolean isNextDifferent = false;
+ boolean needsPageBreak = true;
+ DataRightEntry nextArt = null;
+ if (iterator.hasNext()) {
+ nextArt = iterator.next();
+ }
+ if (nextArt != null) {
+ boolean isNextLandscape = nextArt.getOrientation().isLandscape();
+ String nextClassification = nextArt.getClassification();
+
+ if (isNextLandscape) {
+ needsPageBreak = true;
+ } else {
+ if (!classification.equalsIgnoreCase(nextClassification)) {
+ isNextDifferent = true;
+ needsPageBreak = true;
+ } else {
+ needsPageBreak = false;
+ }
+ }
+ } else {
+ // last art doesn't need a page break
+ needsPageBreak = false;
+ isNextDifferent = true;
+ }
+
+ if (!Strings.isValid(classification)) {
+ classification = "DEFAULT";
+ }
+ DataRight dataRight = classificationsToDataRight.get(classification);
+ if (dataRight == null) {
+ classification = "Unspecified";
+ }
+
+ DataRightAnchor anchor = new DataRightAnchor();
+ anchor.setNextDifferent(isNextDifferent);
+ anchor.setNeedsPageBreak(needsPageBreak);
+ anchor.setId(currentArtifact.getGuid());
+ anchor.setDataRightId(dataRight.getId());
+ anchors.add(anchor);
+
+ currentArtifact = nextArt;
+ }
+ }
+
+ private Map<String, DataRight> getClassificationToDataRights(QueryBuilder query) {
+ Map<String, DataRight> toReturn = new HashMap<String, DataRight>();
+
+ @SuppressWarnings("unchecked")
+ ArtifactReadable footerMappingArt = query.andIds(MAPPING_ARTIFACT).getResults().getExactlyOne();
+
+ List<String> footers = footerMappingArt.getAttributeValues(CoreAttributeTypes.GeneralStringData);
+ for (String footer : footers) {
+ String[] enumToFooter = footer.split("\\n", 2);
+ if (enumToFooter.length == 2) {
+ DataRightId id = new DataRightId();
+ id.setId(GUID.create());
+
+ DataRight dataRight = new DataRight();
+ dataRight.setId(id);
+ dataRight.setContent(enumToFooter[1].trim());
+
+ toReturn.put(enumToFooter[0].trim(), dataRight);
+ }
+ }
+
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DataRightsResource.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DataRightsResource.java
new file mode 100644
index 00000000000..d38bb01f1c6
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DataRightsResource.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.internal;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.eclipse.osee.define.report.api.DataRightInput;
+import org.eclipse.osee.define.report.api.DataRightResult;
+import org.eclipse.osee.define.report.api.DefineApi;
+
+/**
+ * @author Angel Avila
+ */
+@Path("/publish/dataRights")
+public class DataRightsResource {
+
+ private final DefineApi defineApi;
+
+ public DataRightsResource(DefineApi defineApi) {
+ this.defineApi = defineApi;
+ }
+
+ /**
+ * Create request to determine all data rights for a collection of Artifacts
+ *
+ * @param data Collection of DataRightArtifacts to find data rights for
+ * @return mapping Mapping of DataRightArtifacts to Footers
+ * @throws JSONException
+ */
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public DataRightResult findAllDataRights(DataRightInput data) {
+ DataRightResult dataRights = defineApi.getDataRights(data);
+ return dataRights;
+ }
+}
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DefineApiImpl.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DefineApiImpl.java
new file mode 100644
index 00000000000..b1c62614a2a
--- /dev/null
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/DefineApiImpl.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.define.report.internal;
+
+import org.eclipse.osee.define.report.api.DataRightInput;
+import org.eclipse.osee.define.report.api.DataRightResult;
+import org.eclipse.osee.define.report.api.DefineApi;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsApi;
+
+/**
+ * @author Angel Avila
+ */
+public class DefineApiImpl implements DefineApi {
+
+ private OrcsApi orcsApi;
+ private Log logger;
+ private DataRightBuilder dataRightsManager;
+
+ public void setOrcsApi(OrcsApi orcsApi) {
+ this.orcsApi = orcsApi;
+ }
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void start() {
+ dataRightsManager = new DataRightBuilder(orcsApi);
+ }
+
+ public void stop() {
+ dataRightsManager = null;
+ }
+
+ @Override
+ public DataRightResult getDataRights(DataRightInput request) {
+ return dataRightsManager.getDataRights(request);
+ }
+}
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/OseeReportApplication.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/OseeReportApplication.java
index 074637ce1e1..f6827522d72 100644
--- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/OseeReportApplication.java
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/OseeReportApplication.java
@@ -16,6 +16,7 @@ import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import org.eclipse.osee.app.OseeAppResourceTokens;
+import org.eclipse.osee.define.report.api.DefineApi;
import org.eclipse.osee.framework.jdk.core.type.IResourceRegistry;
import org.eclipse.osee.framework.jdk.core.type.ResourceRegistry;
import org.eclipse.osee.logger.Log;
@@ -26,9 +27,10 @@ import org.eclipse.osee.orcs.OrcsApi;
*/
@ApplicationPath("define")
public final class OseeReportApplication extends Application {
- private OrcsApi orcsApi;
private final Set<Object> singletons = new HashSet<Object>();
+ private OrcsApi orcsApi;
private Log logger;
+ private DefineApi defineApi;
public void setOrcsApi(OrcsApi orcsApi) {
this.orcsApi = orcsApi;
@@ -38,7 +40,12 @@ public final class OseeReportApplication extends Application {
this.logger = logger;
}
+ public void setDefineApi(DefineApi defineApi) {
+ this.defineApi = defineApi;
+ }
+
public void start(Map<String, Object> properties) {
+
IResourceRegistry resourceRegistry = new ResourceRegistry();
OseeAppResourceTokens.register(resourceRegistry);
logger.debug(">>>>> registered Requirement resource");
@@ -46,6 +53,8 @@ public final class OseeReportApplication extends Application {
logger.debug(">>>>> registered Safety resource");
singletons.add(new PublishLowHighReqTraceabilityResource(logger, resourceRegistry, orcsApi));
logger.debug(">>>>> registered Low/High Trace resource");
+ singletons.add(new DataRightsResource(defineApi));
+ logger.debug(">>>>> registered Data Rights resource");
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
index 4a631bbc5c2..4acbd96ac78 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
@@ -17,6 +17,8 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)",
com.lowagie.text.rtf,
javax.mail,
javax.mail.internet,
+ javax.ws.rs.client;version="2.0.0",
+ javax.ws.rs.core;version="2.0.0",
org.apache.commons.io,
org.apache.commons.lang,
org.apache.commons.lang.mutable,
@@ -72,6 +74,7 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)",
org.eclipse.nebula.widgets.xviewer.util,
org.eclipse.osee.account.rest.client,
org.eclipse.osee.account.rest.model,
+ org.eclipse.osee.define.report.api,
org.eclipse.osee.framework.access,
org.eclipse.osee.framework.core.client,
org.eclipse.osee.framework.core.client.server,
@@ -134,6 +137,7 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)",
org.eclipse.osee.framework.ui.swt,
org.eclipse.osee.framework.ui.swt.styledText,
org.eclipse.osee.framework.ui.ws,
+ org.eclipse.osee.jaxrs.client,
org.eclipse.osee.orcs.rest.client,
org.eclipse.search.ui,
org.eclipse.search.ui.text,
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 50585ee499d..a4930cf4c4d 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
@@ -38,11 +38,12 @@ import org.eclipse.osee.framework.skynet.core.types.IArtifact;
import org.eclipse.osee.framework.skynet.core.word.WordUtil;
import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
import org.eclipse.osee.framework.ui.skynet.render.compare.WordTemplateCompare;
-import org.eclipse.osee.framework.ui.skynet.render.word.ArtifactDataRightsProvider;
import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
+import org.eclipse.osee.framework.ui.skynet.render.word.DataRightProviderImpl;
import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
import org.eclipse.osee.framework.ui.skynet.render.word.WordTemplateProcessor;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordTemplateProcessor.DataRightProvider;
import org.eclipse.osee.framework.ui.skynet.templates.TemplateManager;
import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
import org.eclipse.osee.framework.ui.swt.Displays;
@@ -66,13 +67,14 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
public static final String FIRST_TIME = "FirstTime";
public static final String SECOND_TIME = "SecondTime";
- private final WordTemplateProcessor templateProcessor = new WordTemplateProcessor(this,
- new ArtifactDataRightsProvider());
+ private final WordTemplateProcessor templateProcessor;
private final IComparator comparator;
public WordTemplateRenderer() {
this.comparator = new WordTemplateCompare(this);
+ DataRightProvider provider = new DataRightProviderImpl();
+ this.templateProcessor = new WordTemplateProcessor(this, provider);
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/ArtifactDataRightsProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/ArtifactDataRightsProvider.java
deleted file mode 100644
index 57e19b93331..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/ArtifactDataRightsProvider.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.render.word;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.osee.framework.core.data.IArtifactToken;
-import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordTemplateProcessor.DataRightsProvider;
-
-/**
- * @author John Misinco
- */
-public class ArtifactDataRightsProvider implements DataRightsProvider {
-
- private static final String NEW_PAGE_TEMPLATE =
- "<w:p><w:pPr><w:spacing w:after=\"0\"/><w:sectPr>%s</w:sectPr></w:pPr></w:p>";
- private static final String SAME_PAGE_TEMPLATE = "<w:sectPr>%s</w:sectPr>";
- private static final String GENERIC_FOOTER =
- "<w:ftr w:type=\"odd\"><w:p><w:pPr><w:pStyle w:val=\"Footer\"/></w:pPr><w:r><w:t>%s</w:t></w:r></w:p></w:ftr>";
- private static final IArtifactToken MAPPING_ARTIFACT = TokenFactory.createArtifactToken("AOkJ_kFNbEXCS7UjmfwA",
- "DataRightsFooters", CoreArtifactTypes.GeneralData);
-
- private Map<String, String> dataRightsToFooters;
-
- @Override
- public String getDataClassificationFooter(String classification, FooterOption option) {
- if (dataRightsToFooters == null) {
- initialize();
- }
-
- String key = classification;
- String footer = null;
- if (!Strings.isValid(key)) {
- key = "DEFAULT";
- }
-
- footer = dataRightsToFooters.get(key);
- if (!Strings.isValid(footer)) {
- String text = String.format("FOOTER NOT DEFINED FOR [%s]", key);
- footer = String.format(GENERIC_FOOTER, text);
- }
-
- switch (option) {
- case NEW_PAGE:
- footer = String.format(NEW_PAGE_TEMPLATE, footer);
- break;
- case SAME_PAGE:
- footer = String.format(SAME_PAGE_TEMPLATE, footer);
- break;
- case FOOTER_ONLY:
- default:
- // do nothing, return footer only
- }
-
- return footer;
- }
-
- private void initialize() {
- dataRightsToFooters = new HashMap<String, String>();
- Artifact art =
- ArtifactQuery.getOrCreate(MAPPING_ARTIFACT.getGuid(), MAPPING_ARTIFACT.getArtifactType(), CoreBranches.COMMON);
- List<String> footers = art.getAttributesToStringList(CoreAttributeTypes.GeneralStringData);
- for (String footer : footers) {
- String[] enumToFooter = footer.split("\\n", 2);
- if (enumToFooter.length == 2) {
- dataRightsToFooters.put(enumToFooter[0].trim(), enumToFooter[1].trim());
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/DataRightProviderImpl.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/DataRightProviderImpl.java
new file mode 100644
index 00000000000..fcd9a237c8e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/DataRightProviderImpl.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.render.word;
+
+import java.net.URI;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+import org.eclipse.osee.define.report.api.DataRightInput;
+import org.eclipse.osee.define.report.api.DataRightResult;
+import org.eclipse.osee.define.report.api.PageOrientation;
+import org.eclipse.osee.framework.core.client.OseeClientProperties;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordTemplateProcessor.DataRightProvider;
+import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
+import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
+
+/**
+ * @author Angel Avila
+ */
+public class DataRightProviderImpl implements DataRightProvider {
+
+ private static final DataRightResult DEFAULT_RESPONSE = newDefaultResponse();
+
+ @Override
+ public DataRightResult getDataRights(DataRightInput request) {
+ DataRightResult response = DEFAULT_RESPONSE;
+ if (request != null && !request.isEmpty()) {
+ String appServer = OseeClientProperties.getOseeApplicationServer();
+ URI uri = UriBuilder.fromUri(appServer).path("define").path("publish").path("dataRights").build();
+
+ JaxRsWebTarget target = JaxRsClient.newClient().target(uri);
+ try {
+ response = target.request(MediaType.APPLICATION_JSON).post(Entity.json(request), DataRightResult.class);
+ } catch (Exception ex) {
+ JaxRsExceptions.asOseeException(ex);
+ }
+ }
+ return response;
+ }
+
+ @Override
+ public DataRightInput createRequest() {
+ return new DataRightInput();
+ }
+
+ private static DataRightResult newDefaultResponse() {
+ return new DataRightResult() {
+
+ @Override
+ public String getContent(String guid, PageOrientation orientation) {
+ return "";
+ }
+ };
+ }
+}
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 c95e190a132..825a5296115 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
@@ -370,7 +370,12 @@ public class WordMLProducer extends Producer {
setPageLayout(artifact, null);
}
- public void setPageLayout(Artifact artifact, String footerMl) throws OseeCoreException {
+ /**
+ * Sets the page layout to either portrait/landscape depending on the artifacts pageType attribute value. Note: This
+ * call should be done after processing each artifact so if a previous artifact was landscaped the following artifact
+ * would be set back to portrait.
+ */
+ public void setPageLayout(Artifact artifact, String footer) throws OseeCoreException {
String pageTypeValue = null;
if (artifact.isAttributeTypeValid(CoreAttributeTypes.PageType)) {
pageTypeValue = artifact.getSoleAttributeValue(CoreAttributeTypes.PageType, "Portrait");
@@ -382,8 +387,8 @@ public class WordMLProducer extends Producer {
append("<w:p>");
append("<w:pPr>");
append("<w:sectPr>");
- if (Strings.isValid(footerMl)) {
- append(footerMl);
+ if (Strings.isValid(footer)) {
+ append(footer);
}
append("<w:pgSz w:w=\"15840\" w:h=\"12240\" w:orient=\"landscape\" w:code=\"1\" />");
append("</w:sectPr>");
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 1d755f0f1e8..620fd161725 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
@@ -34,6 +34,9 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.define.report.api.DataRightInput;
+import org.eclipse.osee.define.report.api.DataRightResult;
+import org.eclipse.osee.define.report.api.PageOrientation;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -57,7 +60,6 @@ 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.framework.ui.skynet.render.WordTemplateRenderer;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordTemplateProcessor.DataRightsProvider.FooterOption;
import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.swt.program.Program;
@@ -70,6 +72,13 @@ import org.eclipse.swt.program.Program;
* @link WordTemplateProcessorTest
*/
public class WordTemplateProcessor {
+
+ public interface DataRightProvider {
+ DataRightResult getDataRights(DataRightInput request);
+
+ DataRightInput createRequest();
+ }
+
private static final String ARTIFACT = "Artifact";
private static final String EXTENSION_PROCESSOR = "Extension_Processor";
private static final String KEY = "Key";
@@ -118,28 +127,15 @@ public class WordTemplateProcessor {
private boolean isDiff;
private boolean excludeFolders;
private CharSequence paragraphNumber = null;
+ private final DataRightInput request;
- private String previousClassification = null;
- private boolean firstArtifact = true;
- private boolean dataRightsDetected = false;
- private boolean previousWasLandscape = false;
- private final DataRightsProvider dataRightsProvider;
-
- public static interface DataRightsProvider {
-
- public enum FooterOption {
- NEW_PAGE,
- SAME_PAGE,
- FOOTER_ONLY
- }
-
- String getDataClassificationFooter(String classification, FooterOption option);
- }
+ private final DataRightProvider provider;
- public WordTemplateProcessor(WordTemplateRenderer renderer, DataRightsProvider dataRightsProvider) {
+ public WordTemplateProcessor(WordTemplateRenderer renderer, DataRightProvider provider) {
this.renderer = renderer;
- this.dataRightsProvider = dataRightsProvider;
+ this.provider = provider;
loadIgnoreAttributeExtensions();
+ request = provider.createRequest();
}
/**
@@ -279,15 +275,10 @@ public class WordTemplateProcessor {
WordTemplateFileDiffer templateFileDiffer = new WordTemplateFileDiffer(renderer);
templateFileDiffer.generateFileDifferences(artifacts, "/results/", outlineNumber, outlineType, recurseChildren);
} else {
+ populateRequest(artifacts, request);
+ DataRightResult response = provider.getDataRights(request);
for (Artifact artifact : artifacts) {
- processObjectArtifact(artifact, wordMl, outlineType, presentationType, artifacts.size() > 1);
- }
-
- // if previous was landscape, it would've had the footer inserted in the setPageLayout
- if (dataRightsDetected && !previousWasLandscape) {
- String footer =
- dataRightsProvider.getDataClassificationFooter(previousClassification, FooterOption.SAME_PAGE);
- wordMl.addWordMl(footer);
+ processObjectArtifact(artifact, wordMl, outlineType, presentationType, response);
}
}
// maintain a list of artifacts that have been processed so we do not
@@ -392,7 +383,7 @@ public class WordTemplateProcessor {
}
}
- private void processObjectArtifact(Artifact artifact, WordMLProducer wordMl, String outlineType, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
+ private void processObjectArtifact(Artifact artifact, WordMLProducer wordMl, String outlineType, PresentationType presentationType, DataRightResult data) throws OseeCoreException {
if (!artifact.isAttributeTypeValid(CoreAttributeTypes.WholeWordContent) && !artifact.isAttributeTypeValid(CoreAttributeTypes.NativeContent)) {
// If the artifact has not been processed
if (!processedArtifacts.contains(artifact)) {
@@ -403,16 +394,7 @@ public class WordTemplateProcessor {
boolean templateOnly = renderer.getBooleanOption("TEMPLATE ONLY");
boolean includeUUIDs = renderer.getBooleanOption("INCLUDE UUIDS");
- String dataRights = "";
-
if (!ignoreArtifact) {
-
- dataRights = artifact.getSoleAttributeValueAsString(CoreAttributeTypes.DataRightsClassification, "");
- dataRightsDetected = dataRightsDetected || Strings.isValid(dataRights);
- boolean isLandscape = isLandscape(artifact);
-
- handleLandscapeArtifactSectionBreak(artifact, wordMl, multipleArtifacts);
-
if (outlining && !templateOnly) {
String headingText = artifact.getSoleAttributeValue(headingAttributeType, "");
@@ -426,20 +408,6 @@ public class WordTemplateProcessor {
headingText = headingText.concat(" [MERGED]");
}
- String footer = null;
- if (!firstArtifact && (!dataRights.equals(previousClassification) || isLandscape != previousWasLandscape)) {
- footer =
- dataRightsProvider.getDataClassificationFooter(previousClassification, FooterOption.NEW_PAGE);
- } else if (dataRightsDetected && !Strings.isValid(dataRights)) {
- footer = dataRightsProvider.getDataClassificationFooter(dataRights, FooterOption.NEW_PAGE);
- }
- firstArtifact = false;
-
- // if previous was landscape, it would've had the footer inserted in the setPageLayout
- if (Strings.isValid(footer) && !previousWasLandscape) {
- wordMl.addWordMl(footer);
- }
-
if (!publishInline && !templateOnly) {
paragraphNumber = wordMl.startOutlineSubSection("Times New Roman", headingText, outlineType);
startedSection = true;
@@ -464,15 +432,20 @@ public class WordTemplateProcessor {
}
}
}
+ PageOrientation orientation = getPageOrientation(artifact);
+
+ String footer = data.getContent(artifact.getGuid(), orientation);
+ processAttributes(artifact, wordMl, presentationType, publishInline, footer);
+
+ if (orientation.isPortrait()) { // Footer has already been added by the processAttributes call
+ wordMl.addWordMl(footer);
+ }
- previousWasLandscape = isLandscape;
- previousClassification = dataRights;
- processAttributes(artifact, wordMl, presentationType, multipleArtifacts, publishInline);
}
// Check for option that may have been set from Publish with Diff BLAM to recurse
if ((recurseChildren && !renderer.getBooleanOption(RECURSE_ON_LOAD)) || (renderer.getBooleanOption(RECURSE_ON_LOAD) && !renderer.getBooleanOption("Orig Publish As Diff"))) {
for (Artifact childArtifact : artifact.getChildren()) {
- processObjectArtifact(childArtifact, wordMl, outlineType, presentationType, multipleArtifacts);
+ processObjectArtifact(childArtifact, wordMl, outlineType, presentationType, data);
}
}
@@ -486,28 +459,37 @@ public class WordTemplateProcessor {
}
}
- private void handleLandscapeArtifactSectionBreak(Artifact artifact, WordMLProducer wordMl, boolean multipleArtifacts) throws OseeCoreException {
- // There is no reason to add an additional page break if there is a
- // single artifacts
- if (multipleArtifacts) {
- boolean landscape = isLandscape(artifact);
+ private void populateRequest(List<Artifact> artifacts, DataRightInput request) {
+ if (request.isEmpty()) {
+ List<Artifact> allArtifacts = new ArrayList<Artifact>();
+ if (recurseChildren) {
+ for (Artifact art : artifacts) {
+ allArtifacts.add(art);
+ allArtifacts.addAll(art.getDescendants());
+ }
+ } else {
+ allArtifacts.addAll(artifacts);
+ }
+
+ for (Artifact artifact : allArtifacts) {
+ String classification =
+ artifact.getSoleAttributeValueAsString(CoreAttributeTypes.DataRightsClassification, "");
- if (landscape) {
- wordMl.setPageBreak();
+ PageOrientation orientation = getPageOrientation(artifact);
+ request.addData(artifact.getGuid(), classification, orientation);
}
}
}
- private boolean isLandscape(Artifact artifact) {
+ private PageOrientation getPageOrientation(Artifact artifact) {
String pageTypeValue = null;
if (artifact.isAttributeTypeValid(CoreAttributeTypes.PageType)) {
pageTypeValue = artifact.getSoleAttributeValue(CoreAttributeTypes.PageType, "Portrait");
}
- boolean landscape = pageTypeValue != null && pageTypeValue.equals("Landscape");
- return landscape;
+ return PageOrientation.fromString(pageTypeValue);
}
- private void processAttributes(Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts, boolean publishInLine) throws OseeCoreException {
+ private void processAttributes(Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean publishInLine, String footer) throws OseeCoreException {
for (AttributeElement attributeElement : attributeElements) {
String attributeName = attributeElement.getAttributeName();
@@ -515,7 +497,7 @@ public class WordTemplateProcessor {
for (IAttributeType attributeType : RendererManager.getAttributeTypeOrderList(artifact)) {
if (!outlining || !attributeType.equals(headingAttributeType)) {
processAttribute(artifact, wordMl, attributeElement, attributeType, true, presentationType,
- multipleArtifacts, publishInLine);
+ publishInLine);
}
}
} else {
@@ -523,18 +505,14 @@ public class WordTemplateProcessor {
if (artifact.isAttributeTypeValid(attributeType)) {
processAttribute(artifact, wordMl, attributeElement, attributeType, false, presentationType,
- multipleArtifacts, publishInLine);
+ publishInLine);
}
}
}
- String footer = null;
- if (dataRightsDetected) {
- footer = dataRightsProvider.getDataClassificationFooter(previousClassification, FooterOption.FOOTER_ONLY);
- }
wordMl.setPageLayout(artifact, footer);
}
- private void processAttribute(Artifact artifact, WordMLProducer wordMl, AttributeElement attributeElement, IAttributeType attributeType, boolean allAttrs, PresentationType presentationType, boolean multipleArtifacts, boolean publishInLine) throws OseeCoreException {
+ private void processAttribute(Artifact artifact, WordMLProducer wordMl, AttributeElement attributeElement, IAttributeType attributeType, boolean allAttrs, PresentationType presentationType, boolean publishInLine) throws OseeCoreException {
renderer.setOption("allAttrs", allAttrs);
// This is for SRS Publishing. Do not publish unspecified attributes
if (!allAttrs && (attributeType.equals(CoreAttributeTypes.Partition) || attributeType.equals(CoreAttributeTypes.SafetyCriticality))) {
diff --git a/plugins/org.eclipse.osee.x.server.parent/pom.xml b/plugins/org.eclipse.osee.x.server.parent/pom.xml
index 811f8d27362..5d28e828b3d 100644
--- a/plugins/org.eclipse.osee.x.server.parent/pom.xml
+++ b/plugins/org.eclipse.osee.x.server.parent/pom.xml
@@ -17,6 +17,7 @@
<version>0.19.0-SNAPSHOT</version>
<modules>
+ <module>../../plugins/org.eclipse.osee.define.report.api</module>
<module>../../plugins/org.eclipse.osee.define.report</module>
<module>../../plugins/org.eclipse.osee.define.report.test</module>

Back to the top