From 74804f1da33f72ceb121514b4927c6d321e49661 Mon Sep 17 00:00:00 2001 From: keyeqing <1057516690@qq.com> Date: Wed, 9 Oct 2013 15:57:52 +0800 Subject: [PATCH] bug fix after merge. --- .../haflow/service/FlowExecuteService.java | 4 +- .../haflow/ui/controller/FlowController.java | 71 ------ .../haflow/ui/controller/HomeController.java | 37 --- .../java/haflow/ui/helper/FlowHelper.java | 218 ------------------ src/main/resources/hibernate.cfg.xml | 28 --- src/main/webapp/WEB-INF/views/logon.jsp | 46 ---- src/main/webapp/WEB-INF/views/main.jsp | 41 ---- src/main/webapp/style/haflow.main.css | 82 ------- 8 files changed, 2 insertions(+), 525 deletions(-) diff --git a/src/main/java/haflow/service/FlowExecuteService.java b/src/main/java/haflow/service/FlowExecuteService.java index 4b5b012..22a177c 100644 --- a/src/main/java/haflow/service/FlowExecuteService.java +++ b/src/main/java/haflow/service/FlowExecuteService.java @@ -57,13 +57,13 @@ public class FlowExecuteService { return null; } - public RunFlowResultModel runFlow(UUID flowId) { + public RunFlowResultModel runFlow(UUID flowId,int userid) { RunFlowResultModel result = new RunFlowResultModel(); result.setFlowId(flowId); result.setCommited(false); StringBuilder messageBuilder = new StringBuilder(); - Flow flow = (Flow) this.getFlowService().getFlow(flowId); + Flow flow = (Flow) this.getFlowService().getFlow(flowId, userid); if (flow == null) { messageBuilder.append("Flow " + flowId + " not found!"); result.setMessage(messageBuilder.toString()); diff --git a/src/main/java/haflow/ui/controller/FlowController.java b/src/main/java/haflow/ui/controller/FlowController.java index aa1f4b2..5515e2c 100644 --- a/src/main/java/haflow/ui/controller/FlowController.java +++ b/src/main/java/haflow/ui/controller/FlowController.java @@ -1,73 +1,3 @@ -<<<<<<< HEAD -package haflow.ui.controller; - -import haflow.ui.helper.FlowHelper; -import haflow.ui.model.SaveFlowModel; -import haflow.ui.model.FlowListModel; -import haflow.ui.model.FlowModel; -import haflow.ui.model.SaveFlowResultModel; -import haflow.ui.model.RemoveFlowModel; -import haflow.ui.model.RemoveFlowResultModel; - -import java.util.UUID; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -@RequestMapping("/flow") -public class FlowController { - private FlowHelper flowHelper; - - private FlowHelper getFlowHelper() { - return flowHelper; - } - - @Autowired - private void setFlowHelper(FlowHelper flowHelper) { - this.flowHelper = flowHelper; - } - - @RequestMapping(method = RequestMethod.GET) - @ResponseBody - public FlowListModel get() { - return this.getFlowHelper().getFlowList(); - } - - @RequestMapping(value = "/{flowId}", method = RequestMethod.GET) - @ResponseBody - public FlowModel get(@PathVariable UUID flowId) { - return this.getFlowHelper().getFlow(flowId); - } - - @RequestMapping(value = "/{flowId}", method = RequestMethod.POST) - @ResponseBody - public SaveFlowResultModel post(@PathVariable UUID flowId, - @RequestBody SaveFlowModel model) { - return this.getFlowHelper().saveFlow(flowId, model); - } - - @RequestMapping(value = "/{flowId}", method = RequestMethod.PUT) - @ResponseBody - public SaveFlowResultModel put(@PathVariable UUID flowId, - @RequestBody SaveFlowModel model) { - return this.getFlowHelper().saveFlow(flowId, model); - } - - @RequestMapping(value = "/{flowId}", method = RequestMethod.DELETE) - @ResponseBody - public RemoveFlowResultModel delete(@PathVariable UUID flowId, - @RequestBody RemoveFlowModel model) { - return this.getFlowHelper().removeFlow(flowId, model); - } - -} -======= package haflow.ui.controller; import haflow.ui.helper.FlowHelper; @@ -139,4 +69,3 @@ public class FlowController { } } ->>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git diff --git a/src/main/java/haflow/ui/controller/HomeController.java b/src/main/java/haflow/ui/controller/HomeController.java index d208a62..6bd03af 100644 --- a/src/main/java/haflow/ui/controller/HomeController.java +++ b/src/main/java/haflow/ui/controller/HomeController.java @@ -1,4 +1,3 @@ -<<<<<<< HEAD package haflow.ui.controller; import org.springframework.stereotype.Controller; @@ -13,41 +12,6 @@ public class HomeController { return new ModelAndView("logon"); } - @RequestMapping("/main") - public ModelAndView main() { - return new ModelAndView("main"); - } - - @RequestMapping("/admin") - public ModelAndView admin() { - return new ModelAndView("admin"); - } - - @RequestMapping({ "/oozie" }) - public ModelAndView oozie() { - return new ModelAndView("oozie"); - } -} -======= -package haflow.ui.controller; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class HomeController { - - @RequestMapping("/") - public ModelAndView logon() { - - return new ModelAndView("logon"); - } - - - // @RequestMapping("/main") // public ModelAndView main() { // return new ModelAndView("main"); @@ -63,4 +27,3 @@ public class HomeController { return new ModelAndView("oozie"); } } ->>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git diff --git a/src/main/java/haflow/ui/helper/FlowHelper.java b/src/main/java/haflow/ui/helper/FlowHelper.java index 02f0a07..a011bb4 100644 --- a/src/main/java/haflow/ui/helper/FlowHelper.java +++ b/src/main/java/haflow/ui/helper/FlowHelper.java @@ -1,220 +1,3 @@ -<<<<<<< HEAD -package haflow.ui.helper; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import haflow.dto.entity.Edge; -import haflow.dto.entity.Flow; -import haflow.dto.entity.Node; -import haflow.dto.profile.NodeAppearance; -import haflow.dto.profile.NodeConfiguration; -import haflow.service.FlowService; -import haflow.service.NodeAppearanceService; -import haflow.service.NodeConfigurationService; -import haflow.ui.model.ConfigurationItemModel; -import haflow.ui.model.EdgeModel; -import haflow.ui.model.FlowBriefModel; -import haflow.ui.model.FlowListModel; -import haflow.ui.model.FlowModel; -import haflow.ui.model.SaveFlowModel; -import haflow.ui.model.SaveFlowResultModel; -import haflow.ui.model.NodeModel; -import haflow.ui.model.PositionModel; -import haflow.ui.model.RemoveFlowModel; -import haflow.ui.model.RemoveFlowResultModel; - -@Component -public class FlowHelper { - - private FlowService flowService; - private NodeAppearanceService nodeAppearanceService; - private NodeConfigurationService nodeConfigurationProfileService; - - private FlowService getFlowService() { - return flowService; - } - - @Autowired - private void setFlowService(FlowService flowService) { - this.flowService = flowService; - } - - private NodeAppearanceService getNodeAppearanceService() { - return nodeAppearanceService; - } - - @Autowired - private void setNodeAppearanceService( - NodeAppearanceService nodeAppearanceService) { - this.nodeAppearanceService = nodeAppearanceService; - } - - private NodeConfigurationService getNodeConfigurationProfileService() { - return nodeConfigurationProfileService; - } - - @Autowired - private void setNodeConfigurationProfileService( - NodeConfigurationService nodeConfigurationProfileService) { - this.nodeConfigurationProfileService = nodeConfigurationProfileService; - } - - public FlowListModel getFlowList() { - List flowList = this.getFlowService().getFlowList(); - FlowListModel flowListModel = new FlowListModel(); - flowListModel.setFlows(new ArrayList()); - for (Flow flow : flowList) { - FlowBriefModel flowBriefModel = new FlowBriefModel(); - flowBriefModel.setId(flow.getId()); - flowBriefModel.setName(flow.getName()); - flowListModel.getFlows().add(flowBriefModel); - } - return flowListModel; - } - - public FlowModel getFlow(UUID flowId) { - Flow flow = this.getFlowService().getFlow(flowId); - if (flow == null) { - return null; - } - FlowModel flowModel = new FlowModel(); - flowModel.setId(flow.getId()); - flowModel.setName(flow.getName()); - flowModel.setNodes(new HashSet()); - for (Node node : flow.getNodes()) { - NodeModel nodeModel = new NodeModel(); - NodeAppearance nodeAppearanceProfile = this - .getNodeAppearanceService().getNodeAppearance( - node.getId()); - List nodeConfigurationProfiles = this - .getNodeConfigurationProfileService() - .getNodeConfiguration(node.getId()); - nodeModel.setFlowId(node.getFlow().getId()); - nodeModel.setId(node.getId()); - nodeModel.setModuleId(node.getModuleId()); - nodeModel.setName(node.getName()); - nodeModel.setPosition(new PositionModel()); - nodeModel.getPosition().setLeft( - nodeAppearanceProfile.getPositionLeft()); - nodeModel.getPosition().setTop( - nodeAppearanceProfile.getPositionTop()); - nodeModel.setConfigurations(new HashSet()); - for (NodeConfiguration profile : nodeConfigurationProfiles) { - ConfigurationItemModel model = new ConfigurationItemModel(); - model.setKey(profile.getKey()); - model.setValue(profile.getValue()); - nodeModel.getConfigurations().add(model); - } - flowModel.getNodes().add(nodeModel); - } - flowModel.setEdges(new HashSet()); - for (Edge edge : flow.getEdges()) { - EdgeModel edgeModel = new EdgeModel(); - edgeModel.setFlowId(edge.getFlow().getId()); - edgeModel.setId(edge.getId()); - edgeModel.setSourceNodeId(edge.getSourceNode().getId()); - edgeModel.setSourceEndpoint(edge.getSourceEndpoint()); - edgeModel.setTargetNodeId(edge.getTargetNode().getId()); - edgeModel.setTargetEndpoint(edge.getTargetEndpoint()); - flowModel.getEdges().add(edgeModel); - } - return flowModel; - } - - public SaveFlowResultModel saveFlow(UUID flowId, SaveFlowModel model) { - boolean success = this.doSaveFlow(flowId, model); - SaveFlowResultModel result = new SaveFlowResultModel(); - result.setFlowId(flowId); - result.setSuccess(success); - if (success) { - result.setMessage("success"); - } else { - result.setMessage("fail"); - } - return result; - } - - public boolean doSaveFlow(UUID flowId, SaveFlowModel model) { - Set nodes = new HashSet(); - Set edges = new HashSet(); - for (NodeModel nodeModel : model.getNodes()) { - if (!nodeModel.getFlowId().equals(flowId)) { - return false; - } - Node node = new Node(); - node.setFlow(null); - node.setId(nodeModel.getId()); - node.setModuleId(nodeModel.getModuleId()); - node.setName(nodeModel.getName()); - this.getNodeAppearanceService().mergeNodeAppearance( - nodeModel.getId(), nodeModel.getPosition().getLeft(), - nodeModel.getPosition().getTop()); - if (nodeModel.getConfigurations() != null) { - for (ConfigurationItemModel configurationItemModel : nodeModel - .getConfigurations()) { - this.getNodeConfigurationProfileService() - .mergeNodeConfiguration(nodeModel.getId(), - configurationItemModel.getKey(), - configurationItemModel.getValue()); - } - } - nodes.add(node); - } - for (EdgeModel edgeModel : model.getEdges()) { - if (!edgeModel.getFlowId().equals(flowId)) { - return false; - } - Edge edge = new Edge(); - edge.setFlow(null); - edge.setId(edgeModel.getId()); - edge.setSourceNode(new Node()); - edge.getSourceNode().setId(edgeModel.getSourceNodeId()); - edge.setSourceEndpoint(edgeModel.getSourceEndpoint()); - edge.setTargetNode(new Node()); - edge.getTargetNode().setId(edgeModel.getTargetNodeId()); - edge.setTargetEndpoint(edgeModel.getTargetEndpoint()); - edges.add(edge); - } - boolean result = true; - result = result - && this.getFlowService().saveFlow(flowId, model.getName(), - nodes, edges); - result = result - && this.getNodeAppearanceService() - .cleanUpOrphanNodeAppearance(); - result = result - && this.getNodeConfigurationProfileService() - .cleanUpOrphanNodeConfiguration(); - return result; - } - - public RemoveFlowResultModel removeFlow(UUID flowId, RemoveFlowModel model) { - boolean success = this.getFlowService().removeFlow(flowId); - success = success - && this.getNodeAppearanceService() - .cleanUpOrphanNodeAppearance(); - success = success - && this.getNodeConfigurationProfileService() - .cleanUpOrphanNodeConfiguration(); - RemoveFlowResultModel result = new RemoveFlowResultModel(); - result.setFlowId(flowId); - result.setSuccess(success); - if (success) { - result.setMessage("success"); - } else { - result.setMessage("fail"); - } - return result; - } -} -======= package haflow.ui.helper; import java.util.ArrayList; @@ -430,4 +213,3 @@ public class FlowHelper { return result; } } ->>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index 4a05644..ed53e91 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -1,30 +1,3 @@ -<<<<<<< HEAD - - - - - com.mysql.jdbc.Driver - jdbc:mysql://localhost:3306/haflow - - root - 123456 - 20 - false - false - true - utf-8 - org.hibernate.dialect.MySQLDialect - update - - - - - - - - - -======= @@ -52,5 +25,4 @@ ->>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git diff --git a/src/main/webapp/WEB-INF/views/logon.jsp b/src/main/webapp/WEB-INF/views/logon.jsp index 323f71e..04468f8 100644 --- a/src/main/webapp/WEB-INF/views/logon.jsp +++ b/src/main/webapp/WEB-INF/views/logon.jsp @@ -1,48 +1,3 @@ -<<<<<<< HEAD -<%@ page language="java" contentType="text/html; charset=utf-8" - pageEncoding="utf-8"%> -<% - String path = request.getContextPath(); - String basePath = request.getScheme() + "://" - + request.getServerName() + ":" + request.getServerPort() - + path + "/"; -%> - - - - - -Haflow Logon - - -
-
-

大数据分析服务平台

-
-
-
- -
-
- -
- 用户名: -

-
- 密码: -

-
- -    - -
-
-
-
-
- - -======= <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <% @@ -98,4 +53,3 @@ ->>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git diff --git a/src/main/webapp/WEB-INF/views/main.jsp b/src/main/webapp/WEB-INF/views/main.jsp index af8efc3..84dd2cf 100644 --- a/src/main/webapp/WEB-INF/views/main.jsp +++ b/src/main/webapp/WEB-INF/views/main.jsp @@ -1,43 +1,3 @@ -<<<<<<< HEAD -<%@ page language="java" contentType="text/html; charset=utf-8" - pageEncoding="utf-8"%> - -<% - String path = request.getContextPath(); - String basePath = request.getScheme() + "://" - + request.getServerName() + ":" + request.getServerPort() - + path + "/"; -%> - - - -Haflow - a big data analysis service platform! - - - - - - - - - - - - - - - - - - -======= <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> @@ -88,5 +48,4 @@ ->>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git diff --git a/src/main/webapp/style/haflow.main.css b/src/main/webapp/style/haflow.main.css index 0a1ed8b..3673ea2 100644 --- a/src/main/webapp/style/haflow.main.css +++ b/src/main/webapp/style/haflow.main.css @@ -1,84 +1,3 @@ -<<<<<<< HEAD -@CHARSET "UTF-8"; - -.node { - width: 8em; - padding: 1em; - position: absolute; - z-index: 4; - border-radius: 1em; - box-shadow: 2px 2px 19px #e0e0e0; - -o-box-shadow: 2px 2px 19px #e0e0e0; - -webkit-box-shadow: 2px 2px 19px #e0e0e0; - -moz-box-shadow: 2px 2px 19px #e0e0e0; - -moz-border-radius: 0.5em; - border-radius: 0.5em; - opacity: 0.8; - filter: alpha(opacity-80); - cursor: move; - border: 2px solid #346789; -} - -.module { - margin-top: 10px; - margin-bottom: 10px; - margin-left: auto; - margin-right: auto; - width: 8em; - padding: 1em; - z-index: 4; - border-radius: 1em; - box-shadow: 2px 2px 19px #e0e0e0; - -o-box-shadow: 2px 2px 19px #e0e0e0; - -webkit-box-shadow: 2px 2px 19px #e0e0e0; - -moz-box-shadow: 2px 2px 19px #e0e0e0; - -moz-border-radius: 0.5em; - border-radius: 0.5em; - opacity: 0.8; - filter: alpha(opacity-80); - cursor: move; - border: 2px solid #346789; -} - -.flowcontainer { - position: relative; - width: 2000px; - height: 1500px; -} - -.configuration { - margin: 3px; -} - -.configuration-content { - margin-bottom: 5px; -} - -.center { - margin-left: auto; - margin-right: auto; -} - -} -._jsPlumb_endpoint { - z-index: 9; -} - -._jsPlumb_overlay { - z-index: 4; -} - -._jsPlumb_endpoint_anchor_ { - z-index: 9; -} - -.dragHover { - border: 1px dotted red; -} - -path { - cursor: pointer; -======= @CHARSET "UTF-8"; .dijitDisabled.dijitButtonDisabled .dijitButtonNode { @@ -164,5 +83,4 @@ path { path { cursor: pointer; ->>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git }