diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-07-24 17:34:04 +0300 |
---|---|---|
committer | vempo <vitaliy.emporopulo@amdocs.com> | 2018-07-25 11:39:10 +0300 |
commit | a52d50e788792a63e97a9176ab319d53db7a2853 (patch) | |
tree | b1c2222cacf4b8192aea16d1e0315b1f005c5347 /sdc-workflow-designer-server/src/main/java | |
parent | 3c2665debb400aef7f0ed9e235698d2ff9f859db (diff) |
Replaced old implementation at root
Old project files and directories has been moved
under 'deprecated-workflow-designer'. The old project
is not built by the CI anymore, but can be still built manually.
New modules/directories have been moved up and integrated with
the CI system.
Change-Id: I1528c792bcbcce9e50bfc294a1328a20e72c91cf
Issue-ID: SDC-1559
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'sdc-workflow-designer-server/src/main/java')
56 files changed, 0 insertions, 4361 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/ActivitySpecServiceProxyInfo.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/ActivitySpecServiceProxyInfo.java deleted file mode 100644 index fb82e506..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/ActivitySpecServiceProxyInfo.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * 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; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - */ -public class ActivitySpecServiceProxyInfo { - private String serviceAddr; - - private String xEcompInstanceId; - - private String authorization; - - private String userId; - - /** - * @return the serviceAddr - */ - @JsonProperty - public String getServiceAddr() { - return serviceAddr; - } - - /** - * @param serviceAddr the serviceAddr to set - */ - @JsonProperty - public void setServiceAddr(String serviceAddr) { - this.serviceAddr = serviceAddr; - } - - /** - * @return the xEcompInstanceId - */ - @JsonProperty - public String getxEcompInstanceId() { - return xEcompInstanceId; - } - - /** - * @param xEcompInstanceId the xEcompInstanceId to set - */ - @JsonProperty - public void setxEcompInstanceId(String xEcompInstanceId) { - this.xEcompInstanceId = xEcompInstanceId; - } - - /** - * @return the authorization - */ - @JsonProperty - public String getAuthorization() { - return authorization; - } - - /** - * @param authorization the authorization to set - */ - @JsonProperty - public void setAuthorization(String authorization) { - this.authorization = authorization; - } - - /** - * @return the userId - */ - @JsonProperty - public String getUserId() { - return userId; - } - - /** - * @param userId the userId to set - */ - @JsonProperty - public void setUserId(String userId) { - this.userId = userId; - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java deleted file mode 100644 index df4d0caa..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- *
- */
-public class SDCServiceProxyInfo {
- private String serviceAddr;
-
- private String xEcompInstanceId;
-
- private String authorization;
-
- /**
- * @return the serviceAddr
- */
- @JsonProperty
- public String getServiceAddr() {
- return serviceAddr;
- }
-
- /**
- * @param serviceAddr the serviceAddr to set
- */
- @JsonProperty
- public void setServiceAddr(String serviceAddr) {
- this.serviceAddr = serviceAddr;
- }
-
- /**
- * @return the xEcompInstanceId
- */
- @JsonProperty
- public String getxEcompInstanceId() {
- return xEcompInstanceId;
- }
-
- /**
- * @param xEcompInstanceId the xEcompInstanceId to set
- */
- @JsonProperty
- public void setxEcompInstanceId(String xEcompInstanceId) {
- this.xEcompInstanceId = xEcompInstanceId;
- }
-
- /**
- * @return the authorization
- */
- @JsonProperty
- public String getAuthorization() {
- return authorization;
- }
-
- /**
- * @param authorization the authorization to set
- */
- @JsonProperty
- public void setAuthorization(String authorization) {
- this.authorization = authorization;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerApp.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerApp.java deleted file mode 100644 index c9e0c40d..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerApp.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (c) 2017-2018 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner; - -import org.onap.sdc.workflowdesigner.config.AdapterType; -import org.onap.sdc.workflowdesigner.config.AppConfig; -import org.onap.sdc.workflowdesigner.resources.ExtendActivityResource; -import org.onap.sdc.workflowdesigner.resources.WorkflowModelerResource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.annotation.JsonInclude; - -import io.dropwizard.Application; -import io.dropwizard.assets.AssetsBundle; -import io.dropwizard.server.SimpleServerFactory; -import io.dropwizard.setup.Bootstrap; -import io.dropwizard.setup.Environment; -import io.swagger.jaxrs.config.BeanConfig; -import io.swagger.jaxrs.listing.ApiListingResource; - -public class WorkflowDesignerApp extends Application<WorkflowDesignerConfiguration> { - private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowDesignerApp.class); - - public static void main(String[] args) throws Exception { - new WorkflowDesignerApp().run(args); - } - - @Override - public String getName() { - return "Workflow Designer"; - } - - @Override - public void initialize(Bootstrap<WorkflowDesignerConfiguration> bootstrap) { - bootstrap.addBundle(new AssetsBundle("/api-doc", "/api-doc", "index.html", "api-doc")); - bootstrap.addBundle(new AssetsBundle("/workflow-modeler", "/workflow-modeler", "index.html", - "workflow-modeler")); - bootstrap.addBundle(new AssetsBundle("/workflow-modeler", "/", "index.html", "ng")); - } - - @Override - public void run(WorkflowDesignerConfiguration configuration, Environment environment) { - LOGGER.info("Start to initialize Workflow Designer."); - - saveAppConfig(configuration); - - environment.jersey().register(new WorkflowModelerResource()); - environment.jersey().register(new ExtendActivityResource()); - - // register rest interface - environment.jersey().packages("org.onap.sdc.workflowdesigner.resources"); - - initSwaggerConfig(environment, configuration); - - LOGGER.info("Initialize catalogue finished."); - } - - /** - * @param configuration - */ - private void saveAppConfig(WorkflowDesignerConfiguration configuration) { - AppConfig.setAdapterType(AdapterType.valueOf(configuration.getAdapterType())); - AppConfig.setSdcServiceProxy(configuration.getSdcServiceProxy()); - AppConfig.setActivitySpecServiceProxy(configuration.getActivitySpecServiceProxy()); - } - - /** - * initialize swagger configuration. - * - * @param environment environment information - * @param configuration catalogue configuration - */ - private void initSwaggerConfig(Environment environment, - WorkflowDesignerConfiguration configuration) { - environment.jersey().register(new ApiListingResource()); - environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); - - BeanConfig config = new BeanConfig(); - config.setTitle("Workflow Designer rest API"); - config.setVersion("1.0.0"); - config.setResourcePackage("org.onap.sdc.workflowdesigner.resources"); - - // set rest api basepath in swagger - SimpleServerFactory simpleServerFactory = - (SimpleServerFactory) configuration.getServerFactory(); - String basePath = simpleServerFactory.getApplicationContextPath(); - String rootPath = simpleServerFactory.getJerseyRootPath().get(); - rootPath = rootPath.substring(0, rootPath.indexOf("/*")); - basePath = basePath.equals("/") ? rootPath - : (new StringBuilder()).append(basePath).append(rootPath).toString(); - config.setBasePath(basePath); - config.setScan(true); - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerConfiguration.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerConfiguration.java deleted file mode 100644 index 4c6766be..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerConfiguration.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Copyright (c) 2017-2018 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.dropwizard.Configuration; - -public class WorkflowDesignerConfiguration extends Configuration { - private String template; - - private String defaultName = "Workflow Designer"; - - private String adapterType; - - @NotNull - private SDCServiceProxyInfo sdcServiceProxy; - - @NotNull - private ActivitySpecServiceProxyInfo activitySpecServiceProxy; - - - @JsonProperty - public String getTemplate() { - return template; - } - - @JsonProperty - public void setTemplate(String template) { - this.template = template; - } - - @JsonProperty - public String getDefaultName() { - return defaultName; - } - - @JsonProperty - public void setDefaultName(String name) { - this.defaultName = name; - } - - /** - * @return the adapterType - */ - @JsonProperty - public String getAdapterType() { - return adapterType; - } - - /** - * @param adapterType the adapterType to set - */ - @JsonProperty - public void setAdapterType(String adapterType) { - this.adapterType = adapterType; - } - - /** - * @return the sdcServiceProxy - */ - @JsonProperty - public SDCServiceProxyInfo getSdcServiceProxy() { - return sdcServiceProxy; - } - - /** - * @param sdcServiceProxy the sdcServiceProxy to set - */ - @JsonProperty - public void setSdcServiceProxy(SDCServiceProxyInfo sdcServiceProxy) { - this.sdcServiceProxy = sdcServiceProxy; - } - - /** - * @return the activitySpecServiceProxy - */ - @JsonProperty - public ActivitySpecServiceProxyInfo getActivitySpecServiceProxy() { - return activitySpecServiceProxy; - } - - /** - * @param activitySpecServiceProxy the activitySpecServiceProxy to set - */ - @JsonProperty - public void setActivitySpecServiceProxy(ActivitySpecServiceProxyInfo activitySpecServiceProxy) { - this.activitySpecServiceProxy = activitySpecServiceProxy; - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/common/ActivitySpecProxyException.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/common/ActivitySpecProxyException.java deleted file mode 100644 index bc3cf4b6..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/common/ActivitySpecProxyException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * 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.common; - -public class ActivitySpecProxyException extends Exception { - - private static final long serialVersionUID = 1L; - - public ActivitySpecProxyException() { - super(); - } - - public ActivitySpecProxyException(String msg, Exception e) { - super(msg, e); - } - - public ActivitySpecProxyException(String msg) { - super(msg); - } -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/common/SDCProxyException.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/common/SDCProxyException.java deleted file mode 100644 index 8f596b0c..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/common/SDCProxyException.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.common; - -public class SDCProxyException extends Exception { - - private static final long serialVersionUID = 1L; - - public SDCProxyException() { - super(); - } - - public SDCProxyException(String msg, Exception e) { - super(msg, e); - } - - public SDCProxyException(String msg) { - super(msg); - } -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AdapterType.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AdapterType.java deleted file mode 100644 index 6f9c291b..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AdapterType.java +++ /dev/null @@ -1,20 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.config;
-
-/**
- *
- */
-public enum AdapterType {
- DEFAULT, SDC
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AppConfig.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AppConfig.java deleted file mode 100644 index a6f72be0..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AppConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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.config; - -import org.onap.sdc.workflowdesigner.SDCServiceProxyInfo; -import org.onap.sdc.workflowdesigner.ActivitySpecServiceProxyInfo; - -/** - * - */ -public class AppConfig { - private static AdapterType adapterType; - - private static SDCServiceProxyInfo sdcServiceProxy; - - private static ActivitySpecServiceProxyInfo activitySpecServiceProxy; - - private AppConfig() {} - - /** - * @return the adapterType - */ - public static AdapterType getAdapterType() { - return adapterType; - } - - /** - * @param adapterType the adapterType to set - */ - public static void setAdapterType(AdapterType adapterType) { - AppConfig.adapterType = adapterType; - } - - /** - * @param sdcServiceProxy - */ - public static void setSdcServiceProxy(SDCServiceProxyInfo sdcServiceProxy) { - AppConfig.sdcServiceProxy = sdcServiceProxy; - } - - /** - * @return the sdcServiceProxy - */ - public static SDCServiceProxyInfo getSdcServiceProxy() { - return sdcServiceProxy; - } - - /** - * @return - */ - public static boolean isSDCAdapter() { - return adapterType.equals(AdapterType.SDC); - } - - /** - * @param activitySpecServiceProxy - */ - public static void setActivitySpecServiceProxy(ActivitySpecServiceProxyInfo activitySpecServiceProxy) { - AppConfig.activitySpecServiceProxy = activitySpecServiceProxy; - } - - /** - * @return the activitySpecServiceProxy - */ - public static ActivitySpecServiceProxyInfo getActivitySpecServiceProxy() { - return activitySpecServiceProxy; - } -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java deleted file mode 100644 index 91cd4983..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java +++ /dev/null @@ -1,54 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.config;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Config {
- private static Logger log = LoggerFactory.getLogger(Config.class);
- private static String configFilePath = "bpmn.config.properties";
- public final static String HANDLER_ClASS = "handlerClass";
- public final static String TEMPLATE_PATH = "templatePath";
-
- public final static Properties PROPERTIES = load();
-
- public static Properties load() {
- Properties properties = new Properties();
- InputStream in = null;
- try {
- in = Config.class.getClassLoader().getResourceAsStream(configFilePath);
- properties.load(in);
- } catch (FileNotFoundException e) {
- log.error(configFilePath, e);
- } catch (IOException e) {
- log.error(configFilePath, e);
- } catch (Exception e) {
- log.error(configFilePath, e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- log.error(configFilePath, e);
- }
- }
- }
-
- return properties;
- }
-}
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 deleted file mode 100644 index b85d6d0b..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecService.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.ActivitySpec; -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.GenericCollectionWrapper; - -@Path("") -public interface ActivitySpecService { - @GET - @Path("/activity-spec?Filter=Certified") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public GenericCollectionWrapper getActivitySpecs( - @HeaderParam("USER_ID") String userId, - @HeaderParam("X-ECOMP-InstanceID") String xEcompInstanceId, - @HeaderParam("Authorization") String authorization) throws Exception; - - @GET - @Path("/activity-spec/{id}/versions/{versionId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public ActivitySpec getActivitySpec( - @HeaderParam("USER_ID") String userId, - @HeaderParam("X-ECOMP-InstanceID") String xEcompInstanceId, - @HeaderParam("Authorization") String authorization, - @PathParam("versionId") String versionId, - @PathParam("id") String id) 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 deleted file mode 100644 index e210e872..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/ActivitySpecServiceProxy.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * 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 java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import org.glassfish.jersey.client.ClientConfig; -import org.onap.sdc.workflowdesigner.common.ActivitySpecProxyException; -import org.onap.sdc.workflowdesigner.config.AppConfig; -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.ActivitySpec; -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.GenericCollectionWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.eclipsesource.jaxrs.consumer.ConsumerFactory; - -/** - * - */ -public class ActivitySpecServiceProxy { - private static final Logger LOGGER = LoggerFactory.getLogger(ActivitySpecServiceProxy.class); - - private static final String AUTHORIZATION = AppConfig.getActivitySpecServiceProxy().getAuthorization(); - - private static final String X_ECOMP_INSTANCE_ID = AppConfig.getActivitySpecServiceProxy().getxEcompInstanceId(); - - private static final String USER_ID = AppConfig.getActivitySpecServiceProxy().getUserId(); - - /** */ - private static final String ACTIVITY_ROOT_PATH = "/activity-spec-api/v1.0"; - - private static final String ACTIVITY_SPEC_VERSION_ID_DEFAULT_VALUE = "latest"; - - private static String getActivityRootPath() { - return AppConfig.getActivitySpecServiceProxy().getServiceAddr() + ACTIVITY_ROOT_PATH; - } - - /** - * @return - */ - private ActivitySpecService getActivitySpecServiceProxy() { - ClientConfig config = new ClientConfig(); - return ConsumerFactory.createConsumer(getActivityRootPath(), config, ActivitySpecService.class); - } - - - /** - * - * @return - * @throws ActivitySpecProxyException - */ - public ActivitySpec[] getActivitySpecs() throws ActivitySpecProxyException { - ActivitySpecService serviceProxy = getActivitySpecServiceProxy(); - List<ActivitySpec> activitySpecList = new ArrayList<>(); - try { - GenericCollectionWrapper activityCollection = serviceProxy.getActivitySpecs(USER_ID, X_ECOMP_INSTANCE_ID, AUTHORIZATION); - for (Object obj : activityCollection.getResults()) { - if (obj instanceof Map){ - Map activitySpecMap = (Map) obj; - String activitySpecId = activitySpecMap.get("id").toString(); - ActivitySpec activitySpec = serviceProxy.getActivitySpec(USER_ID, X_ECOMP_INSTANCE_ID, AUTHORIZATION, ACTIVITY_SPEC_VERSION_ID_DEFAULT_VALUE, activitySpecId); - activitySpec.setId(activitySpecId); - activitySpecList.add(activitySpec); - } - } - } catch (Exception e) { - LOGGER.error("Get Activity Specifications Failed.", e); - throw new ActivitySpecProxyException("Get Activity Specifications Failed.", e); - } - return activitySpecList.toArray(new ActivitySpec[activitySpecList.size()]); - } - - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCService.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCService.java deleted file mode 100644 index d5a55669..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCService.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.WorkflowArtifactInfo; - -@Path("/catalog") -public interface SDCService { - @POST - @Path("/resource/{uuid}/interfaces/{operationID}/artifacts/{id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void saveWorkflowArtifact(@PathParam("uuid") String uuid, - @PathParam("operationID") String operationId, @PathParam("id") String workflowId, - @HeaderParam("X-ECOMP-InstanceID") String xEcompInstanceId, - @HeaderParam("Authorization") String authorization, - WorkflowArtifactInfo workflowArtifactInfo) throws Exception; - - - @GET - @Path("/resource/{uuid}/interfaces/{operationID}/artifacts/{id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public WorkflowArtifactInfo getWorkflowArtifact(@PathParam("uuid") String uuid, - @PathParam("operationID") String operationId, @PathParam("id") String workflowId, - @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/SDCServiceProxy.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java deleted file mode 100644 index 374bca7a..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright 2017-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.SDCProxyException; -import org.onap.sdc.workflowdesigner.config.AppConfig; -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.WorkflowArtifactInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.eclipsesource.jaxrs.consumer.ConsumerFactory; - -/** - * - */ -public class SDCServiceProxy { - 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 SDC_ROOT_PATH = "/sdc/v1"; - - - private static String getSDCRootPath() { - return AppConfig.getSdcServiceProxy().getServiceAddr() + SDC_ROOT_PATH; - } - - /** - * @return - */ - private SDCService getSDCServiceProxy() { - ClientConfig config = new ClientConfig(); - return ConsumerFactory.createConsumer(getSDCRootPath(), config, SDCService.class); - } - - /** - * - * @param uuid - * @param operationId - * @param workflowId - * @param workflowArtifactInfo - * @throws SDCProxyException - */ - public void saveWorkflowArtifact(String uuid, String operationId, String workflowId, - WorkflowArtifactInfo workflowArtifactInfo) throws SDCProxyException { - SDCService serviceProxy = getSDCServiceProxy(); - try { - serviceProxy.saveWorkflowArtifact(uuid, operationId, workflowId, X_ECOMP_INSTANCE_ID, - AUTHORIZATION, workflowArtifactInfo); - } catch (Exception e) { - LOGGER.error("Save WorkflowArtifact Failed.", e); - throw new SDCProxyException("Save WorkflowArtifact Failed.", e); - } - } - - /** - * - * @param uuid - * @param operationId - * @param workflowId - * @return - * @throws SDCProxyException - */ - public WorkflowArtifactInfo getWorkflowArtifact(String uuid, String operationId, - String workflowId) throws SDCProxyException { - SDCService serviceProxy = getSDCServiceProxy(); - try { - return serviceProxy.getWorkflowArtifact(uuid, operationId, workflowId, X_ECOMP_INSTANCE_ID, - AUTHORIZATION); - } catch (Exception e) { - LOGGER.error("Get WorkflowArtifact Failed.", e); - throw new SDCProxyException("Get WorkflowArtifact Failed.", e); - } - } - - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContent.java deleted file mode 100644 index 66208a2c..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivityContent.java +++ /dev/null @@ -1,59 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.externalservice.sdc.entity;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.gson.annotations.SerializedName;
-
-/**
- *
- */
-public class ActivityContent {
- @JsonProperty(value="class") // for dropwizard's Jackson
- @SerializedName("class") // for Gson
- public String clazz;
-
- private String scriptFormat;
-
- private String script;
-
-
- /**
- * @return the scriptFormat
- */
- public String getScriptFormat() {
- return scriptFormat;
- }
-
- /**
- * @param scriptFormat the scriptFormat to set
- */
- public void setScriptFormat(String scriptFormat) {
- this.scriptFormat = scriptFormat;
- }
-
- /**
- * @return the script
- */
- public String getScript() {
- return script;
- }
-
- /**
- * @param script the script to set
- */
- public void setScript(String script) {
- this.script = script;
- }
-
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpec.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpec.java deleted file mode 100644 index 942afcab..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/ActivitySpec.java +++ /dev/null @@ -1,179 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.externalservice.sdc.entity;
-
-/**
- *
- */
-public class ActivitySpec {
- private String id;
-
- private String versionId;
-
- private String name;
-
- private String description;
-
- private String type;
-
- private String content;
-
- private String[] categoryList;
-
- private Parameter[] inputs;
-
- private Parameter[] outputs;
-
- private String status;
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return the versionId
- */
- public String getVersionId() {
- return versionId;
- }
-
- /**
- * @param versionId the versionId to set
- */
- public void setVersionId(String versionId) {
- this.versionId = versionId;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the content
- */
- public String getContent() {
- return content;
- }
-
- /**
- * @param content the content to set
- */
- public void setContent(String content) {
- this.content = content;
- }
-
- /**
- * @return the categoryList
- */
- public String[] getCategoryList() {
- return categoryList;
- }
-
- /**
- * @param categoryList the categoryList to set
- */
- public void setCategoryList(String[] categoryList) {
- this.categoryList = categoryList;
- }
-
- /**
- * @return the inputs
- */
- public Parameter[] getInputs() {
- return inputs;
- }
-
- /**
- * @param inputs the inputs to set
- */
- public void setInputs(Parameter[] inputs) {
- this.inputs = inputs;
- }
-
- /**
- * @return the outputs
- */
- public Parameter[] getOutputs() {
- return outputs;
- }
-
- /**
- * @param outputs the outputs to set
- */
- public void setOutputs(Parameter[] outputs) {
- this.outputs = outputs;
- }
-
- /**
- * @return the status
- */
- public String getStatus() {
- return status;
- }
-
- /**
- * @param status the status to set
- */
- public void setStatus(String status) {
- this.status = status;
- }
-
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/GenericCollectionWrapper.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/GenericCollectionWrapper.java deleted file mode 100644 index 59813605..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/GenericCollectionWrapper.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * 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.entity; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -public class GenericCollectionWrapper<T> implements Serializable { - private static final long serialVersionUID = 1L; - - private transient List<T> results; - private int listCount; - - public GenericCollectionWrapper() { - this.results = new ArrayList<>(); - } - - /** - * Instantiates a new Generic collection wrapper. - * - * @param list the list - */ - public GenericCollectionWrapper(List<T> list) { - if (!list.isEmpty()) { - this.results = list; - this.listCount = list.size(); - } - } - - public List<T> getResults() { - return results; - } - - public void setResults(List<T> results) { - this.results = results; - } - - public int getListCount() { - return listCount; - } - - public void setListCount(int listCount) { - this.listCount = listCount; - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java deleted file mode 100644 index 8a1aaf14..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/Parameter.java +++ /dev/null @@ -1,87 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.externalservice.sdc.entity;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- *
- */
-public class Parameter {
- private String name;
-
- private String type;
-
- @SerializedName("default")
- private String defaultValue;
-
- private String value;
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the defaultValue
- */
- public String getDefault() {
- return defaultValue;
- }
-
- /**
- * @param defaultValue the defaultValue to set
- */
- public void setDefault(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/WorkflowArtifactInfo.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/WorkflowArtifactInfo.java deleted file mode 100644 index e2cab05e..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/entity/WorkflowArtifactInfo.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * 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.entity; - -import java.io.Serializable; - -public class WorkflowArtifactInfo implements Serializable { - public static final long serialVersionUID = 1L; - - private String artifactName; - - private String description; - - private String artifactType = "WORKFLOW"; - - private String payloadData; - - public WorkflowArtifactInfo(String artifactName, String description, - String payloadData) { - super(); - this.artifactName = artifactName; - this.description = description; - this.payloadData = payloadData; - } - - /** - * @return the artifactName - */ - public String getArtifactName() { - return artifactName; - } - - /** - * @param artifactName the artifactName to set - */ - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the artifactType - */ - public String getArtifactType() { - return artifactType; - } - - /** - * @param artifactType the artifactType to set - */ - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; - } - - /** - * @return the payloadData - */ - public String getPayloadData() { - return payloadData; - } - - /** - * @param payloadData the payloadData to set - */ - public void setPayloadData(String payloadData) { - this.payloadData = payloadData; - } - - /** - * @return the serialversionuid - */ - public static long getSerialversionuid() { - return serialVersionUID; - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/DataObject.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/DataObject.java deleted file mode 100644 index 0ae76b5b..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/DataObject.java +++ /dev/null @@ -1,42 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class DataObject {
- private String id;
- private String name;
- private String value;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Element.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Element.java deleted file mode 100644 index 762d480b..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Element.java +++ /dev/null @@ -1,85 +0,0 @@ -/**
- * Copyright (c) 2017-2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-import java.util.List;
-
-public class Element {
- public enum TYPE {
- startEvent,
- endEvent,
- errorStartEvent,
- errorEndEvent,
- serviceTask,
- scriptTask,
- exclusiveGateway,
- parallelGateway,
- restTask,
- intermediateCatchEvent
- };
-
- private String id;
- private String name;
- private TYPE type;
- private String documentation;
- private Position position;
- private List<String> connections;
-
- public String getId() {
- return id;
- }
-
- public Position getPosition() {
- return position;
- }
-
- public void setPosition(Position position) {
- this.position = position;
- }
-
- public List<String> getConnections() {
- return connections;
- }
-
- public void setConnections(List<String> connections) {
- this.connections = connections;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDocumentation() {
- return documentation;
- }
-
- public void setDocumentation(String documentation) {
- this.documentation = documentation;
- }
-
- public TYPE getType() {
- return type;
- }
-
- public void setType(TYPE type) {
- this.type = type;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java deleted file mode 100644 index c25e623e..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class EndEvent extends Element {
- public final static String TYPE = "endEvent";
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorEndEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorEndEvent.java deleted file mode 100644 index 0fda8c27..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorEndEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2017 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ -package org.onap.sdc.workflowdesigner.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ErrorEndEvent extends Element { - @JsonProperty("parameter") - private Parameter parameter; - - public Parameter getParameter() { - return parameter; - } - - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorStartEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorStartEvent.java deleted file mode 100644 index b4cf96c0..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorStartEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2017 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ -package org.onap.sdc.workflowdesigner.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ErrorStartEvent extends Element { - @JsonProperty("parameter") - private Parameter parameter; - - public Parameter getParameter() { - return parameter; - } - - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ExclusiveGateway.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ExclusiveGateway.java deleted file mode 100644 index 77bc28c0..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ExclusiveGateway.java +++ /dev/null @@ -1,16 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class ExclusiveGateway extends Element {
- public final static String TYPE = "exclusiveGateway";
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/IntermediateCatchEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/IntermediateCatchEvent.java deleted file mode 100644 index ae6260c4..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/IntermediateCatchEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class IntermediateCatchEvent extends Element {
- private TimerEventDefinition timerEventDefinition;
-
- public TimerEventDefinition getTimerEventDefinition() {
- return timerEventDefinition;
- }
-
- public void setTimerEventDefinition(TimerEventDefinition timerEventDefinition) {
- this.timerEventDefinition = timerEventDefinition;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ParallelGateway.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ParallelGateway.java deleted file mode 100644 index b56aa33d..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ParallelGateway.java +++ /dev/null @@ -1,16 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class ParallelGateway extends Element {
- public final static String TYPE = "parallelGateway";
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Parameter.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Parameter.java deleted file mode 100644 index cf4c651f..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Parameter.java +++ /dev/null @@ -1,103 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class Parameter {
- private static Logger log = LoggerFactory.getLogger(Parameter.class);
- private String description = "";
- private String name;
- private String position;
- private boolean required;
- private String type;
-
- // body parameter may be a json object
- private Object value;
-
- @JsonInclude(Include.NON_NULL)
- private String valueSource;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getPosition() {
- return position;
- }
-
- public void setPosition(String position) {
- this.position = position;
- }
-
- public boolean isRequired() {
- return required;
- }
-
- public void setRequired(boolean required) {
- this.required = required;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- public String getValueSource() {
- return valueSource;
- }
-
- public void setValueSource(String valueSource) {
- this.valueSource = valueSource;
- }
-
- public String toString() {
- ObjectMapper mapper = new ObjectMapper();
- String result = null;
- try {
- result = mapper.writeValueAsString(this);
- } catch (JsonProcessingException e) {
- log.error("fail to convert parameter to json string", e);
- }
- return result;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Position.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Position.java deleted file mode 100644 index a409dd82..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Position.java +++ /dev/null @@ -1,33 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class Position {
- private int left;
- private int top;
-
- public int getLeft() {
- return left;
- }
-
- public void setLeft(int left) {
- this.left = left;
- }
-
- public int getTop() {
- return top;
- }
-
- public void setTop(int top) {
- this.top = top;
- }
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Process.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Process.java deleted file mode 100644 index 6413ad67..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Process.java +++ /dev/null @@ -1,67 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Process {
- private String id;
- private boolean isExecutable;
- private List<Element> elementList = new ArrayList<Element>();
- private List<SequenceFlow> sequenceFlowList = new ArrayList<SequenceFlow>();
- private List<DataObject> dataObjectList = new ArrayList<DataObject>();
-
- public Process(String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public boolean isExecutable() {
- return isExecutable;
- }
-
- public void setExecutable(boolean isExecutable) {
- this.isExecutable = isExecutable;
- }
-
- public List<Element> getElementList() {
- return elementList;
- }
-
- public void setElementList(List<Element> elementList) {
- this.elementList = elementList;
- }
-
- public List<SequenceFlow> getSequenceFlowList() {
- return sequenceFlowList;
- }
-
- public void setSequenceFlowList(List<SequenceFlow> sequenceFlowList) {
- this.sequenceFlowList = sequenceFlowList;
- }
-
- public List<DataObject> getDataObjectList() {
- return dataObjectList;
- }
-
- public void setDataObjectList(List<DataObject> dataObjectList) {
- this.dataObjectList = dataObjectList;
- }
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/RestServiceTask.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/RestServiceTask.java deleted file mode 100644 index 8a8da55a..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/RestServiceTask.java +++ /dev/null @@ -1,95 +0,0 @@ -/**
- * Copyright (c) 2017-2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-import java.util.List;
-
-import org.onap.sdc.workflowdesigner.config.Config;
-
-public class RestServiceTask extends ServiceTask {
- private static String handler = Config.PROPERTIES.getProperty(Config.HANDLER_ClASS);
-
-// private String restConfigId;
-// public String getRestConfigId() {
-// return restConfigId;
-// }
-// public void setRestConfigId(String restConfigId) {
-// this.restConfigId = restConfigId;
-// }
- private List<String> produces;
- private List<String> consumes;
-
-
- private List<Parameter> parameters;
- private String baseUrl;
- private String serviceName;
- private String serviceVersion;
- private String path;
- private String method;
-
- public String getBaseUrl() {
- return baseUrl;
- }
- public void setBaseUrl(String url) {
- this.baseUrl = url;
- }
-
- public String getMethod() {
- return method;
- }
-
- public static String getHandler() {
- return handler;
- }
- public static void setHandler(String handler) {
- RestServiceTask.handler = handler;
- }
- public void setMethod(String method) {
- this.method = method;
- }
- public List<String> getProduces() {
- return produces;
- }
- public void setProduces(List<String> produces) {
- this.produces = produces;
- }
- public List<String> getConsumes() {
- return consumes;
- }
- public void setConsumes(List<String> consumes) {
- this.consumes = consumes;
- }
- public List<Parameter> getParameters() {
- return parameters;
- }
- public void setParameters(List<Parameter> parameters) {
- this.parameters = parameters;
- }
- public String getServiceName() {
- return serviceName;
- }
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
- public String getServiceVersion() {
- return serviceVersion;
- }
- public void setServiceVersion(String serviceVersion) {
- this.serviceVersion = serviceVersion;
- }
- public String getPath() {
- return path;
- }
- public void setPath(String path) {
- this.path = path;
- }
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ScriptTask.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ScriptTask.java deleted file mode 100644 index 3ccba04e..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ScriptTask.java +++ /dev/null @@ -1,33 +0,0 @@ -/**
- * Copyright (c) 2017-2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class ScriptTask extends Element {
- private String scriptFormat;
- private String script;
-
- public String getScriptFormat() {
- return scriptFormat;
- }
-
- public void setScriptFormat(String scriptFormat) {
- this.scriptFormat = scriptFormat;
- }
-
- public String getScript() {
- return script;
- }
-
- public void setScript(String script) {
- this.script = script;
- }
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/SequenceFlow.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/SequenceFlow.java deleted file mode 100644 index 5fb6ba2c..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/SequenceFlow.java +++ /dev/null @@ -1,70 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class SequenceFlow {
- private String id = "";
- private String name;
- private String sourceRef;
- private String targetRef;
- private String documentation;
- private String condition;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getSourceRef() {
- return sourceRef;
- }
-
- public void setSourceRef(String sourceRef) {
- this.sourceRef = sourceRef;
- }
-
- public String getTargetRef() {
- return targetRef;
- }
-
- public void setTargetRef(String targetRef) {
- this.targetRef = targetRef;
- }
-
- public String getDocumentation() {
- return documentation;
- }
-
- public void setDocumentation(String documentation) {
- this.documentation = documentation;
- }
-
- public String getCondition() {
- return condition;
- }
-
- public void setCondition(String condition) {
- this.condition = condition;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ServiceTask.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ServiceTask.java deleted file mode 100644 index 90bc5d0e..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ServiceTask.java +++ /dev/null @@ -1,44 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-import java.util.List;
-
-public class ServiceTask extends Element {
- private String className;
- private List<Parameter> inputs;
- private List<Parameter> outputs;
-
- public String getClassName() {
- return className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public List<Parameter> getInputs() {
- return inputs;
- }
-
- public void setInputs(List<Parameter> inputs) {
- this.inputs = inputs;
- }
-
- public List<Parameter> getOutputs() {
- return outputs;
- }
-
- public void setOutputs(List<Parameter> outputs) {
- this.outputs = outputs;
- }
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/StartEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/StartEvent.java deleted file mode 100644 index b24b0e22..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/StartEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/**
- * Copyright (c) 2017-2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class StartEvent extends Element {
- @JsonProperty("parameters")
- private List<Parameter> parameters;
-
- public List<Parameter> getParameters() {
- return parameters;
- }
-
- public void setParameters(List<Parameter> parameters) {
- this.parameters = parameters;
- }
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/TimerEventDefinition.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/TimerEventDefinition.java deleted file mode 100644 index c7b4b829..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/TimerEventDefinition.java +++ /dev/null @@ -1,52 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.model;
-
-public class TimerEventDefinition {
- private String type;
- private String timeDuration;
- private String timeDate;
- private String timeCycle;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getTimeDuration() {
- return timeDuration;
- }
-
- public void setTimeDuration(String timeDuration) {
- this.timeDuration = timeDuration;
- }
-
- public String getTimeDate() {
- return timeDate;
- }
-
- public void setTimeDate(String timeDate) {
- this.timeDate = timeDate;
- }
-
- public String getTimeCycle() {
- return timeCycle;
- }
-
- public void setTimeCycle(String timeCycle) {
- this.timeCycle = timeCycle;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java deleted file mode 100644 index e98acfb7..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java +++ /dev/null @@ -1,216 +0,0 @@ -/**
- * Copyright (c) 2017-2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.parser;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.onap.sdc.workflowdesigner.model.DataObject;
-import org.onap.sdc.workflowdesigner.model.Element;
-import org.onap.sdc.workflowdesigner.model.EndEvent;
-import org.onap.sdc.workflowdesigner.model.ErrorEndEvent;
-import org.onap.sdc.workflowdesigner.model.ErrorStartEvent;
-import org.onap.sdc.workflowdesigner.model.ExclusiveGateway;
-import org.onap.sdc.workflowdesigner.model.IntermediateCatchEvent;
-import org.onap.sdc.workflowdesigner.model.ParallelGateway;
-import org.onap.sdc.workflowdesigner.model.Parameter;
-import org.onap.sdc.workflowdesigner.model.Process;
-import org.onap.sdc.workflowdesigner.model.RestServiceTask;
-import org.onap.sdc.workflowdesigner.model.ScriptTask;
-import org.onap.sdc.workflowdesigner.model.SequenceFlow;
-import org.onap.sdc.workflowdesigner.model.ServiceTask;
-import org.onap.sdc.workflowdesigner.model.StartEvent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-public class Bpmn4ToscaJsonParser {
-
- private static Logger log = LoggerFactory.getLogger(Bpmn4ToscaJsonParser.class);
-
- private static ObjectMapper MAPPER = new ObjectMapper();
-
- private Map<String, JsonNode> restConfigMap = new HashMap<String, JsonNode>();
-
- static {
- MAPPER.enable(SerializationFeature.INDENT_OUTPUT);
- MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- }
-
- public Process parse(String processName, URI jsonFileUrl)
- throws JsonParseException, JsonMappingException, MalformedURLException, IOException {
- Process process = new Process(processName);
-
- JsonNode rootNode = MAPPER.readValue(jsonFileUrl.toURL(), JsonNode.class);
-
- log.debug("Creating Process models...");
-// JsonNode nodes = rootNode.get(JsonKeys.NODES);
- JsonNode data = rootNode.get(JsonKeys.DATA);
- if(null == data) {
- return process;
- }
- JsonNode nodes = data.get(JsonKeys.NODES);
- if (nodes == null) {
- return process;
- }
-
- this.loadConfigs(rootNode.get(JsonKeys.CONFIGS));
-
- Iterator<JsonNode> iter = nodes.iterator();
- while (iter.hasNext()) {
- JsonNode jsonNode = (JsonNode) iter.next();
-
- // get element
- Element element = createElementFromJson(jsonNode);
- process.getElementList().add(element);
-
- // get sequence flows
- List<SequenceFlow> flowList = getSequenceFlows(jsonNode);
- process.getSequenceFlowList().addAll(flowList);
-
- // add dataObject
- if (element instanceof StartEvent) {
- List<DataObject> dataObjects = this.getDataObject((StartEvent) element);
- process.getDataObjectList().addAll(dataObjects);
- }
- }
-
- return process;
-
- }
-
- private List<DataObject> getDataObject(StartEvent startEvent) {
- List<DataObject> dataObjects = new ArrayList<DataObject>();
-
- for (Parameter parameter : startEvent.getParameters()) {
- DataObject dataObject = new DataObject();
- dataObject.setId(parameter.getName());
- dataObject.setName(parameter.getName());
- dataObject.setValue((String) parameter.getValue());
-
- dataObjects.add(dataObject);
- }
-
- return dataObjects;
- }
-
- private void loadConfigs(JsonNode config) {
- if(config == null) {
- return;
- }
- loadRestConfigs(config.get(JsonKeys.REST_CONFIGS));
- }
-
- private void loadRestConfigs(JsonNode restConfigs) {
- if(restConfigs == null) {
- return;
- }
-
- Iterator<JsonNode> iter = restConfigs.iterator();
- while (iter.hasNext()) {
- JsonNode restConfig = (JsonNode) iter.next();
-
- String configId = getValueFromJsonNode(restConfig, JsonKeys.ID);
- restConfigMap.put(configId, restConfig);
- }
- }
-
- private List<SequenceFlow> getSequenceFlows(JsonNode jsonNode) {
- List<SequenceFlow> flowList = new ArrayList<SequenceFlow>();
- String elementId = getValueFromJsonNode(jsonNode, JsonKeys.ID);
- JsonNode connectionsNode = jsonNode.get(JsonKeys.CONNECTIONS);
-
- Iterator<JsonNode> iter = connectionsNode.iterator();
- while (iter.hasNext()) {
- JsonNode connectionEntry = (JsonNode) iter.next();
- String targetRef = getValueFromJsonNode(connectionEntry, JsonKeys.TARGET_REF);
- String condition = getValueFromJsonNode(connectionEntry, JsonKeys.CONDITION);
- SequenceFlow flow = new SequenceFlow();
- flow.setId(elementId + targetRef);
- flow.setSourceRef(elementId);
- flow.setTargetRef(targetRef);
- flow.setCondition(condition);
- flowList.add(flow);
- }
-
- return flowList;
- }
-
- protected Element createElementFromJson(JsonNode jsonNode)
- throws JsonParseException, JsonMappingException, IOException {
- String jsonObject = jsonNode.toString();
- Element element;
-
- String nodeType = getValueFromJsonNode(jsonNode, JsonKeys.TYPE);
- if (nodeType == null) {
- log.warn("Ignoring node: type is null");
- return null;
- }
-
- switch (nodeType) {
- case "startEvent":
- element = MAPPER.readValue(jsonObject, StartEvent.class);
- break;
- case "endEvent":
- element = MAPPER.readValue(jsonObject, EndEvent.class);
- break;
- case "errorStartEvent":
- element = MAPPER.readValue(jsonObject, ErrorStartEvent.class);
- break;
- case "errorEndEvent":
- element = MAPPER.readValue(jsonObject, ErrorEndEvent.class);
- break;
- case "intermediateCatchEvent":
- element = MAPPER.readValue(jsonObject, IntermediateCatchEvent.class);
- break;
- case "serviceTask":
- element = MAPPER.readValue(jsonObject, ServiceTask.class);
- break;
- case "restTask":
- // element = this.createRestServiceTask(jsonObject);
- element = MAPPER.readValue(jsonObject, RestServiceTask.class);
- break;
- case "scriptTask":
- element = MAPPER.readValue(jsonObject, ScriptTask.class);
- break;
- case "exclusiveGateway":
- element = MAPPER.readValue(jsonObject, ExclusiveGateway.class);
- break;
- case "parallelGateway":
- element = MAPPER.readValue(jsonObject, ParallelGateway.class);
- break;
- default:
- log.warn("Ignoring node: type '" + nodeType + "' is unkown");
- return null;
- }
-
- return element;
- }
-
-
- private String getValueFromJsonNode(JsonNode jsonNode, String key) {
- return jsonNode.get(key) == null ? null : jsonNode.get(key).asText();
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/JsonKeys.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/JsonKeys.java deleted file mode 100644 index 92390395..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/JsonKeys.java +++ /dev/null @@ -1,92 +0,0 @@ -/**
- * Copyright (c) 2017-2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.parser;
-
-public interface JsonKeys {
-
-
- /*
- * Field names of BPMN4Tosca Model
- */
- public static final String DATA = "data";
- public static final String NODES = "nodes";
- public static final String REST_CONFIGS = "restConfigs";
- public static final String CONFIGS = "configs";
-
-
- // microservice info
- public static final String MICROSERVICE_URL = "url";
- public static final String MICROSERVICE_NAME = "name";
- public static final String MICROSERVICE_VERSION = "version";
-
- public static final String NAME = "name";
-
- public static final String ID = "id";
-
- public static final String TYPE = "type";
-
- public static final String INPUT = "input";
-
- public static final String OUTPUT = "output";
-
- public static final String VALUE = "value";
-
- public static final String NODE_TEMPLATE = "node_template";
-
- public static final String NODE_OPERATION = "node_operation";
-
- public static final String NODE_INTERFACE_NAME = "interface";
-
- public static final String CONNECTIONS = "connection";
-
- public static final String SOURCE_REF = "sourceRef";
-
- public static final String TARGET_REF = "targetRef";
-
- public static final String CONDITIONS = "conditions";
-
- public static final String CONDITION = "condition";
-
- public static final String DEFAULT = "default";
-
-
- /*
- * Exclusive-Gateway, Event, Management-Task Types
- *
- */
- public static final String NODE_TYPE_MGMT_TASK = "ToscaNodeManagementTask";
-
- public static final String NODE_TYPE_START_EVENT = "StartEvent";
-
- public static final String NODE_TYPE_END_EVENT = "EndEvent";
-
- public static final String NODE_TYPE_GATEWAY_EXCLUSIVE = "ExclusiveGateway";
-
- public static final String NODE_TYPE_GATEWAY_EXCLUSIVE_END = "ExclusiveGatewayEnd";
-
-
- /*
- * Parameter Types
- */
- public static final String PARAM_TYPE_VALUE_STRING = "string";
-
- public static final String PARAM_TYPE_VALUE_TOPOLOGY = "topology";
-
- public static final String PARAM_TYPE_VALUE_PLAN = "plan";
-
- public static final String PARAM_TYPE_VALUE_CONCAT = "concat";
-
- public static final String PARAM_TYPE_VALUE_IA = "implementation_artifact";
-
- public static final String PARAM_TYPE_VALUE_DA = "deployment_artifact";
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResource.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResource.java deleted file mode 100644 index 4a40597a..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/ExtendActivityResource.java +++ /dev/null @@ -1,283 +0,0 @@ -/** - * Copyright (c) 2017-2018 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner.resources; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.eclipse.jetty.http.HttpStatus; -import org.onap.sdc.workflowdesigner.common.ActivitySpecProxyException; -import org.onap.sdc.workflowdesigner.config.AppConfig; -import org.onap.sdc.workflowdesigner.externalservice.sdc.ActivitySpecServiceProxy; -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.ActivitySpec; -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.Parameter; -import org.onap.sdc.workflowdesigner.resources.entity.ExtActivityDisplayInfo; -import org.onap.sdc.workflowdesigner.resources.entity.I18nString; -import org.onap.sdc.workflowdesigner.resources.entity.InputOutput; -import org.onap.sdc.workflowdesigner.resources.entity.NodeCategory; -import org.onap.sdc.workflowdesigner.resources.entity.CategoryData; -import org.onap.sdc.workflowdesigner.resources.entity.Content; -import org.onap.sdc.workflowdesigner.resources.entity.ExtActivity; -import org.onap.sdc.workflowdesigner.utils.FileCommonUtils; -import org.onap.sdc.workflowdesigner.utils.JsonUtils; -import org.onap.sdc.workflowdesigner.utils.RestUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.codahale.metrics.annotation.Timed; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -/** - * Extend Activity Resource. - * - */ -@Path("/ext-activities") -@Api(tags = {"Workflow Modeler"}) -public class ExtendActivityResource { - private static final Logger LOGGER = LoggerFactory.getLogger(ExtendActivityResource.class); - - /** */ - private static final String EXT_ACTIVITIES_DISPLAY_INFO_FILE_NAME = - "ext-activities-display-info.json"; - - private static final String EXT_ACTIVITIES_FILE_NAME = "ext-activities.json"; - - private static final CategoryData EXTENSION_TASK_CATEGORY = - new CategoryData(new I18nString("Extension Task", "Extension Task")); - - private static final String EXTENSION_TASK_CATEGORY_CATEGORY_ID = "extension_task_category_id"; - - /** - * test function. - * - * @return Response - */ - @Path("/") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Get Extend Activities.", response = ExtActivity.class, - responseContainer = "List") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "server internal error", - response = String.class)}) - @Timed - public Response getExtActivities(@ApiParam(value = "sence") @QueryParam("sence") String sence) { - if (AppConfig.isSDCAdapter()) { - return getExtActivitiesfromSDC(); - } else { - return getExtActivitiesfromLocal(); - } - } - - /** - * @return - */ - private Response getExtActivitiesfromLocal() { - try { - String json = FileCommonUtils.readString(EXT_ACTIVITIES_FILE_NAME); - ExtActivity[] extActivities = JsonUtils.fromJson(json, ExtActivity[].class); - return Response.status(Response.Status.OK).entity(extActivities).build(); - } catch (IOException e) { - LOGGER.error("Get ExtActivities from local failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } - } - - /** - * @return - */ - private Response getExtActivitiesfromSDC() { - try { - ActivitySpecServiceProxy proxy = new ActivitySpecServiceProxy(); - ActivitySpec[] activitySpecs = proxy.getActivitySpecs(); - ExtActivity[] extActivities = convert2ExtActivities(activitySpecs); - return Response.status(Response.Status.OK).entity(extActivities).build(); - } catch (ActivitySpecProxyException e) { - LOGGER.error("Get ExtActivities from sdc failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } - } - - /** - * @param activitySpecs - * @return - */ - private ExtActivity[] convert2ExtActivities(ActivitySpec[] activitySpecs) { - ExtActivity[] extendActivities = new ExtActivity[activitySpecs.length]; - for (int i = 0; i < activitySpecs.length; i++) { - extendActivities[i] = convert2ExtActivity(activitySpecs[i]); - } - return extendActivities; - } - - /** - * @param activitySpec - * @return - */ - private ExtActivity convert2ExtActivity(ActivitySpec activitySpec) { - ExtActivity extActivity = new ExtActivity(); - extActivity.setId(activitySpec.getId()); - extActivity.setDisplayName(new I18nString(activitySpec.getName(), activitySpec.getName())); - extActivity.setDescription( - new I18nString(activitySpec.getDescription(), activitySpec.getDescription())); - extActivity.setType(activitySpec.getType()); - extActivity.setContent(buildContent(activitySpec)); - return extActivity; - } - - /** - * @param activitySpec - * @return - */ - private Content buildContent(ActivitySpec activitySpec) { - Content content = new Content(); - content.setScript(activitySpec.getContent()); - content.setInputs(convert2InputOutputs(activitySpec.getInputs())); - content.setOutputs(convert2InputOutputs(activitySpec.getOutputs())); - return content; - } - - /** - * @param parameters - * @return - */ - private Map<String, InputOutput> convert2InputOutputs(Parameter[] parameters) { - Map<String, InputOutput> inputOutputs = new HashMap<>(); - for (Parameter parameter : parameters) { - inputOutputs.put(parameter.getName(), convert2InputOutput(parameter)); - } - return inputOutputs; - } - - /** - * @param parameter - * @return - */ - private InputOutput convert2InputOutput(Parameter parameter) { - InputOutput inputOutput = new InputOutput(); - inputOutput.setDisplayName(new I18nString(parameter.getName(), parameter.getName())); - inputOutput.setType(parameter.getType()); - inputOutput.setDefault(parameter.getDefault()); - inputOutput.setValue(parameter.getValue()); - return inputOutput; - } - - - @Path("/displayInfo") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Get Extend Activities DisplayInfo", - response = ExtActivityDisplayInfo.class) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "server internal error", - response = String.class)}) - @Timed - public Response getDisplayInfo(@ApiParam(value = "sence") @QueryParam("sence") String sence) { - if (AppConfig.isSDCAdapter()) { - return getDisplayInfofromSDC(); - } else { - return getDisplayInfofromLocal(sence); - } - } - - /** - * @param sence - * @return - */ - private Response getDisplayInfofromLocal(String sence) { - try { - ExtActivityDisplayInfo displayInfo = retriveDisplayInfo(sence); - return Response.status(Response.Status.OK).entity(displayInfo).build(); - } catch (IOException e) { - LOGGER.error("Get Extend Activities DisplayInfo from failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } - } - - /** - * @return - */ - private Response getDisplayInfofromSDC() { - try { - ActivitySpecServiceProxy proxy = new ActivitySpecServiceProxy(); - ActivitySpec[] activitySpecs = proxy.getActivitySpecs(); - ExtActivityDisplayInfo displayInfo = convert2ExtActivityDisplayInfo(activitySpecs); - return Response.status(Response.Status.OK).entity(displayInfo).build(); - } catch (ActivitySpecProxyException e) { - LOGGER.error("Get Extend Activities DisplayInfo from sdc failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } - } - - /** - * @param activitySpecs - * @return - */ - private ExtActivityDisplayInfo convert2ExtActivityDisplayInfo(ActivitySpec[] activitySpecs) { - ExtActivityDisplayInfo displayInfo = new ExtActivityDisplayInfo(); - - for (ActivitySpec activitySpec : activitySpecs) { - displayInfo.getNodes().put(activitySpec.getId(), buildNodeCategory(activitySpec)); - } - - displayInfo.getCategoryData().put(EXTENSION_TASK_CATEGORY_CATEGORY_ID, EXTENSION_TASK_CATEGORY); - - return displayInfo; - } - - /** - * @param activitySpec - * @return - */ - private NodeCategory buildNodeCategory(ActivitySpec activitySpec) { - NodeCategory nodeCategory = new NodeCategory(); - nodeCategory.setCategory(EXTENSION_TASK_CATEGORY_CATEGORY_ID); - - return nodeCategory; - } - - /** - * @param sence - * @return - * @throws IOException - */ - private ExtActivityDisplayInfo retriveDisplayInfo(String sence) throws IOException { - String json = FileCommonUtils.readString(EXT_ACTIVITIES_DISPLAY_INFO_FILE_NAME); - return JsonUtils.fromJson(json, ExtActivityDisplayInfo.class); - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/HealthCheckResource.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/HealthCheckResource.java deleted file mode 100644 index 263ac73d..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/HealthCheckResource.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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.resources; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import org.eclipse.jetty.http.HttpStatus; -import com.codahale.metrics.annotation.Timed; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -@Path("/healthCheck") -@Api(tags = {" Health Check "}) -public class HealthCheckResource { - - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = " Health Check ") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryEmsList() { - return Response.ok("hello world !").build(); - } -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java deleted file mode 100644 index c08fcef5..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java +++ /dev/null @@ -1,267 +0,0 @@ -/** - * Copyright (c) 2017-2018 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner.resources; - -import java.io.IOException; -import java.net.URI; -import java.nio.file.Paths; -import java.util.List; -import java.util.UUID; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.dom4j.Comment; -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.eclipse.jetty.http.HttpStatus; -import org.onap.sdc.workflowdesigner.common.SDCProxyException; -import org.onap.sdc.workflowdesigner.config.AppConfig; -import org.onap.sdc.workflowdesigner.externalservice.sdc.SDCServiceProxy; -import org.onap.sdc.workflowdesigner.externalservice.sdc.entity.WorkflowArtifactInfo; -import org.onap.sdc.workflowdesigner.model.Process; -import org.onap.sdc.workflowdesigner.parser.Bpmn4ToscaJsonParser; -import org.onap.sdc.workflowdesigner.resources.entity.WorkflowInfo; -import org.onap.sdc.workflowdesigner.utils.FileCommonUtils; -import org.onap.sdc.workflowdesigner.utils.JsonUtils; -import org.onap.sdc.workflowdesigner.utils.RestUtils; -import org.onap.sdc.workflowdesigner.utils.ToolUtils; -import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.codahale.metrics.annotation.Timed; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -/** - * Workflow Modeler Resource. - * - */ -@Path("/models") -@Api(tags = {"Workflow Modeler"}) -public class WorkflowModelerResource { - private static final Logger logger = LoggerFactory.getLogger(WorkflowModelerResource.class); - - private static final String WORKFLOW_JSON_TEMP_FILE_NAME = "temp_workflow.json"; - private static final String WORKFLOW_XML_TEMP_FILE_NAME = "temp_workflow.xml"; - - - /** - * - * @return Response - */ - @Path("/{id}") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Get Model", response = WorkflowInfo.class) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "server internal error", - response = String.class)}) - @Timed - public Response getModel(@ApiParam(value = "id") @PathParam("id") String id, - @ApiParam(value = "name") @QueryParam("name") String name, - @ApiParam(value = "uuid") @QueryParam("uuid") String uuid, - @ApiParam(value = "operationId") @QueryParam("operationId") String operationId) { - if (AppConfig.isSDCAdapter()) { - return getModelfromSDC(uuid, operationId, id, name); - } else { - return getModelfromLocal(); - } - - } - - /** - * @return - */ - private Response getModelfromLocal() { - try { - String json = FileCommonUtils.readString(WORKFLOW_JSON_TEMP_FILE_NAME); - return Response.status(Response.Status.OK).entity(json).build(); - } catch (IOException e) { - logger.error("get workflow from local failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } - } - - - /** - * @param uuid - * @param operationId - * @param id - * @param name - * @return - */ - private Response getModelfromSDC(String uuid, String operationId, String id, String name) { - try { - SDCServiceProxy sdcProxy = new SDCServiceProxy(); - WorkflowArtifactInfo wai = sdcProxy.getWorkflowArtifact(uuid, operationId, id); - String bpmn = wai.getPayloadData(); - String json = readJsonfromBPMN(bpmn); - if (ToolUtils.isEmpty(json)) { - WorkflowInfo wfi = newEmptyWorkflowInfo(uuid, operationId, id, name); - return Response.status(Response.Status.OK).entity(wfi).build(); - } - return Response.status(Response.Status.OK).entity(json).build(); - } catch (SDCProxyException e) { - logger.error("get workflow from sdc failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } catch (DocumentException e) { - logger.error("get workflow from sdc failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } - } - - /** - * @param id - * @param operationId - * @param uuid - * @param name - * @return - */ - private WorkflowInfo newEmptyWorkflowInfo(String uuid, String operationId, String id, - String name) { - WorkflowInfo wfi = new WorkflowInfo(); - wfi.setId(id); - wfi.setName(name); - wfi.setUuid(uuid); - wfi.setOperationId(operationId); - - return wfi; - } - - - - @Path("/{id}") - @PUT - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Save Model", response = String.class) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "server internal error", - response = String.class)}) - @Timed - public Response saveModel(@ApiParam(value = "id") @PathParam("id") String id, - @ApiParam(value = "Model Content", required = true) String json) { - try { - FileCommonUtils.write(WORKFLOW_JSON_TEMP_FILE_NAME, json); - - URI srcUri = Paths.get(".", WORKFLOW_JSON_TEMP_FILE_NAME).toUri(); - String processName = "plan_" + UUID.randomUUID().toString(); - String bpmn = buildBPMN(srcUri, processName); - String jsonBpmn = insertJson2Bpmn(json, bpmn); - - if (AppConfig.isSDCAdapter()) { - save2SDC(json, jsonBpmn); - } - FileCommonUtils.write(WORKFLOW_XML_TEMP_FILE_NAME, jsonBpmn); - - return Response.status(Response.Status.OK).entity(json).build(); - } catch (IOException e) { - logger.error("save workflow failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } catch (Exception e) { - logger.error("convert workflow from json to bpmn failed.", e); - throw RestUtils.newInternalServerErrorException(e); - } - } - - /** - * @param json - * @param bpmn - * @return - */ - protected String insertJson2Bpmn(String json, String bpmn) { - StringBuffer sb = new StringBuffer(bpmn); - sb.append("<!-- \n").append(json).append("-->\n"); - - return sb.toString(); - } - - /** - * - * @return - * @throws DocumentException - */ - protected String readJsonfromBPMN(String bpmn) throws DocumentException { - if (ToolUtils.isEmpty(bpmn)) { - return null; - } - - Document doc = DocumentHelper.parseText(bpmn); - List<?> elementList = doc.content(); - for (Object object : elementList) { - if (object instanceof Comment) { - Comment comment = (Comment) object; - return comment.getText().trim(); - } - } - - return null; - } - - - /** - * @param json - * @param bpmn - * @throws SDCProxyException - */ - private void save2SDC(String json, String bpmn) throws SDCProxyException { - WorkflowInfo workflowInfo = JsonUtils.fromJson(json, WorkflowInfo.class); - WorkflowArtifactInfo workflowArtifactInfo = - new WorkflowArtifactInfo(workflowInfo.getName(), workflowInfo.getDescription(), bpmn); - - SDCServiceProxy sdcProxy = new SDCServiceProxy(); - sdcProxy.saveWorkflowArtifact(workflowInfo.getUuid(), workflowInfo.getOperationId(), - workflowInfo.getId(), workflowArtifactInfo); - } - - /** - * - * @param srcUri - * @param processName - * @return - * @throws IOException - * @throws Exception - */ - protected String buildBPMN(URI srcUri, String processName) throws IOException, Exception { - Bpmn4ToscaJsonParser parser = new Bpmn4ToscaJsonParser(); - Process process = parser.parse(processName, srcUri); - - // transform bpmn template - BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(process); - return writer.completePlanTemplate(); - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryData.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryData.java deleted file mode 100644 index 1df2c2b1..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/CategoryData.java +++ /dev/null @@ -1,65 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-/**
- *
- */
-public class CategoryData {
- private I18nString displayName;
-
- private boolean collapse;
-
- /**
- *
- */
- public CategoryData() {
- super();
- }
-
- /**
- * @param displayName
- */
- public CategoryData(I18nString displayName) {
- super();
- this.displayName = displayName;
- }
-
- /**
- * @return the displayName
- */
- public I18nString getDisplayName() {
- return displayName;
- }
-
- /**
- * @param displayName the displayName to set
- */
- public void setDisplayName(I18nString displayName) {
- this.displayName = displayName;
- }
-
- /**
- * @return the collapse
- */
- public boolean isCollapse() {
- return collapse;
- }
-
- /**
- * @param collapse the collapse to set
- */
- public void setCollapse(boolean collapse) {
- this.collapse = collapse;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/Content.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/Content.java deleted file mode 100644 index 2a49ae07..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/Content.java +++ /dev/null @@ -1,95 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.gson.annotations.SerializedName;
-
-/**
- *
- */
-@JsonInclude(Include.NON_NULL)
-public class Content {
- @JsonProperty(value="class") // for dropwizard's Jackson
- @SerializedName("class") // for Gson
- public String clazz;
-
- private String script;
-
- private String scriptFormat;
-
- private Map<String, InputOutput> inputs;
-
- private Map<String, InputOutput> outputs;
-
-
- /**
- * @return the script
- */
- public String getScript() {
- return script;
- }
-
- /**
- * @param script the script to set
- */
- public void setScript(String script) {
- this.script = script;
- }
-
- /**
- * @return the scriptFormat
- */
- public String getScriptFormat() {
- return scriptFormat;
- }
-
- /**
- * @param scriptFormat the scriptFormat to set
- */
- public void setScriptFormat(String scriptFormat) {
- this.scriptFormat = scriptFormat;
- }
-
- /**
- * @return the inputs
- */
- public Map<String, InputOutput> getInputs() {
- return inputs;
- }
-
- /**
- * @param inputs the inputs to set
- */
- public void setInputs(Map<String, InputOutput> inputs) {
- this.inputs = inputs;
- }
-
- /**
- * @return the outputs
- */
- public Map<String, InputOutput> getOutputs() {
- return outputs;
- }
-
- /**
- * @param outputs the outputs to set
- */
- public void setOutputs(Map<String, InputOutput> outputs) {
- this.outputs = outputs;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivity.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivity.java deleted file mode 100644 index 5a798ee2..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivity.java +++ /dev/null @@ -1,120 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-/**
- *
- */
-@JsonInclude(Include.NON_NULL)
-public class ExtActivity {
- private String id;
-
- private I18nString displayName;
-
- private I18nString description;
-
- private String type;
-
- private IconData icon;
-
- private Content content;
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the icon
- */
- public IconData getIcon() {
- return icon;
- }
-
- /**
- * @param icon the icon to set
- */
- public void setIcon(IconData icon) {
- this.icon = icon;
- }
-
- /**
- * @return the content
- */
- public Content getContent() {
- return content;
- }
-
- /**
- * @param content the content to set
- */
- public void setContent(Content content) {
- this.content = content;
- }
-
- /**
- * @return the displayName
- */
- public I18nString getDisplayName() {
- return displayName;
- }
-
- /**
- * @param displayName the displayName to set
- */
- public void setDisplayName(I18nString displayName) {
- this.displayName = displayName;
- }
-
- /**
- * @return the description
- */
- public I18nString getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(I18nString description) {
- this.description = description;
- }
-
-
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfo.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfo.java deleted file mode 100644 index 5c96cea8..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/ExtActivityDisplayInfo.java +++ /dev/null @@ -1,53 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- */
-public class ExtActivityDisplayInfo {
- private Map<String, NodeCategory> nodes = new HashMap<>();
-
- private Map<String, CategoryData> categoryData = new HashMap<>();
-
- /**
- * @return the nodes
- */
- public Map<String, NodeCategory> getNodes() {
- return nodes;
- }
-
- /**
- * @param nodes the nodes to set
- */
- public void setNodes(Map<String, NodeCategory> nodes) {
- this.nodes = nodes;
- }
-
- /**
- * @return the categoryData
- */
- public Map<String, CategoryData> getCategoryData() {
- return categoryData;
- }
-
- /**
- * @param categoryData the categoryData to set
- */
- public void setCategoryData(Map<String, CategoryData> categoryData) {
- this.categoryData = categoryData;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/I18nString.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/I18nString.java deleted file mode 100644 index 1ed14f6f..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/I18nString.java +++ /dev/null @@ -1,69 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-/**
- *
- */
-public class I18nString {
- private String en_US;
-
- private String zh_CN;
-
- /**
- *
- */
- public I18nString() {
- super();
- }
-
- /**
- * @param en_US
- * @param zh_CN
- */
- public I18nString(String en_US, String zh_CN) {
- super();
- this.en_US = en_US;
- this.zh_CN = zh_CN;
- }
-
- /**
- * @return the en_US
- */
- public String getEn_US() {
- return en_US;
- }
-
- /**
- * @param en_US the en_US to set
- */
- public void setEn_US(String en_US) {
- this.en_US = en_US;
- }
-
- /**
- * @return the zh_CN
- */
- public String getZh_CN() {
- return zh_CN;
- }
-
- /**
- * @param zh_CN the zh_CN to set
- */
- public void setZh_CN(String zh_CN) {
- this.zh_CN = zh_CN;
- }
-
-
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/IconData.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/IconData.java deleted file mode 100644 index b84446fc..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/IconData.java +++ /dev/null @@ -1,68 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-/**
- *
- */
-public class IconData {
- private String name;
-
- private int width;
-
- private int height;
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the width
- */
- public int getWidth() {
- return width;
- }
-
- /**
- * @param width the width to set
- */
- public void setWidth(int width) {
- this.width = width;
- }
-
- /**
- * @return the height
- */
- public int getHeight() {
- return height;
- }
-
- /**
- * @param height the height to set
- */
- public void setHeight(int height) {
- this.height = height;
- }
-
-
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java deleted file mode 100644 index 60ab4c78..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/InputOutput.java +++ /dev/null @@ -1,135 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- *
- */
-public class InputOutput {
- private String type;
-
- @SerializedName("default")
- private String defaultValue;
-
- private boolean required;
-
- private I18nString displayName;
-
- private boolean show = true;
-
- private boolean editable = true;
-
- private String value;
-
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the defaultValue
- */
- public String getDefault() {
- return defaultValue;
- }
-
- /**
- * @param defaultValue the defaultValue to set
- */
- public void setDefault(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- /**
- * @return the required
- */
- public boolean isRequired() {
- return required;
- }
-
- /**
- * @param required the required to set
- */
- public void setRequired(boolean required) {
- this.required = required;
- }
-
- /**
- * @return the displayName
- */
- public I18nString getDisplayName() {
- return displayName;
- }
-
- /**
- * @param displayName the displayName to set
- */
- public void setDisplayName(I18nString displayName) {
- this.displayName = displayName;
- }
-
- /**
- * @return the show
- */
- public boolean isShow() {
- return show;
- }
-
- /**
- * @param show the show to set
- */
- public void setShow(boolean show) {
- this.show = show;
- }
-
- /**
- * @return the editable
- */
- public boolean isEditable() {
- return editable;
- }
-
- /**
- * @param editable the editable to set
- */
- public void setEditable(boolean editable) {
- this.editable = editable;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategory.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategory.java deleted file mode 100644 index bcafca6e..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/NodeCategory.java +++ /dev/null @@ -1,34 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-/**
- *
- */
-public class NodeCategory {
- private String category;
-
- /**
- * @return the category
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * @param category the category to set
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfo.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfo.java deleted file mode 100644 index 4ed4e501..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/entity/WorkflowInfo.java +++ /dev/null @@ -1,133 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.resources.entity;
-
-import com.google.gson.JsonObject;
-
-/**
- *
- */
-public class WorkflowInfo {
- private String uuid;
-
- private String operationId;
-
- private String id;
-
- private String name;
-
- private String description;
-
- private String scene;
-
- private JsonObject data;
-
- /**
- * @return the uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * @param uuid the uuid to set
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * @return the operationId
- */
- public String getOperationId() {
- return operationId;
- }
-
- /**
- * @param operationId the operationId to set
- */
- public void setOperationId(String operationId) {
- this.operationId = operationId;
- }
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the scene
- */
- public String getScene() {
- return scene;
- }
-
- /**
- * @param scene the scene to set
- */
- public void setScene(String scene) {
- this.scene = scene;
- }
-
- /**
- * @return the data
- */
- public JsonObject getData() {
- return data;
- }
-
- /**
- * @param data the data to set
- */
- public void setData(JsonObject data) {
- this.data = data;
- }
-
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/FileCommonConstants.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/FileCommonConstants.java deleted file mode 100644 index fdf11959..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/FileCommonConstants.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2018 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner.utils; - -/** - * - */ -public interface FileCommonConstants { - String DEFAULT_CHARSET_NAME = "UTF-8"; - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtils.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtils.java deleted file mode 100644 index 0f07dc50..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtils.java +++ /dev/null @@ -1,287 +0,0 @@ -/** - * Copyright (c) 2018 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner.utils; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * common utility class. - * - */ -public class FileCommonUtils { - private static final Logger logger = LoggerFactory.getLogger(FileCommonUtils.class); - - /** - * @param ins - */ - public static void closeInputStream(InputStream ins) { - if (ins != null) { - try { - ins.close(); - } catch (IOException e) { - logger.info("Close InputStream failed.", e); - } - } - } - - - /** - * - * @param os - */ - public static void closeOutputStream(OutputStream os) { - if (os != null) { - try { - os.close(); - } catch (IOException e) { - logger.info("Close OutputStream failed.", e); - } - } - } - - - /** - * @param reader - */ - public static void closeReader(Reader reader) { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - logger.info("Close Reader failed.", e); - } - } - } - - - /** - * - * @param writer - */ - public static void closeWriter(Writer writer) { - if (writer != null) { - try { - writer.close(); - } catch (IOException e) { - logger.info("Close Writer failed.", e); - } - } - } - - - /** - * - * @param ins - * @return - * @throws IOException - */ - public static String[] readLines(InputStream ins) throws IOException { - InputStreamReader insReader = new InputStreamReader(ins); - BufferedReader reader = new BufferedReader(insReader); - - List<String> lineList = new ArrayList<>(); - String line; - try { - while ((line = reader.readLine()) != null) { - lineList.add(line); - } - } finally { - closeReader(reader); - closeReader(insReader); - } - - return lineList.toArray(new String[0]); - } - - - /** - * - * @param ins - * @return - * @throws IOException - */ - public static String readString(InputStream ins) throws IOException { - return IOUtils.toString(ins, "UTF-8"); - } - - - /** - * - * @param filePath - * @return - * @throws IOException - */ - public static String readString(String filePath) throws IOException { - InputStream ins = null; - try { - ins = Files.newInputStream(Paths.get(filePath)); - return readString(ins); - } finally { - closeInputStream(ins); - } - } - - - /** - * - * @param ins - * @param path - * @param fileName - * @return - * @throws IOException - */ - public static String saveFile(InputStream ins, String path, String fileName) throws IOException { - File tmpPath = new File(path); - if (!tmpPath.exists()) { - tmpPath.mkdirs(); - } - - File file = new File(path + File.separator + fileName); - OutputStream os = null; - try { - int read = 0; - byte[] bytes = new byte[1024]; - os = new FileOutputStream(file, false); - while ((read = ins.read(bytes)) != -1) { - os.write(bytes, 0, read); - } - os.flush(); - return file.getAbsolutePath(); - } finally { - closeOutputStream(os); - } - } - - - /** - * - * @param path - * @param fileName - * @param content - * @throws IOException - */ - public static void writetoAbsoluteFile(String path, String fileName, String content) - throws IOException { - writetoAbsoluteFile(path, fileName, content, FileCommonConstants.DEFAULT_CHARSET_NAME); - } - - - /** - * - * @param path - * @param fileName - * @param content - * @param charsetName - * @throws IOException - */ - public static void writetoAbsoluteFile(String path, String fileName, String content, - String charsetName) throws IOException { - write(path, fileName, content, charsetName); - } - - - /** - * - * @param fileName - * @param s - * @throws IOException - */ - public static void write(String fileName, String s) throws IOException { - write(".", fileName, s, FileCommonConstants.DEFAULT_CHARSET_NAME); - - } - - - /** - * - * @param path - * @param fileName - * @param s - * @param charsetName - * @throws IOException - */ - public static void write(String path, String fileName, String s, String charsetName) - throws IOException { - File tmpPath = new File(path); - if (!tmpPath.exists()) { - tmpPath.mkdirs(); - } - - String absolutePath = path + File.separator + fileName; - FileOutputStream out = null; - try { - out = new FileOutputStream(absolutePath); - out.write(s.getBytes(charsetName)); - out.close(); - } finally { - closeOutputStream(out); - } - } - - - /** - * - * @param fileName - * @param s - * @param charsetName - * @throws IOException - */ - public static void write(String fileName, String s, String charsetName) throws IOException { - write(".", fileName, s, charsetName); - } - - - /** - * - * @param fileName - * @param ss - * @throws IOException - */ - public static void write(String fileName, String[] ss) throws IOException { - write(fileName, ss, FileCommonConstants.DEFAULT_CHARSET_NAME); - } - - - /** - * - * @param fileName - * @param ss - * @param charsetName - * @throws IOException - */ - public static void write(String fileName, String[] ss, String charsetName) throws IOException { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < ss.length; i++) { - sb.append(ss[i]).append(System.lineSeparator()); - } - - write(fileName, sb.toString(), charsetName); - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/JsonUtils.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/JsonUtils.java deleted file mode 100644 index 09588ef3..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/JsonUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.utils;
-
-import com.google.gson.Gson;
-
-/**
- *
- */
-public class JsonUtils {
- /**
- *
- * @param json
- * @param clazz
- * @return
- */
- public static <T> T fromJson(String json, Class<T> clazz) {
- Gson gson = new Gson();
- return gson.fromJson(json, clazz);
- }
-
- /**
- *
- * @param t
- * @return
- */
- public static <T> String toJson(T t) {
- Gson gson = new Gson();
- return gson.toJson(t);
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/RestUtils.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/RestUtils.java deleted file mode 100644 index b8ba428c..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/RestUtils.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2018 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner.utils; - -import javax.ws.rs.InternalServerErrorException; -import javax.ws.rs.core.Response; - -import org.onap.sdc.workflowdesigner.utils.entity.CommonErrorResponse; - -/** - * - */ -public class RestUtils { - public static InternalServerErrorException newInternalServerErrorException(Exception e) { - return new InternalServerErrorException(Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity(new CommonErrorResponse(e.getMessage())).build(), e); - } -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/ToolUtils.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/ToolUtils.java deleted file mode 100644 index c5bdee70..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/ToolUtils.java +++ /dev/null @@ -1,26 +0,0 @@ -/**
- * Copyright (c) 2018 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.utils;
-
-/**
- *
- */
-public class ToolUtils {
- /**
- * @param val
- * @return
- */
- public static boolean isEmpty(String val) {
- return val == null || val.trim().isEmpty();
- }
-
-}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/entity/CommonErrorResponse.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/entity/CommonErrorResponse.java deleted file mode 100644 index 5983a5a5..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/utils/entity/CommonErrorResponse.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2017 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner.utils.entity; - -public class CommonErrorResponse { - private String code; - private String message; - - public static Object failure(String message) { - return message; - } - - public CommonErrorResponse(String message) { - super(); - this.message = message; - } - - /** - * @return the code - */ - public String getCode() { - return code; - } - - /** - * @param code the code to set - */ - public void setCode(String code) { - this.code = code; - } - - /** - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * @param message the message to set - */ - public void setMessage(String message) { - this.message = message; - } - -} diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/writer/BpmnPlanArtefactWriter.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/writer/BpmnPlanArtefactWriter.java deleted file mode 100644 index 89e0c8c9..00000000 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/writer/BpmnPlanArtefactWriter.java +++ /dev/null @@ -1,64 +0,0 @@ -/**
- * Copyright (c) 2017 ZTE Corporation.
- * All rights reserved. This program and the accompanying materials
- * are made available under the Apache License, Version 2.0
- * and the Eclipse Public License v1.0 which both accompany this distribution,
- * and are available at http://www.eclipse.org/legal/epl-v10.html
- * and http://www.apache.org/licenses/LICENSE-2.0
- *
- * Contributors:
- * ZTE - initial API and implementation and/or initial documentation
- */
-package org.onap.sdc.workflowdesigner.writer;
-
-import java.io.StringWriter;
-
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.onap.sdc.workflowdesigner.config.Config;
-import org.onap.sdc.workflowdesigner.model.Process;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BpmnPlanArtefactWriter {
-
- private Process process;
-
- private final static String TEMPLATE_PATH = Config.PROPERTIES.getProperty(Config.TEMPLATE_PATH);
-
- private static Logger log = LoggerFactory.getLogger(BpmnPlanArtefactWriter.class);
-
- public BpmnPlanArtefactWriter(Process process) throws Exception {
- this.process = process;
- Velocity.init();
- }
-
- public String completePlanTemplate() throws ResourceNotFoundException, ParseErrorException, Exception {
- log.debug("Completing BPMN process template...");
-
- VelocityContext context = new VelocityContext();
-
- VelocityEngine ve = new VelocityEngine();
- ve.setProperty("resource.loader", "class");
- ve.setProperty("class.resource.loader.class",
- "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
- Template planTemplate = ve.getTemplate(TEMPLATE_PATH + "bpmn_template.xml");
-
- context.put("process", process);
- context.put("templatePath", TEMPLATE_PATH);
- StringWriter planWriter = new StringWriter();
- planTemplate.merge(context, planWriter);
-
- String bpmnProcessContent = planWriter.toString();
-
- log.debug("Completed BPMN process template" + bpmnProcessContent);
-
- return bpmnProcessContent;
-
- }
-
-}
|