當前位置: 首頁>>代碼示例>>Java>>正文


Java Flow.getNodes方法代碼示例

本文整理匯總了Java中azkaban.flow.Flow.getNodes方法的典型用法代碼示例。如果您正苦於以下問題:Java Flow.getNodes方法的具體用法?Java Flow.getNodes怎麽用?Java Flow.getNodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在azkaban.flow.Flow的用法示例。


在下文中一共展示了Flow.getNodes方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFlowJobTypes

import azkaban.flow.Flow; //導入方法依賴的package包/類
private List<String> getFlowJobTypes(Flow flow) {
    Set<String> jobTypeSet = new HashSet<String>();
    for (Node node : flow.getNodes()) {
        jobTypeSet.add(node.getType());
    }
    List<String> jobTypes = new ArrayList<String>();
    jobTypes.addAll(jobTypeSet);
    return jobTypes;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:10,代碼來源:ProjectManagerServlet.java

示例2: setFlow

import azkaban.flow.Flow; //導入方法依賴的package包/類
protected void setFlow(Project project, Flow flow) {
  this.flowId = flow.getId();
  flowProps.putAll(flow.getAllFlowProps());

  for (Node node : flow.getNodes()) {
    String id = node.getId();
    if (node.getType().equals(SpecialJobTypes.EMBEDDED_FLOW_TYPE)) {
      String embeddedFlowId = node.getEmbeddedFlowId();
      Flow subFlow = project.getFlow(embeddedFlowId);

      ExecutableFlowBase embeddedFlow =
          new ExecutableFlowBase(project, node, subFlow, this);
      executableNodes.put(id, embeddedFlow);
    } else {
      ExecutableNode exNode = new ExecutableNode(node, this);
      executableNodes.put(id, exNode);
    }
  }

  for (Edge edge : flow.getEdges()) {
    ExecutableNode sourceNode = executableNodes.get(edge.getSourceId());
    ExecutableNode targetNode = executableNodes.get(edge.getTargetId());

    if (sourceNode == null) {
      System.out.println("Source node " + edge.getSourceId()
          + " doesn't exist");
    }
    sourceNode.addOutNode(edge.getTargetId());
    targetNode.addInNode(edge.getSourceId());
  }
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:32,代碼來源:ExecutableFlowBase.java

示例3: getFlowJobTypes

import azkaban.flow.Flow; //導入方法依賴的package包/類
private List<String> getFlowJobTypes(Flow flow) {
  Set<String> jobTypeSet = new HashSet<String>();
  for (Node node : flow.getNodes()) {
    jobTypeSet.add(node.getType());
  }
  List<String> jobTypes = new ArrayList<String>();
  jobTypes.addAll(jobTypeSet);
  return jobTypes;
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:10,代碼來源:ProjectManagerServlet.java

示例4: fillFlowInfo

import azkaban.flow.Flow; //導入方法依賴的package包/類
private void fillFlowInfo(Project project, String flowId, HashMap<String, Object> ret) {
	Flow flow = project.getFlow(flowId);
	
	ArrayList<Map<String, Object>> nodeList = new ArrayList<Map<String, Object>>();
	for (Node node: flow.getNodes()) {
		HashMap<String, Object> nodeObj = new HashMap<String, Object>();
		nodeObj.put("id", node.getId());
		nodeObj.put("type", node.getType());
		if (node.getEmbeddedFlowId() != null) {
			nodeObj.put("flowId", node.getEmbeddedFlowId());
			//HashMap<String, Object> embeddedNodeObj = new HashMap<String, Object>();
			fillFlowInfo(project, node.getEmbeddedFlowId(), nodeObj);
			//nodeObj.put("flowData", embeddedNodeObj);
		}
		
		nodeList.add(nodeObj);
		Set<Edge> inEdges = flow.getInEdges(node.getId());
		if (inEdges != null && !inEdges.isEmpty()) {
			ArrayList<String> inEdgesList = new ArrayList<String>();
			for (Edge edge: inEdges) {
				inEdgesList.add(edge.getSourceId());
			}
			Collections.sort(inEdgesList);
			nodeObj.put("in", inEdgesList);
		}
	}
	
	Collections.sort(nodeList, new Comparator<Map<String, Object>>() {
		@Override
		public int compare(Map<String, Object> o1, Map<String, Object> o2) {
			String id = (String)o1.get("id");
			return id.compareTo((String)o2.get("id"));
		}
	});

	ret.put("flow", flowId);
	ret.put("nodes", nodeList);
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:39,代碼來源:ProjectManagerServlet.java

示例5: setFlow

import azkaban.flow.Flow; //導入方法依賴的package包/類
protected void setFlow(Project project, Flow flow) {
	this.flowId = flow.getId();
	flowProps.putAll(flow.getAllFlowProps());
	
	for (Node node: flow.getNodes()) {
		String id = node.getId();
		if (node.getType().equals(SpecialJobTypes.EMBEDDED_FLOW_TYPE)) {
			String embeddedFlowId = node.getEmbeddedFlowId();
			Flow subFlow = project.getFlow(embeddedFlowId);
			
			ExecutableFlowBase embeddedFlow = new ExecutableFlowBase(project, node, subFlow, this);
			executableNodes.put(id, embeddedFlow);
		}
		else {
			ExecutableNode exNode = new ExecutableNode(node, this);
			executableNodes.put(id, exNode);
		}
	}
	
	for (Edge edge: flow.getEdges()) {
		ExecutableNode sourceNode = executableNodes.get(edge.getSourceId());
		ExecutableNode targetNode = executableNodes.get(edge.getTargetId());
		
		if (sourceNode == null) {
			System.out.println("Source node " + edge.getSourceId() + " doesn't exist");
		}
		sourceNode.addOutNode(edge.getTargetId());
		targetNode.addInNode(edge.getSourceId());
	}
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:31,代碼來源:ExecutableFlowBase.java

示例6: fillFlowInfo

import azkaban.flow.Flow; //導入方法依賴的package包/類
private void fillFlowInfo(Project project, String flowId,
                          HashMap<String, Object> ret) {
    Flow flow = project.getFlow(flowId);

    if (flow == null) {
        ret.put("error", "The flow=" + flowId + " for the project=" + project.getName() + " doesn't exist.");
        return;
    }

    ArrayList<Map<String, Object>> nodeList = new ArrayList<Map<String, Object>>();
    for (Node node : flow.getNodes()) {
        HashMap<String, Object> nodeObj = new HashMap<String, Object>();
        nodeObj.put("id", node.getId());
        nodeObj.put("type", node.getType());
        if (node.getEmbeddedFlowId() != null) {
            nodeObj.put("flowId", node.getEmbeddedFlowId());
            fillFlowInfo(project, node.getEmbeddedFlowId(), nodeObj);
        }

        nodeList.add(nodeObj);
        Set<Edge> inEdges = flow.getInEdges(node.getId());
        if (inEdges != null && !inEdges.isEmpty()) {
            ArrayList<String> inEdgesList = new ArrayList<String>();
            for (Edge edge : inEdges) {
                inEdgesList.add(edge.getSourceId());
            }
            Collections.sort(inEdgesList);
            nodeObj.put("in", inEdgesList);
        }
    }

    Collections.sort(nodeList, new Comparator<Map<String, Object>>() {
        @Override
        public int compare(Map<String, Object> o1, Map<String, Object> o2) {
            String id = (String) o1.get("id");
            return id.compareTo((String) o2.get("id"));
        }
    });

    ret.put("flow", flowId);
    ret.put("nodes", nodeList);
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:43,代碼來源:ProjectManagerServlet.java


注:本文中的azkaban.flow.Flow.getNodes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。