aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-server/src
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-workflow-designer-server/src')
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecService.java37
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecServiceProxy.java70
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java23
3 files changed, 117 insertions, 13 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecService.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecService.java
new file mode 100644
index 00000000..c1878c0c
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecService.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.sdc.workflowdesigner.externalservice.sdc;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.ActivitySpec;
+
+@Path("")
+public interface ActivitySpecService {
+ @GET
+ @Path("/activity-spec?Filter=Certified")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public ActivitySpec[] getActivitySpecs(
+ @HeaderParam("X-ECOMP-InstanceID") String xEcompInstanceId,
+ @HeaderParam("Authorization") String authorization) throws Exception;
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecServiceProxy.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecServiceProxy.java
new file mode 100644
index 00000000..fa1987ef
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecServiceProxy.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.sdc.workflowdesigner.externalservice.sdc;
+
+import org.glassfish.jersey.client.ClientConfig;
+import org.onap.sdc.workflowdesigner.common.WorkflowDesignerException;
+import org.onap.sdc.workflowdesigner.config.AppConfig;
+import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.ActivitySpec;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.eclipsesource.jaxrs.consumer.ConsumerFactory;
+
+/**
+ *
+ */
+public class ActivitySpecServiceProxy {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SDCService.class);
+
+ private static final String AUTHORIZATION = AppConfig.getSdcServiceProxy().getAuthorization();
+
+ private static final String X_ECOMP_INSTANCE_ID =
+ AppConfig.getSdcServiceProxy().getxEcompInstanceId();
+ /** */
+ private static final String Activity_ROOT_PATH = "/activityspec-api/v1.0";
+
+
+ private static String getActivityRootPath() {
+ return AppConfig.getSdcServiceProxy().getServiceAddr() + Activity_ROOT_PATH;
+ }
+
+ /**
+ * @return
+ */
+ private ActivitySpecService getActivityServiceProxy() {
+ ClientConfig config = new ClientConfig();
+ return ConsumerFactory.createConsumer(getActivityRootPath(), config, ActivitySpecService.class);
+ }
+
+
+ /**
+ *
+ * @return
+ * @throws WorkflowDesignerException
+ */
+ public ActivitySpec[] getActivitySpecs() throws WorkflowDesignerException {
+ ActivitySpecService serviceProxy = getActivityServiceProxy();
+ try {
+ return serviceProxy.getActivitySpecs(X_ECOMP_INSTANCE_ID, AUTHORIZATION);
+ } catch (Exception e) {
+ LOGGER.error("Get Activity Specifications Failed.", e);
+ throw new WorkflowDesignerException("Get Activity Specifications Failed.", e);
+ }
+ }
+
+
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java
index 6319cbf6..b925c03d 100644
--- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java
@@ -32,23 +32,22 @@ public class SDCServiceProxy {
private static final String AUTHORIZATION = AppConfig.getSdcServiceProxy().getAuthorization();
- private static final String X_ECOMP_INSTANCE_ID = AppConfig.getSdcServiceProxy().getxEcompInstanceId();
+ private static final String X_ECOMP_INSTANCE_ID =
+ AppConfig.getSdcServiceProxy().getxEcompInstanceId();
/** */
private static final String SDC_ROOT_PATH = "/sdc/v1";
-
+
private static String getSDCRootPath() {
return AppConfig.getSdcServiceProxy().getServiceAddr() + SDC_ROOT_PATH;
}
-
+
/**
* @return
*/
private SDCService getSDCServiceProxy() {
ClientConfig config = new ClientConfig();
- SDCService sdcServiceProxy =
- ConsumerFactory.createConsumer(getSDCRootPath(), config, SDCService.class);
- return sdcServiceProxy;
+ return ConsumerFactory.createConsumer(getSDCRootPath(), config, SDCService.class);
}
/**
@@ -61,10 +60,9 @@ public class SDCServiceProxy {
*/
public void saveWorkflowArtifact(String uuid, String operationId, String workflowId,
WorkflowArtifactInfo workflowArtifactInfo) throws WorkflowDesignerException {
- SDCService sdcServiceProxy = getSDCServiceProxy();
+ SDCService serviceProxy = getSDCServiceProxy();
try {
- sdcServiceProxy.saveWorkflowArtifact(uuid, operationId, workflowId,
- X_ECOMP_INSTANCE_ID,
+ serviceProxy.saveWorkflowArtifact(uuid, operationId, workflowId, X_ECOMP_INSTANCE_ID,
AUTHORIZATION, workflowArtifactInfo);
} catch (Exception e) {
LOGGER.error("Save WorkflowArtifact Failed.", e);
@@ -82,14 +80,13 @@ public class SDCServiceProxy {
*/
public WorkflowArtifactInfo getWorkflowArtifact(String uuid, String operationId,
String workflowId) throws WorkflowDesignerException {
- SDCService sdcServiceProxy = getSDCServiceProxy();
+ SDCService serviceProxy = getSDCServiceProxy();
try {
- return sdcServiceProxy.getWorkflowArtifact(uuid, operationId, workflowId,
- X_ECOMP_INSTANCE_ID,
+ return serviceProxy.getWorkflowArtifact(uuid, operationId, workflowId, X_ECOMP_INSTANCE_ID,
AUTHORIZATION);
} catch (Exception e) {
LOGGER.error("Get WorkflowArtifact Failed.", e);
- throw new WorkflowDesignerException("Save WorkflowArtifact Failed.", e);
+ throw new WorkflowDesignerException("Get WorkflowArtifact Failed.", e);
}
}