Package org.openqreg.bean

Examples of org.openqreg.bean.TextBean


        // nothing
      }

      // System.out.println(period);

      TextBean textBean = null;
      // System.out.println("xxx5");

      Collection<TextBean> col = null;
      search = decode(search);
      search = "%" + search + "%";
      if (returnAll) {
        col = TextFinderBase.findAll();
      } else {
        col = TextFinder.specSearchByIdText(user, 500, search, search);
      }
      Iterator<TextBean> it = col.iterator();
      // System.out.println("xxx6");

      out.append(
          toXML("totalno", new Integer(col.size()).toString()));
      out.append("<status>");
      out.append("OK");
      out.append("</status>\n");
      out.append("<step>");
      out.append("SEARCH");
      out.append("</step>\n");
      out.append("<texts>\n");
      int i = 0;
      // while (it.hasNext() && i < 5) {
      while (it.hasNext()) {
        textBean = it.next();
        if (i >= pStart && i <= pEnd) {
          out.append("<entry>\n");
          out.append(
              toXML("id", textBean.getId().toString()));
          out.append(
              toXML("languageid", textBean.getLanguageid()));
          //out.append(toXML("text", textBean.getText()));
          out.append(toXML("text", encode(textBean.getText())));
          out.append(
              toXML("document", textBean.getDocument()));
          out.append(
              toXML("tscreated", textBean.getTscreated()
                  .toString().substring(0, 16)));
          if (null != textBean.getTsupdated()) {
            out.append(
                toXML("tsupdated", textBean.getTsupdated()
                    .toString().substring(0, 16)));
          } else {
            out.append(toXML("tsupdated", ""));
          }
          out.append(
              toXML("createdby", textBean.getCreatedby()));
          out.append(
              toXML("updatedby", textBean.getUpdatedby()));
          out.append("</entry>\n");
        }
        i++;
      }
      out.append("</texts>\n");
View Full Code Here


    StringBuffer out = new StringBuffer();
    try {
      String id = incXML.substring(incXML.indexOf("<id>") + 4, incXML
          .indexOf("</id>"));

      TextBean textBean = null;

      Collection<TextBean> col = null;
      col = TextFinder.findByTextid(id);
      Iterator<TextBean> it = col.iterator();

      out.append(toXML("totalno", "1"));
      out.append("<status>");
      out.append("OK");
      out.append("</status>\n");
      out.append("<step>");
      out.append("GETONE");
      out.append("</step>\n");
      out.append("<texts>\n");

      // writes all but the rest of languages
      if (it.hasNext()) {
        textBean = it.next();
        out.append("<entry>\n");
        out.append(toXML("id", textBean.getId().toString()));
        // out.append(toXML("text", textBean.getText()));
        out.append(toXML("text", encode(textBean.getText())));
        out.append(toXML("document", textBean.getDocument()));
        out.append(toXML("tscreated", textBean.getTscreated()
            .toString().substring(0, 16)));
        if (null != textBean.getTsupdated()) {
          out.append(toXML("tsupdated", textBean.getTsupdated()
              .toString().substring(0, 16)));
        } else {
          out.append(toXML("tsupdated", ""));
        }
        out.append(toXML("createdby", textBean.getCreatedby()));
        out.append(toXML("updatedby", textBean.getUpdatedby()));
        out.append("<languages>\n");
        out.append(toXML(textBean.getLanguageid(), encode(textBean
            .getText())));

      }
      // if we have more languages write them
      while (it.hasNext()) {
        textBean = it.next();
        out.append(toXML(textBean.getLanguageid(), encode(textBean
            .getText())));
      }
      out.append("</languages>\n");
      out.append("</entry>\n");
      out.append("</texts>\n");
View Full Code Here

  }

  protected String getDocuments() {
    StringBuffer out = new StringBuffer();
    try {
      TextBean textBean = null;

      Collection<TextBean> col = null;
      col = TextFinder.findUniqueDocuments();
      Iterator<TextBean> it = col.iterator();

      out.append(toXML("totalno", "x"));
      out.append("<status>");
      out.append("OK");
      out.append("</status>\n");
      out.append("<step>");
      out.append("GETDOCUMENTS");
      out.append("</step>\n");
      out.append("<documents>\n");

      while (it.hasNext()) {
        textBean = it.next();
        out.append(toXML("document", textBean.getDocument()));
      }
      out.append("</documents>\n");
    } catch (Exception e) {
      System.out.println("error.asfk");
      System.out.println("error" + e);
View Full Code Here

    StringBuffer out = new StringBuffer();
    try {
      String id = incXML.substring(incXML.indexOf("<id>") + 4, incXML
          .indexOf("</id>"));

      TextBean textBean = null;

      Collection<TextBean> col = null;
      col = TextFinder.findByTextid(id);
      Iterator<TextBean> it = col.iterator();

      out.append(toXML("totalno", "1"));
      out.append("<status>");
      out.append("OK");
      out.append("</status>\n");
      out.append("<step>");
      out.append("GETONE");
      out.append("</step>\n");
      out.append("<texts>\n");

      // writes all but the rest of languages
      if (it.hasNext()) {
        textBean = it.next();
        out.append("<entry>\n");
        out.append(toXML("id", textBean.getId().toString()));
        out.append(toXML("text", textBean.getText()));
        out.append(toXML("document", textBean.getDocument()));
        out.append(
            toXML("tscreated", textBean.getTscreated().toString()
                .substring(0, 16)));
        if (null != textBean.getTsupdated()) {
          out.append(
              toXML("tsupdated", textBean.getTsupdated()
                  .toString().substring(0, 16)));
        } else {
          out.append(toXML("tsupdated", ""));
        }
        out.append(
            toXML("createdby", textBean.getCreatedby()));
        out.append(
            toXML("updatedby", textBean.getUpdatedby()));
        out.append("<languages>\n");
        out.append(
            toXML(textBean.getLanguageid(), textBean.getText()));

      }
      // if we have more languages write them
      while (it.hasNext()) {
        textBean = it.next();
        out.append(
            toXML(textBean.getLanguageid(), textBean.getText()));
      }
      out.append("</languages>\n");
      out.append("</entry>\n");
      out.append("</texts>\n");
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.openqreg.bean.TextBean

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.