Package com.google.code.apis.rest.client.Wadl

Examples of com.google.code.apis.rest.client.Wadl.ParamNode


  }
 
  public void addParam(ParamNode param) {
    Iterator allParamsIterator = allParams.iterator();
    while(allParamsIterator.hasNext()) {
      ParamNode parameter = (ParamNode) allParamsIterator.next();
      if (param.getName().equals(parameter.getName())) {
        // the param to be inserted is already contained
        return;
      }
    }   
    allParams.add(param);
View Full Code Here


                  indexOfOpen < indexOfClose) {         
                String templateParamName = path.substring(indexOfOpen + 1, indexOfClose);
                // from all the potential params find the one that matches the template {name}
                Vector templateParams = resource.getAllParams();
                Iterator templateParamsIterator = templateParams.iterator();         
                ParamNode templateParam = null;
                if (templateParamsIterator.hasNext()) {
                  templateParam = (ParamNode) templateParamsIterator.next();
                }
                while(!templateParam.getName().equals(templateParamName)) {
                  templateParam = (ParamNode) templateParamsIterator.next();
                }
                // now generate the code generation parameter      
                Parameter templateParameter = new Parameter(
                    templateParamName + SettingsDialog.templateSuffix,
                    templateParam.getType(),
                    Parameter.accessPrivate,
                    templateParam.getIsRequired(),              
                    language,
                    true);
                variables.insertElementAt(templateParameter, 0);               
               
                path = path.substring(indexOfClose + 1);
View Full Code Here

    // use a operation parameter value as name
    else {
      Vector parameters = request.getAllParams();
      Iterator parametersIterator = parameters.iterator();
      while(parametersIterator.hasNext()) {
        ParamNode param = (ParamNode) parametersIterator.next();       
        if (param.getName().equalsIgnoreCase(RestCompilePanel.paramToUseForName)) {
          name = param.getValue();
          break;
        }       
      }           
    }
    name = cleanName(name, false);
View Full Code Here

            treatFault(referencedFault);
            return;
          }
        }
        else if (referenceNode instanceof ParamNode) {
          ParamNode referencedParam = (ParamNode) allObjectsIterator.next();         
          if (referencedParam.getId().equals(href)) {
            treatParam(referencedParam);           
            return;
          }
        }
        else if (referenceNode instanceof RepresentationNode) {
View Full Code Here

    variables.clear();
    if (request.getAllParams() != null) {
      Vector allParams = request.getAllParams();     
      Iterator paramIterator = allParams.iterator();
      while (paramIterator.hasNext()) {
        ParamNode p = (ParamNode) paramIterator.next();     
        treatParam(p);       
      }
    }  
   
    // get the http method name and the request name
    MethodNode thisRequestsMethod = ((MethodNode) request.getParent());
    String httpMethodName = thisRequestsMethod.getName();  
    String absoluteAddress = null;
    String name = null;
    Object thisRequestsMethodsParent = (Object) thisRequestsMethod.getParent();
    if (thisRequestsMethodsParent instanceof ResourceNode) {
      ResourceNode resource = (ResourceNode) thisRequestsMethodsParent;
      name = resource.getPath();
      absoluteAddress = resource.getAbsolutePath() + resource.getPath();     
      // check if we have template parameters
      while (resource.getPath().matches(Analyzer.templateParamRegExp)) {
        // don't confuse: param is from the WADL, parameter is for code generation
        String path = resource.getPath();       
        int indexOfOpen = path.indexOf(Analyzer.templateParamOpenChar);
        int indexOfClose = path.indexOf(Analyzer.templateParamCloseChar);       
        while(indexOfOpen >= 0 &&
            indexOfClose > 0 &&
            indexOfOpen < indexOfClose) {         
          String templateParamName = path.substring(indexOfOpen + 1, indexOfClose);
          // from all the potential params find the one that matches the template {name}
          Vector templateParams = resource.getAllParams();
          Iterator templateParamsIterator = templateParams.iterator();         
          ParamNode templateParam = null;
          if (templateParamsIterator.hasNext()) {
            templateParam = (ParamNode) templateParamsIterator.next();
          }
          while(!templateParam.getName().equals(templateParamName)) {
            templateParam = (ParamNode) templateParamsIterator.next();
          }
          // now generate the code generation parameter      
          Parameter templateParameter = new Parameter(
              templateParamName + SettingsDialog.templateSuffix,
              templateParam.getType(),
              Parameter.accessPrivate,
              templateParam.getIsRequired(),              
              language,
              true);
          variables.insertElementAt(templateParameter, 0);
         
          path = path.substring(indexOfClose + 1);
View Full Code Here

    }
   
    int paramCounter = 0;
    Iterator paramIterator = allParams.iterator();   
    while (paramIterator.hasNext()) {     
      ParamNode param = (ParamNode) paramIterator.next();
      ParamItem paramItem = new ParamItem(param, (GenericNode) parentNode, parentTreeItem, paramCounter, requestString);
      TreeItem parameterTreeItem = new TreeItem(paramItem);
      parameterTreeItem.setUserObject(WadlXml.paramNode);
      parentTreeItem.addItem(parameterTreeItem);     
      parameterTreeItem.setState(SettingsDialog.treeItemsAlwaysOpen);
      paramCounter++;
    }
   
    if (!WadlTreeRoot.containsButton(buttonTreeItems, ApplicationItem.button + WadlXml.paramNode)) {
      // add param button
      HorizontalPanel addParamPanel = new HorizontalPanel();
         
      Button addParamButton = new Button(GuiFactory.strings.addParam());
      addParamButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {         
          Analyzer analyzer = null;
          if (parentNode instanceof RequestNode) {   
            ((RequestNode) parentNode).addParam(new ParamNode(GuiFactory.strings.newParam(), (GenericNode) parentNode, ((GenericNode) parentNode).getApplication()));           
            analyzer = ((RequestNode) parentNode).getApplication().getAnalyzer();
          }
          else if (parentNode instanceof ResponseNode) {     
            ((ResponseNode) parentNode).addParam(new ParamNode(GuiFactory.strings.newParam(), (GenericNode) parentNode, ((GenericNode) parentNode).getApplication()));           
            analyzer = ((ResponseNode) parentNode).getApplication().getAnalyzer();
          }
          else if (parentNode instanceof ResourceTypeNode) {     
            ((ResourceTypeNode) parentNode).addParam(new ParamNode(GuiFactory.strings.newParam(), (GenericNode) parentNode, ((GenericNode) parentNode).getApplication()));           
            analyzer = ((ResourceTypeNode) parentNode).getApplication().getAnalyzer();
          }
          else if (parentNode instanceof ResourceNode) {     
            ((ResourceNode) parentNode).addParam(new ParamNode(GuiFactory.strings.newParam(), (GenericNode) parentNode, ((GenericNode) parentNode).getApplication()));           
            analyzer = ((ResourceNode) parentNode).getApplication().getAnalyzer();
          }
          else if (parentNode instanceof FaultNode) {     
            ((FaultNode) parentNode).addParam(new ParamNode(GuiFactory.strings.newParam(), (GenericNode) parentNode, ((GenericNode) parentNode).getApplication()));           
            analyzer = ((FaultNode) parentNode).getApplication().getAnalyzer();
          }
          else if (parentNode instanceof RepresentationNode) {     
            ((RepresentationNode) parentNode).addParam(new ParamNode(GuiFactory.strings.newParam(), (GenericNode) parentNode, ((GenericNode) parentNode).getApplication()));           
            analyzer = ((RepresentationNode) parentNode).getApplication().getAnalyzer();
          }
          else if (parentNode instanceof ApplicationNode) {
            ParamNode param = new ParamNode(GuiFactory.strings.newParam(), (GenericNode) parentNode, (ApplicationNode) parentNode);
            param.setId(GuiFactory.strings.newId());
            ((ApplicationNode) parentNode).addParam(param);           
            analyzer = ((ApplicationNode) parentNode).getAnalyzer();
          }        
          String newRequestString = analyzer.getRequestString();
          if (!newRequestString.equals("")) {
View Full Code Here

      String fixedValue = "";
      String path = "";
      String defaultValue = "";
      String value = queryValues[i];
     
      ParamNode param = new ParamNode(name, type, estimateQuality, style, isRequired, isRepeating, defaultValue, fixedValue, path, value, request, application);
      ApplicationNode.addPotentiallyToBeSharedParam(param);
      DocNode docNode;
      if (queryValues[i].length() > 0) {
        docNode = new DocNode("en", name + sampleValueHeader + queryValues[i] + sampleValueFooter, "", param);
      }
      else {
        docNode = new DocNode("en", name, "", param);
      }
      param.addDoc(docNode);
      request.addParam(param);     
    }
    if (application.getParamsToBeShared().size() > 0) {
      optimizeByOutsourcing();
    }
View Full Code Here

   */
  private void optimizeByOutsourcing() {
    Vector paramsToBeShared = application.getParamsToBeShared();
    Vector usedIds = new Vector();
    for(Iterator i = paramsToBeShared.iterator(); i.hasNext(); /* empty */) {
      ParamNode param = (ParamNode) i.next();
      String id = param.getName() + referenceParamSuffix;
      if (usedIds.contains(id)) {
        int j = 1;
        while(usedIds.contains(id + j)) {
          // empty
        }
        id = id + j;
      }     
      usedIds.add(id);
      param.setId(id);
      application.addParam(param);
      replaceParamByReferenceParam(application.getResources(), param);
    }
  }
View Full Code Here

            RequestNode request = method.getRequest();
            if (request.getAllParams() != null) {
              Vector allParams = request.getAllParams();
              int paramIndex = 0;
              for(Iterator k = ((Vector) allParams.clone()).iterator(); k.hasNext(); /* empty */) {
                ParamNode p = (ParamNode) k.next();
                if (p.getName().equals(param.getName()) &&
                    p.getValue().equals(param.getValue())) {                 
                  request.removeParam(p);                 
                  ParamNode referenceParam = new ParamNode(param.getName(), request, application);
                  referenceParam.setHref("#" + param.getId());
                  request.insertParamAt(referenceParam, paramIndex);                 
                }
                paramIndex++;
              }
            } 
View Full Code Here

      int indexOfClose = path.indexOf(templateParamCloseChar);       
      while(indexOfOpen >= 0 &&
          indexOfClose > 0 &&
          indexOfOpen < indexOfClose) {         
        String templateParamName = path.substring(indexOfOpen + 1, indexOfClose);         
        ParamNode templateParam = new ParamNode(
            templateParamName,
            TypeEstimator.typeString,           
            ParamItem.template,
            resource,
            application);
View Full Code Here

TOP

Related Classes of com.google.code.apis.rest.client.Wadl.ParamNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.