From cd73a59930eabcb5ea3dccda45ed28619ad9a5bf Mon Sep 17 00:00:00 2001 From: Lvbo163 Date: Wed, 27 Sep 2017 15:30:49 +0800 Subject: Change license header for check style error Issue-ID: SDC-406 Change-Id: Icfa0177c63104d24b3520527c2c50ec4499206c4 Signed-off-by: Lvbo163 --- .../onap/sdc/workflowdesigner/config/Config.java | 66 ++++++------- .../converter/Bpmn4Tosca2Bpmn.java | 4 +- .../onap/sdc/workflowdesigner/model/Element.java | 103 +++++++++++--------- .../onap/sdc/workflowdesigner/model/EndEvent.java | 4 +- .../onap/sdc/workflowdesigner/model/Parameter.java | 4 +- .../onap/sdc/workflowdesigner/model/Position.java | 37 ++++---- .../onap/sdc/workflowdesigner/model/Process.java | 78 ++++++++------- .../sdc/workflowdesigner/model/SequenceFlow.java | 105 +++++++++++---------- .../sdc/workflowdesigner/model/StartEvent.java | 4 +- .../parser/Bpmn4ToscaJsonParser.java | 94 +++++++++--------- .../writer/BpmnPlanArtefactWriter.java | 4 +- 11 files changed, 267 insertions(+), 236 deletions(-) (limited to 'sdc-workflow-designer-server/src/main/java') 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 index 8ea3d9e6..601822dd 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * @@ -20,35 +20,35 @@ 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 static String HANDLER_ClASS = "handlerClass"; - public static String TEMPLATE_PATH = "templatePath"; - - public 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; - } + private static Logger log = LoggerFactory.getLogger(Config.class); + private static String configFilePath = "bpmn.config.properties"; + public static String HANDLER_ClASS = "handlerClass"; + public static String TEMPLATE_PATH = "templatePath"; + + public 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/converter/Bpmn4Tosca2Bpmn.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java index ab1c5fa5..7721eaa7 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * 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 index 8b06466d..ea22dfb4 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * @@ -14,48 +14,59 @@ package org.onap.sdc.workflowdesigner.model; import java.util.List; public class Element { - private String id; - private String name; - private String type; - private String documentation; - private Position position; - private List connections; - - public String getId() { - return id; - } - public Position getPosition() { - return position; - } - public void setPosition(Position position) { - this.position = position; - } - public List getConnections() { - return connections; - } - public void setConnections(List 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 String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - + private String id; + private String name; + private String type; + private String documentation; + private Position position; + private List connections; + + public String getId() { + return id; + } + + public Position getPosition() { + return position; + } + + public void setPosition(Position position) { + this.position = position; + } + + public List getConnections() { + return connections; + } + + public void setConnections(List 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 String getType() { + return type; + } + + public void setType(String 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 index 86b1c8fc..82e48d26 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * 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 index dae42176..cf4c651f 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * 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 index f227bac4..a409dd82 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * @@ -12,19 +12,22 @@ 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; - } + 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 index e8f9a6ea..c229c291 100644 --- 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 @@ -1,53 +1,59 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 elementList = new ArrayList(); - private List sequenceFlowList = new ArrayList(); - - 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 getElementList() { - return elementList; - } - public void setElementList(List elementList) { - this.elementList = elementList; - } - public List getSequenceFlowList() { - return sequenceFlowList; - } - public void setSequenceFlowList(List sequenceFlowList) { - this.sequenceFlowList = sequenceFlowList; - } + private String id; + private boolean isExecutable; + private List elementList = new ArrayList(); + private List sequenceFlowList = new ArrayList(); + + 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 getElementList() { + return elementList; + } + + public void setElementList(List elementList) { + this.elementList = elementList; + } + + public List getSequenceFlowList() { + return sequenceFlowList; + } + + public void setSequenceFlowList(List sequenceFlowList) { + this.sequenceFlowList = sequenceFlowList; + } } 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 index 5e664cf6..5fb6ba2c 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * @@ -12,50 +12,59 @@ 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; - } - + 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/StartEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/StartEvent.java index 4f5ece61..a78c8dd3 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * 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 index a7511482..df11e402 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * @@ -35,47 +35,48 @@ import com.fasterxml.jackson.databind.SerializationFeature; public class Bpmn4ToscaJsonParser { - private static Logger log = LoggerFactory.getLogger(Bpmn4ToscaJsonParser.class); - - private static ObjectMapper MAPPER = new ObjectMapper(); - - 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("nodes"); - if(nodes == null) { - return process; - } - - Iterator iter = nodes.iterator(); - while (iter.hasNext()) { - JsonNode jsonNode = (JsonNode) iter.next(); - - // get element - Element element = createElementFromJson(jsonNode); - process.getElementList().add(element); - - // get sequence flows + private static Logger log = LoggerFactory.getLogger(Bpmn4ToscaJsonParser.class); + + private static ObjectMapper MAPPER = new ObjectMapper(); + + 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("nodes"); + if (nodes == null) { + return process; + } + + Iterator 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 flowList = getSequenceFlows(jsonNode); process.getSequenceFlowList().addAll(flowList); - } + } + + return process; - return process; + } - } - - private List getSequenceFlows(JsonNode jsonNode) { + private List getSequenceFlows(JsonNode jsonNode) { List flowList = new ArrayList(); JsonNode sequenceFlowNodes = jsonNode.get("sequenceFlows"); - + Iterator iter = sequenceFlowNodes.iterator(); while (iter.hasNext()) { JsonNode connectionEntry = (JsonNode) iter.next(); @@ -89,18 +90,19 @@ public class Bpmn4ToscaJsonParser { flow.setCondition(condition); flowList.add(flow); } - + return flowList; } - - private String getValueFromJsonNode(JsonNode jsonNode, String key) { + + private String getValueFromJsonNode(JsonNode jsonNode, String key) { return jsonNode.get(key) == null ? null : jsonNode.get(key).asText(); } - - protected Element createElementFromJson(JsonNode jsonNode) throws JsonParseException, JsonMappingException, IOException { - String jsonObject = jsonNode.toString(); + + protected Element createElementFromJson(JsonNode jsonNode) + throws JsonParseException, JsonMappingException, IOException { + String jsonObject = jsonNode.toString(); Element element; - + String nodeType = getValueFromJsonNode(jsonNode, "type"); switch (nodeType) { case "startEvent": @@ -115,6 +117,6 @@ public class Bpmn4ToscaJsonParser { } return element; - } - + } + } 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 index c39b0bba..ee6a6e57 100644 --- 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 @@ -1,8 +1,8 @@ /** * Copyright (c) 2017 ZTE Corporation. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * and the Apache License 2.0 which both accompany this distribution, + * 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 * -- cgit 1.2.3-korg