Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-03-17 11:44:01 -0400
committerdonald.g.dunne2016-03-17 13:43:58 -0400
commit360372feffdb92a1daef07d6b2b5d589eb656be6 (patch)
tree172c85b164102e163afa47c47e9c61b7355b4c6b
parentfc93c49a5cc550d26e7caccc82174903b0bb722e (diff)
downloadorg.eclipse.osee-360372feffdb92a1daef07d6b2b5d589eb656be6.tar.gz
org.eclipse.osee-360372feffdb92a1daef07d6b2b5d589eb656be6.tar.xz
org.eclipse.osee-360372feffdb92a1daef07d6b2b5d589eb656be6.zip
feature[ats_ATS277469]: Create Implementation Details types and images
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/images/implementationDetails.xcfbin4314 -> 4258 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_data_definition.gifbin577 -> 571 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_drawing.gifbin607 -> 580 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_function.gifbin599 -> 578 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_procedure.gifbin597 -> 576 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java88
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DynamicImage.java49
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DynamicImages.java29
-rw-r--r--plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ImageManager.java7
-rw-r--r--plugins/org.eclipse.osee.web.ui/src/images.json.example16
11 files changed, 183 insertions, 8 deletions
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 af95cd0241..47c646a252 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
@@ -22,6 +22,8 @@ Import-Package: com.google.common.base;version="15.0.0",
org.apache.commons.io,
org.apache.commons.lang,
org.apache.commons.lang.mutable,
+ org.codehaus.jackson,
+ org.codehaus.jackson.map,
org.eclipse.birt.chart.device,
org.eclipse.birt.chart.exception,
org.eclipse.birt.chart.factory,
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementationDetails.xcf b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementationDetails.xcf
index e7c0f7f1b7..78b449f748 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementationDetails.xcf
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementationDetails.xcf
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_data_definition.gif b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_data_definition.gif
index 0d0c882fa3..a6acae99f1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_data_definition.gif
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_data_definition.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_drawing.gif b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_drawing.gif
index c997773666..8b58e9c988 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_drawing.gif
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_drawing.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_function.gif b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_function.gif
index f357e177a7..e0f6d2ab00 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_function.gif
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_function.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_procedure.gif b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_procedure.gif
index 44e8b757d3..fe34a885ed 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_procedure.gif
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/images/implementation_details_procedure.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
index cc7bdfa13c..e0256ffd7d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java
@@ -9,15 +9,31 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
******************************/
package org.eclipse.osee.framework.ui.skynet;
+import java.net.URI;
+import java.net.URL;
import java.util.Collection;
+import java.util.logging.Level;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.framework.core.client.OseeClientProperties;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.User;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.types.IArtifact;
import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.skynet.util.DynamicImage;
+import org.eclipse.osee.framework.ui.skynet.util.DynamicImages;
import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.swt.graphics.Image;
/**
* @author Donald G. Dunne
@@ -44,23 +60,81 @@ public class FrameworkArtifactImageProvider extends ArtifactImageProvider {
FrameworkImage.IMPLEMENTATION_DETAILS_DRAWING, this);
ArtifactImageManager.registerBaseImage(CoreArtifactTypes.ImplementationDetailsDataDefinition,
FrameworkImage.IMPLEMENTATION_DETAILS_DATA_DEFINITION, this);
+ readDynamicImagesFromUrl();
ArtifactImageManager.registerOverrideImageProvider(this, CoreArtifactTypes.User);
}
+ private void readDynamicImagesFromUrl() {
+
+ try {
+ String appServer = OseeClientProperties.getOseeApplicationServer();
+ URI uri = UriBuilder.fromUri(appServer).path("images.json").build();
+
+ // first, retrieve the images.json file to see if there are any images
+ String imagesJson = JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
+ if (Strings.isValid(imagesJson)) {
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ // read images.xml
+ DynamicImages images = mapper.readValue(imagesJson, DynamicImages.class);
+
+ // for each image
+ for (DynamicImage dynamicImage : images.getImages()) {
+
+ try {
+ // get image from url
+ if (Strings.isValid(dynamicImage.getImageUrl())) {
+
+ URL url = new URL(dynamicImage.getImageUrl());
+ Image image = ImageDescriptor.createFromURL(url).createImage();
+ if (image != null) {
+ // get artifact type
+ IArtifactType artifactType = null;
+ if (Strings.isNumeric(dynamicImage.getArtifactTypeUuid())) {
+ artifactType =
+ ArtifactTypeManager.getTypeByGuid(Long.valueOf(dynamicImage.getArtifactTypeUuid()));
+ }
+ if (artifactType == null && Strings.isValid(dynamicImage.getArtifactTypeName())) {
+ artifactType = ArtifactTypeManager.getType(dynamicImage.getArtifactTypeName());
+ }
+ if (artifactType != null) {
+ // register image for artifact type
+ ArtifactImageManager.registerBaseImage(artifactType, ImageManager.createKeyedImage(
+ artifactType.getGuid().toString(), ImageDescriptor.createFromImage(image)), this);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.logf(FrameworkArtifactImageProvider.class, Level.SEVERE, ex, "Error processing image [%s]",
+ dynamicImage);
+ }
+ }
+ }
+
+ } catch (Exception ex) {
+ OseeLog.logf(FrameworkArtifactImageProvider.class, Level.SEVERE, ex,
+ "Error processing dynamic artifact images.");
+ }
+
+ }
+
@Override
public String setupImage(IArtifact artifact) throws OseeCoreException {
Artifact aArtifact = artifact.getFullArtifact();
if (aArtifact.isDeleted()) {
return null;
- } else if (((User) aArtifact).isSystemUser()) {
- return ImageManager.setupImage(FrameworkImage.USER_GREY);
- } else if (!((User) aArtifact).isActive()) {
- return ImageManager.setupImage(FrameworkImage.USER_YELLOW);
- } else if (((User) aArtifact).equals(UserManager.getUser())) {
- return ImageManager.setupImage(FrameworkImage.USER_RED);
}
-
+ if (aArtifact.isOfType(CoreArtifactTypes.User)) {
+ if (((User) aArtifact).isSystemUser()) {
+ return ImageManager.setupImage(FrameworkImage.USER_GREY);
+ } else if (!((User) aArtifact).isActive()) {
+ return ImageManager.setupImage(FrameworkImage.USER_YELLOW);
+ } else if (((User) aArtifact).equals(UserManager.getUser())) {
+ return ImageManager.setupImage(FrameworkImage.USER_RED);
+ }
+ }
return super.setupImage(artifact);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DynamicImage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DynamicImage.java
new file mode 100644
index 0000000000..618780b4a6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DynamicImage.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.util;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+@XmlRootElement
+public class DynamicImage {
+
+ private String imageUrl;
+ private String artifactTypeName;
+ private String artifactTypeUuid;
+
+ public String getImageUrl() {
+ return imageUrl;
+ }
+
+ public void setImageUrl(String imageUrl) {
+ this.imageUrl = imageUrl;
+ }
+
+ public String getArtifactTypeName() {
+ return artifactTypeName;
+ }
+
+ public void setArtifactTypeName(String artifactTypeName) {
+ this.artifactTypeName = artifactTypeName;
+ }
+
+ public String getArtifactTypeUuid() {
+ return artifactTypeUuid;
+ }
+
+ public void setArtifactTypeUuid(String artifactTypeUuid) {
+ this.artifactTypeUuid = artifactTypeUuid;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DynamicImages.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DynamicImages.java
new file mode 100644
index 0000000000..0a1d9f1fc6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DynamicImages.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+@XmlRootElement
+public class DynamicImages {
+
+ public List<DynamicImage> images = new ArrayList<>();
+
+ public List<DynamicImage> getImages() {
+ return images;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ImageManager.java b/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ImageManager.java
index 7aa237c188..9bbc2b6aa6 100644
--- a/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ImageManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ImageManager.java
@@ -79,7 +79,8 @@ public final class ImageManager {
ImageDescriptor imageDescriptor = imageEnum.createImageDescriptor();
if (imageDescriptor == null) {
if (!imageKey.contains("nothere.gif")) {
- OseeLog.logf(Activator.class, Level.SEVERE, "Unable to load the image for [%s]", imageEnum.getImageKey());
+ OseeLog.logf(Activator.class, Level.SEVERE, "Unable to load the image for [%s]",
+ imageEnum.getImageKey());
}
return setupImage(MISSING);
}
@@ -109,6 +110,10 @@ public final class ImageManager {
return AbstractUIPlugin.imageDescriptorFromPlugin(symbolicBundleName, imagePath + File.separator + imageFileName);
}
+ public static KeyedImage createKeyedImage(String imageKey, ImageDescriptor descriptor) {
+ return new KeyedImagePair(imageKey, descriptor);
+ }
+
private static final class KeyedImagePair implements KeyedImage {
private final ImageDescriptor descriptor;
private final String imageKey;
diff --git a/plugins/org.eclipse.osee.web.ui/src/images.json.example b/plugins/org.eclipse.osee.web.ui/src/images.json.example
new file mode 100644
index 0000000000..bc54cd3e12
--- /dev/null
+++ b/plugins/org.eclipse.osee.web.ui/src/images.json.example
@@ -0,0 +1,16 @@
+// Example of images.json file. If images.json file exists, the client will use this file
+// to register images for any artifact types specified. Simply provide the imageUrl, artifact type
+// name and uuid and these images will be used.
+// 1. Copy this file and rename it to images.json
+// 2. Remove these comments, they are not valid json
+// 3. Edit for your artifact types and image urls
+// 4. Restart the org.eclipse.osee.web.ui bundle or server for it to take affect.
+{
+ "images": [
+ {
+ "imageUrl": "http://osee.msc.az.boeing.com/libs/images/my_image.gif",
+ "artifactTypeName": "Implementation Details Procedure",
+ "artifactTypeUuid": "69914"
+ }
+ ]
+} \ No newline at end of file

Back to the top