Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2016-09-14 14:05:27 -0400
committerAngel Avila2016-10-04 21:35:05 -0400
commit45c3ca2cb29ba0bbc80eea6921d2047216389603 (patch)
treeae94979f6ba3ffa2479372d3ff7ab8c0eb5a7426
parent09f9197ebce2cdcfe43d36927776259d10ac5ee3 (diff)
downloadorg.eclipse.osee-45c3ca2cb29ba0bbc80eea6921d2047216389603.tar.gz
org.eclipse.osee-45c3ca2cb29ba0bbc80eea6921d2047216389603.tar.xz
org.eclipse.osee-45c3ca2cb29ba0bbc80eea6921d2047216389603.zip
feature: Create REST Call to return PL Configration as JSON
-Created new artifact FeatureDefinition -Use GeneralString attribute to store PL Configuration as JSON Change-Id: I019eab73e45d7018032ba3dfbe54edfdff466ef9 Signed-off-by: Morgan E. Cook <Morgan.e.cook@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/FeatureDefinitionData.java54
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkArtifactImageProvider.java1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ApplicabilityQueryImpl.java25
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/ApplicabilityEndpoint.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ApplicabilityEndpointImpl.java9
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApplicabilityQuery.java4
8 files changed, 104 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/FeatureDefinitionData.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/FeatureDefinitionData.java
new file mode 100644
index 00000000000..50e18027b04
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/FeatureDefinitionData.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.core.data;
+
+import java.util.List;
+
+public class FeatureDefinitionData {
+
+ private String name;
+ private String type;
+ private List<String> values;
+ private String defaultValue;
+ private String description;
+
+ public FeatureDefinitionData() {
+ // Not doing anything
+ }
+
+ public FeatureDefinitionData(String name, String type, List<String> values, String defaultValue, String description) {
+ this.name = name;
+ this.type = type;
+ this.values = values;
+ this.defaultValue = defaultValue;
+ this.description = description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public List<String> getValues() {
+ return values;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java
index 1f2f9af2c2e..34e0f234008 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java
@@ -31,6 +31,7 @@ public final class CoreArtifactTypes {
public static final IArtifactType Design = TokenFactory.createArtifactType(0x000000000000015AL, "Design");
public static final IArtifactType DirectSoftwareRequirement = TokenFactory.createArtifactType(0x0000000000000016L, "Direct Software Requirement");
public static final IArtifactType Feature = TokenFactory.createArtifactType(0x0000000000000057L, "Feature");
+ public static final IArtifactType FeatureDefinition = TokenFactory.createArtifactType(0x512C19B7102793A2L, "Feature Definition");
public static final IArtifactType Folder = TokenFactory.createArtifactType(0x000000000000000BL, "Folder");
public static final IArtifactType GeneralData = TokenFactory.createArtifactType(0x000000000000000CL, "General Data");
public static final IArtifactType GeneralDocument = TokenFactory.createArtifactType(0x000000000000000EL, "General Document");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee b/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
index 255f9ccdfef..23584dfe88e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
+++ b/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
@@ -18,6 +18,10 @@ artifactType "Branch View" extends "Artifact" {
uuid 0x512C19B4108793E2
}
+artifactType "Feature Definition" extends "General Data" {
+ uuid 0x512C19B7102793A2
+}
+
artifactType "Osee Type Enum" extends "Enumerated Artifact" {
uuid 0x4B9A7DCF0856C368
attribute "Id Value"
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 67623364305..599039c9e6b 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
@@ -59,6 +59,7 @@ public class FrameworkArtifactImageProvider extends ArtifactImageProvider {
ArtifactImageManager.registerBaseImage(CoreArtifactTypes.SubscriptionGroup, FrameworkImage.EMAIL, this);
ArtifactImageManager.registerBaseImage(CoreArtifactTypes.UniversalGroup, FrameworkImage.GROUP, this);
ArtifactImageManager.registerBaseImage(CoreArtifactTypes.BranchView, FrameworkImage.BRANCH_VIEW, this);
+ ArtifactImageManager.registerBaseImage(CoreArtifactTypes.FeatureDefinition, FrameworkImage.BRANCH_VIEW, this);
ArtifactImageManager.registerBaseImage(CoreArtifactTypes.ImplementationDetails,
FrameworkImage.IMPLEMENTATION_DETAILS, this);
ArtifactImageManager.registerBaseImage(CoreArtifactTypes.ImplementationDetailsProcedure,
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ApplicabilityQueryImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ApplicabilityQueryImpl.java
index 9a7d951de44..12a1ea9a0cc 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ApplicabilityQueryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/ApplicabilityQueryImpl.java
@@ -11,13 +11,19 @@
package org.eclipse.osee.orcs.core.internal.search;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.function.BiConsumer;
+import org.codehaus.jackson.map.ObjectMapper;
import org.eclipse.osee.framework.core.data.ApplicabilityToken;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.FeatureDefinitionData;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreTupleTypes;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.search.ApplicabilityQuery;
import org.eclipse.osee.orcs.search.TupleQuery;
@@ -74,4 +80,23 @@ public class ApplicabilityQueryImpl implements ApplicabilityQuery {
tupleQuery.getTuple2UniqueE2Pair(CoreTupleTypes.ViewApplicability, branch2, consumer);
return tokens;
}
+
+ @Override
+ public List<FeatureDefinitionData> getFeatureDefinitionData(List<ArtifactReadable> featureDefinitionArts) {
+ List<FeatureDefinitionData> featureDefinition = new ArrayList<>();
+
+ for (ArtifactReadable art : featureDefinitionArts) {
+ String json = art.getSoleAttributeAsString(CoreAttributeTypes.GeneralStringData);
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ FeatureDefinitionData[] readValue = mapper.readValue(json, FeatureDefinitionData[].class);
+ featureDefinition.addAll(Arrays.asList(readValue));
+ } catch (Exception e) {
+ throw new OseeCoreException(e,
+ String.format("Invalid JSON in general string data attribute on artifactId [%s]", art.getId()));
+ }
+ }
+ return featureDefinition;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/ApplicabilityEndpoint.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/ApplicabilityEndpoint.java
index d502b29ad74..7984ba82cd9 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/ApplicabilityEndpoint.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/ApplicabilityEndpoint.java
@@ -23,6 +23,7 @@ import javax.ws.rs.core.Response;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ApplicabilityToken;
import org.eclipse.osee.framework.core.data.ArtifactId;
+import org.eclipse.osee.framework.core.data.FeatureDefinitionData;
/**
* @author Donald G. Dunne
@@ -34,6 +35,11 @@ public interface ApplicabilityEndpoint {
@Produces({MediaType.APPLICATION_JSON})
List<ApplicabilityToken> getApplicabilityTokens();
+ @GET
+ @Path("feature/data")
+ @Produces({MediaType.APPLICATION_JSON})
+ List<FeatureDefinitionData> getFeatureDefinitionData();
+
@PUT
@Path("{applicId}")
@Consumes({MediaType.APPLICATION_JSON})
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ApplicabilityEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ApplicabilityEndpointImpl.java
index 13220f9f107..08386c5393a 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ApplicabilityEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ApplicabilityEndpointImpl.java
@@ -18,11 +18,13 @@ import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ApplicabilityToken;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.FeatureDefinitionData;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreTupleTypes;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.rest.model.ApplicabilityEndpoint;
import org.eclipse.osee.orcs.search.TupleQuery;
import org.eclipse.osee.orcs.transaction.TransactionBuilder;
@@ -88,6 +90,13 @@ public class ApplicabilityEndpointImpl implements ApplicabilityEndpoint {
}
@Override
+ public List<FeatureDefinitionData> getFeatureDefinitionData() {
+ List<ArtifactReadable> featureDefinitionArts = orcsApi.getQueryFactory().fromBranch(branch).andIsOfType(
+ CoreArtifactTypes.FeatureDefinition).getResults().getList();
+ return orcsApi.getQueryFactory().applicabilityQuery().getFeatureDefinitionData(featureDefinitionArts);
+ }
+
+ @Override
public Response setApplicability(ApplicabilityId applicId, List<? extends ArtifactId> artifacts) {
TransactionBuilder tx =
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApplicabilityQuery.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApplicabilityQuery.java
index 895852156d2..49a7c35e01f 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApplicabilityQuery.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/search/ApplicabilityQuery.java
@@ -15,6 +15,8 @@ import java.util.List;
import org.eclipse.osee.framework.core.data.ApplicabilityToken;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.FeatureDefinitionData;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
/**
* @author Ryan D. Brooks
@@ -28,4 +30,6 @@ public interface ApplicabilityQuery {
HashMap<Long, ApplicabilityToken> getApplicabilityTokens(BranchId branch1, BranchId branch2);
HashMap<Long, ApplicabilityToken> getApplicabilityTokens(BranchId branch);
+
+ List<FeatureDefinitionData> getFeatureDefinitionData(List<ArtifactReadable> featureDefinitionArts);
} \ No newline at end of file

Back to the top