Example #1
0
  private void graphPruductLineAddOrUpdate(Payload payload, Model model) {
    String name = payload.getProductLineName();
    String type = payload.getType();

    if (!StringUtils.isEmpty(name)) {
      model.setProductLine(m_productLineConfigManger.findProductLine(name, type));
    }
  }
Example #2
0
  private Pair<Boolean, String> graphProductLineConfigAddOrUpdateSubmit(
      Payload payload, Model model) {
    ProductLine line = payload.getProductLine();
    String[] domains = payload.getDomains();
    String type = payload.getType();

    return m_productLineConfigManger.insertProductLine(line, domains, type);
  }
Example #3
0
  public void process(Action action, Payload payload, Model model) {
    switch (action) {
      case TOPOLOGY_GRAPH_NODE_CONFIG_LIST:
        model.setGraphConfig(m_topologyConfigManager.getConfig());
        break;
      case TOPOLOGY_GRAPH_NODE_CONFIG_ADD_OR_UPDATE:
        graphNodeConfigAddOrUpdate(payload, model);
        model.setProjects(m_globalConfigManager.queryAllProjects());
        break;
      case TOPOLOGY_GRAPH_NODE_CONFIG_ADD_OR_UPDATE_SUBMIT:
        model.setOpState(graphNodeConfigAddOrUpdateSubmit(payload, model));
        model.setGraphConfig(m_topologyConfigManager.getConfig());
        break;
      case TOPOLOGY_GRAPH_NODE_CONFIG_DELETE:
        model.setOpState(graphNodeConfigDelete(payload));
        model.setConfig(m_topologyConfigManager.getConfig());
        break;
      case TOPOLOGY_GRAPH_EDGE_CONFIG_LIST:
        model.setGraphConfig(m_topologyConfigManager.getConfig());
        model.buildEdgeInfo();
        break;
      case TOPOLOGY_GRAPH_EDGE_CONFIG_ADD_OR_UPDATE:
        graphEdgeConfigAdd(payload, model);
        model.setProjects(m_globalConfigManager.queryAllProjects());
        break;
      case TOPOLOGY_GRAPH_EDGE_CONFIG_ADD_OR_UPDATE_SUBMIT:
        model.setOpState(graphEdgeConfigAddOrUpdateSubmit(payload, model));
        model.setGraphConfig(m_topologyConfigManager.getConfig());
        model.buildEdgeInfo();
        break;
      case TOPOLOGY_GRAPH_EDGE_CONFIG_DELETE:
        model.setGraphConfig(m_topologyConfigManager.getConfig());
        model.setOpState(graphEdgeConfigDelete(payload));
        model.buildEdgeInfo();
        break;
      case TOPOLOGY_GRAPH_PRODUCT_LINE:
        model.setProductLines(m_productLineConfigManger.queryAllProductLines());
        model.setTypeToProductLines(m_productLineConfigManger.queryTypeProductLines());
        break;
      case TOPOLOGY_GRAPH_PRODUCT_LINE_ADD_OR_UPDATE:
        graphPruductLineAddOrUpdate(payload, model);
        model.setProjects(m_globalConfigManager.queryAllProjects());
        break;
      case TOPOLOGY_GRAPH_PRODUCT_LINE_DELETE:
        model.setOpState(
            m_productLineConfigManger.deleteProductLine(
                payload.getProductLineName(), payload.getType()));
        model.setProductLines(m_productLineConfigManger.queryAllProductLines());
        model.setTypeToProductLines(m_productLineConfigManger.queryTypeProductLines());
        break;
      case TOPOLOGY_GRAPH_PRODUCT_LINE_ADD_OR_UPDATE_SUBMIT:
        Pair<Boolean, String> addProductlineResult =
            graphProductLineConfigAddOrUpdateSubmit(payload, model);
        String duplicateDomains = addProductlineResult.getValue();

        model.setOpState(addProductlineResult.getKey());
        if (!StringUtils.isEmpty(duplicateDomains)) {
          model.setDuplicateDomains(addProductlineResult.getValue());
        }
        model.setProductLines(m_productLineConfigManger.queryAllProductLines());
        model.setTypeToProductLines(m_productLineConfigManger.queryTypeProductLines());
        break;
      case TOPO_GRAPH_FORMAT_CONFIG_UPDATE:
        String topoGraphFormat = payload.getContent();
        if (!StringUtils.isEmpty(topoGraphFormat)) {
          model.setOpState(m_formatConfigManager.insert(topoGraphFormat));
        }
        model.setContent(m_formatConfigManager.getConfig().toString());
        break;
      default:
        throw new RuntimeException("Error action name " + action.getName());
    }
  }