Package jnode.dto

Examples of jnode.dto.Echoarea


  }

  @Override
  public void run() {
    logger.l1("StatPoster activated");
    Echoarea area = FtnTools.getAreaByName(getTechEchoarea(), null);
    for (IStatPoster poster : posters) {
      String text = poster.getText();
      if (text != null && text.length() != 0) {
        FtnTools.writeEchomail(area, poster.getSubject(), text);
        logger.l3("Posted stat from robot "
View Full Code Here


  }

  @Override
  public void handle(IEvent event) {
    if (event instanceof NewEchoareaEvent) {
      Echoarea area = FtnTools.getAreaByName(poster.getTechEchoarea(),
          null);
      FtnTools.writeEchomail(area, "New echoarea created",
          event.getEvent());

    }
View Full Code Here

    public NewsGroup newsGroup(final String groupName, Auth auth) {
        if (Constants.NETMAIL_NEWSGROUP_NAME.equalsIgnoreCase(groupName)) {
            return netmail(auth);
        }

        Echoarea area = echoareaDAO.getFirstAnd("name", "=", groupName);
        if (area == null) {
            // area not found
            return null;
        }
        return convert(area, auth);
View Full Code Here

   * @param name
   * @param link
   * @return
   */
  public static Echoarea getAreaByName(String name, Link link) {
    Echoarea ret;
    name = name.toLowerCase();
    ret = ORMManager.get(Echoarea.class).getFirstAnd("name", "=", name);
    if (ret == null) {
      if (link == null
          || getOptionBooleanDefFalse(link,
              LinkOption.BOOLEAN_AUTOCREATE_AREA)) {
        ret = new Echoarea();
        ret.setName(name);
        ret.setDescription("Autocreated echoarea");
        ret.setReadlevel((link != null) ? getOptionLong(link,
            LinkOption.LONG_LINK_LEVEL) : 0);
        ret.setWritelevel((link != null) ? getOptionLong(link,
            LinkOption.LONG_LINK_LEVEL) : 0);
        ret.setGroup((link != null) ? getOptionString(link,
            LinkOption.SARRAY_LINK_GROUPS).split(" ")[0] : "");
        logger.l3("Echoarea " + name.toUpperCase() + " created");
        ORMManager.get(Echoarea.class).save(ret);
        if (link != null) {
          Subscription sub = new Subscription();
          sub.setArea(ret);
          sub.setLink(link);
          ORMManager.get(Subscription.class).save(sub);
        }
        Notifier.INSTANSE.notify(new NewEchoareaEvent(name, link));
      }
    } else {
      if (link != null
          && ORMManager.get(Subscription.class).getFirstAnd(
              "echoarea_id", "=", ret.getId(), "link_id", "=",
              link.getId()) == null) {
        ret = null;
      }
    }
    return ret;
View Full Code Here

      builder.printLine(items);
    }

    String text = builder.getText().toString();
    if (text.length() != 0) {
      Echoarea area = FtnTools.getAreaByName(echoarea, null);
      FtnTools.writeEchomail(area, subject, text);
      logger.l5("send message to " + echoarea);
    }
  }
View Full Code Here

        writeStringToEchoarea(echoArea, subject, content);
  }

    public void writeStringToEchoarea(String echoArea, String subject,
                                      String content){
        Echoarea area = FtnTools.getAreaByName(echoArea, null);
        FtnTools.writeEchomail(area, subject, content);
    }
View Full Code Here

    public void postNewsToEchoarea(String title, String echoarea, String url, String datafile, int limit) {

        logger.l5(MessageFormat.format("postNewsToEchoarea title = {0}, echoarea = {1}, url = {2}",
                title, echoarea, url));

        Echoarea area = FtnTools.getAreaByName(echoarea, null);
        if (area == null) {
            logger.l4("No such echoarea - " + echoarea);
            return;
        }
View Full Code Here

  private static final Logger logger = Logger
      .getLogger(WriteStatToEchoareaHelper.class);

  public void writeStatToEchoarea(String echoArea, String subject,
      String statfilename, boolean reset) {
    Echoarea area = FtnTools.getAreaByName(echoArea, null);
        String content = ConnectionStat.getText(statfilename, reset);

    FtnTools.writeEchomail(area, subject, content);

  }
View Full Code Here

    }

    {
      List<Echoarea> areas = ORMManager.get(Echoarea.class).getAll();
      if (areas.isEmpty()) {
        Echoarea local = new Echoarea();
        local.setDescription("Local echoarea");
        local.setName(FtnTools.getPrimaryFtnAddress().getNode()
            + ".local");
        local.setGroup("");
        ORMManager.get(Echoarea.class).save(local);
        Subscription sub = new Subscription();
        sub.setArea(local);
        sub.setLink(owner);
        ORMManager.get(Subscription.class).save(sub);
        FtnTools.writeEchomail(local, "Your new jNode installation",
            "Welcome aboard!\n\nYou've just installed. Enjoy in Fidonet now!");
        logger.l1("[+] created local echoarea " + local.getName());
      }
    }
    ORMManager.get(Version.class).save(DefaultVersion.getSelf());
    logger.l1("Installation completed!");
  }
View Full Code Here

    String code = null;
    String delete = req.queryParams("did");
    if (delete != null) {
      try {
        Long eid = Long.valueOf(delete);
        Echoarea deleteArea = ORMManager.get(Echoarea.class).getById(
            eid);
        if (deleteArea != null) {
          FtnTools.delete(deleteArea);
        }
      } catch (RuntimeException e) {
        code = "ERROR";
      }
    } else {
      try {
        Echoarea ea;
        if (!name.matches("^[-a-zA-Z0-9_\\.]+$")) {
          code = "ENAME";
        } else {
          if (id == null || "0".equals(id)) {
            ea = new Echoarea();
            ea.setName(name);
          } else {
            Long eid = Long.valueOf(id);
            ea = ORMManager.get(Echoarea.class).getById(eid);
          }
          ea.setDescription(descr);
          ea.setReadlevel(Long.valueOf(rl));
          ea.setWritelevel(Long.valueOf(wl));
          ea.setGroup(gr);
          synchronized (Echoarea.class) {
            if (ea.getId() == null
                && ORMManager.get(Echoarea.class).getFirstAnd(
                    "name", "=", ea.getName()) != null) {
              code = "EXISTS";
            } else {
              ORMManager.get(Echoarea.class).saveOrUpdate(ea);
            }
          }
View Full Code Here

TOP

Related Classes of jnode.dto.Echoarea

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.