コード例 #1
0
  public List<Object> getChildren(TreeItem treeItem) {
    List<Object> result = new ArrayList<Object>();
    //
    Object dataObj = treeItem.getDataObject();
    if (isLeafDataObject(dataObj)) {
      return result;
    }

    if (dataObj instanceof TMapModel) { // tMapModel is the root
      result.addAll(getImportedModels(myTMapModel, myPtTreeFilter));
      result.add(NodeType.NON_IMPORTED_ARTIFACTS);
    } else if (dataObj == NodeType.NON_IMPORTED_ARTIFACTS) {
      result.addAll(getNonImportedModels(myTMapModel, myPtTreeFilter));
    } else if (dataObj instanceof WSDLModel) {
      Definitions defs = ((WSDLModel) dataObj).getDefinitions();
      Collection<PortType> pts = defs != null ? defs.getPortTypes() : null;
      if (pts != null) {
        for (PortType pt : pts) {
          result.add(pt);
        }
      }
    } else if (dataObj instanceof PortType) {
      Collection<Operation> ops = ((PortType) dataObj).getOperations();
      if (ops != null) {
        for (Operation op : ops) {
          result.add(op);
        }
      }
    }
    //
    return result;
  }
コード例 #2
0
  /**
   * @param model - wsdlModel
   * @param pt - portType
   * @return true in case model contains pt or pt is null
   */
  private static boolean hasPortType(WSDLModel model, PortType portType) {
    assert model != null;
    if (portType == null) {
      return true;
    }

    Definitions defs = model.getDefinitions();
    if (defs == null) {
      return false;
    }

    Collection<PortType> pts = defs.getPortTypes();
    if (pts == null || pts.size() <= 0) {
      return false;
    }

    for (PortType pt : pts) {
      if (portType.equals(pt)) {
        return true;
      }
    }

    return false;
  }