示例#1
0
  private void writeQuery(QueryInfo query) {

    this.xmlWriter.addElement(HbmConstants.QUERY_EL);

    String comment = null;

    if (!ObjectUtils.isNullOrEmpty(query.getComment())) {
      comment = query.getComment();
    }
    if (query.getIsGenerated()) {
      if (comment != null) {
        this.xmlWriter.forceCloseOnNewLine();
      }
      comment = DataServiceUtils.addGeneratedAnnotation(comment, this.xmlWriter);
    }

    this.xmlWriter.addAttribute(HbmConstants.NAME_ATTR, query.getName());

    if (comment != null) {
      this.xmlWriter.addAttribute(HbmConstants.COMMENT_ATTR, XMLUtils.escape(comment));
    }

    for (Input input : query.getInputs()) {
      String name = input.getParamName();
      String type = input.getParamType();
      if (input.getList()) {
        type = List.class.getName() + "<" + type + ">";
      }

      type = XMLUtils.escape(type);

      this.xmlWriter.addClosedElement(
          HbmConstants.QUERY_PARAM_EL, HbmConstants.NAME_ATTR, name, HbmConstants.TYPE_ATTR, type);
    }

    this.xmlWriter.addText(query.getQuery());

    this.xmlWriter.closeElement();
  }
 protected com.wavemaker.tools.io.File getCfgFile(String serviceId) {
   return this.mgr
       .getServiceRuntimeFolder(serviceId)
       .getFile(DataServiceUtils.getCfgFileName(serviceId));
 }