bug fix after merge.

This commit is contained in:
keyeqing 2013-10-09 15:57:52 +08:00
parent c3ffff9891
commit 74804f1da3
8 changed files with 2 additions and 525 deletions

View File

@ -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());

View File

@ -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

View File

@ -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

View File

@ -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<Flow> flowList = this.getFlowService().getFlowList();
FlowListModel flowListModel = new FlowListModel();
flowListModel.setFlows(new ArrayList<FlowBriefModel>());
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<NodeModel>());
for (Node node : flow.getNodes()) {
NodeModel nodeModel = new NodeModel();
NodeAppearance nodeAppearanceProfile = this
.getNodeAppearanceService().getNodeAppearance(
node.getId());
List<NodeConfiguration> 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<ConfigurationItemModel>());
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<EdgeModel>());
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<Node> nodes = new HashSet<Node>();
Set<Edge> edges = new HashSet<Edge>();
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

View File

@ -1,30 +1,3 @@
<<<<<<< HEAD
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver </property>
<property name="hibernate.connection.url"> jdbc:mysql://localhost:3306/haflow
</property>
<property name="hibernate.connection.username">root </property>
<property name="hibernate.connection.password">123456 </property>
<property name="hibernate.connection.pool.size">20 </property>
<property name="hibernate.show_sql">false </property>
<property name="format_sql">false</property>
<property name="Connection.useUnicode">true </property>
<property name="connection.characterEncoding">utf-8 </property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect </property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping class="haflow.dto.entity.Edge" />
<mapping class="haflow.dto.entity.Flow" />
<mapping class="haflow.dto.entity.Node" />
<mapping class="haflow.dto.entity.FlowRunHistory" />
<mapping class="haflow.dto.profile.NodeAppearance" />
<mapping class="haflow.dto.profile.NodeConfiguration" />
</session-factory>
=======
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
@ -52,5 +25,4 @@
<mapping class="haflow.dto.profile.NodeAppearance" />
<mapping class="haflow.dto.profile.NodeConfiguration" />
</session-factory>
>>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git
</hibernate-configuration>

View File

@ -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 + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="<%=basePath%>/style/index.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Haflow Logon</title>
</head>
<body>
<div class="wrapper">
<div class="title">
<h1>大数据分析服务平台</h1>
</div>
<div class="content">
<div class="left">
<img src="<%=basePath%>/images/logon.png" />
</div>
<div class="right">
<!-- <h2>登录</h2> -->
<div class="field">
<span style="float: left; width: 80px;">用户名:</span><input type="text" />
</div><br/>
<div class="field">
<span style="float: left; width: 80px;">密码:</span><input type="password" />
</div><br/>
<div>
<button style="width: 70px;height: 35px; font-family:Arial;font-size:14px;font-weight:bold;color:#333333;" type="button" onclick="window.location.href='main'">登录</button>
&nbsp;&nbsp;
<button style="width: 120px;height: 35px; font-family:Arial;font-size:14px;font-weight:normal;color:#333333;" type="button" onclick="window.location.href='admin'">管理员登录</button>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</body>
</html>
=======
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%
@ -98,4 +53,3 @@
</div>
</body>
</html>
>>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git

View File

@ -1,43 +1,3 @@
<<<<<<< HEAD
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Haflow - a big data analysis service platform!</title>
<link rel="stylesheet"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dijit/themes/claro/claro.css">
<link rel="stylesheet"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dojox/layout/resources/ScrollPane.css">
<link rel="stylesheet" href="<%=basePath%>/style/haflow.css">
<link rel="stylesheet" href="<%=basePath%>/style/haflow.ui.css">
<link rel="stylesheet" href="<%=basePath%>/style/haflow.main.css">
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script type="text/javascript"
src="script/jsPlumb/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript"
src="script/jsPlumb/jquery.jsPlumb-1.4.1-all.js"></script>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dojo/dojo.js"></script>
<script type="text/javascript" src="<%=basePath%>/script/haflow.js"></script>
<script type="text/javascript" src="<%=basePath%>/script/haflow.ui.js"></script>
<script type="text/javascript" src="<%=basePath%>/script/haflow.main.js"></script>
</head>
<body class="claro">
<input type="hidden" value="<%=basePath%>" id="basePath" />
</body>
=======
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@ -88,5 +48,4 @@
<input type="hidden" value="<%=basePath%>" id="basePath" />
</body>
>>>>>>> branch 'master' of https://github.com/justinliucs/haflow.git
</html>

View File

@ -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
}