Package jnode.dto

Examples of jnode.dto.Filearea


   * @param header
   * @param footer
   */
  public void hatchToArea(String areaName, String zip, String seg,
      String dir, String header, String footer) {
    Filearea area = FtnTools.getFileareaByName(areaName, null);
    File attachment = createPointList(getFilename(seg), dir, header, footer);
    FtnTools.hatchFile(
        area,
        attachment,
        getFilename(zip),
View Full Code Here


   * @param name
   * @param link
   * @return
   */
  public static Filearea getFileareaByName(String name, Link link) {
    Filearea ret;
    name = name.toLowerCase();
    ret = ORMManager.get(Filearea.class).getFirstAnd("name", "=", name);
    if (ret == null) {
      if (link == null
          || getOptionBooleanDefFalse(link,
              LinkOption.BOOLEAN_AUTOCREATE_AREA)) {
        ret = new Filearea();
        ret.setName(name);
        ret.setDescription("Autocreated filearea");
        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("Filearea " + name + " created");
        ORMManager.get(Filearea.class).save(ret);
        if (link != null) {
          FileSubscription sub = new FileSubscription();
          sub.setArea(ret);
          sub.setLink(link);
          ORMManager.get(FileSubscription.class).save(sub);
        }
        Notifier.INSTANSE.notify(new NewFileareaEvent(name, link));
      }
    } else {
      if (link != null
          && ORMManager.get(FileSubscription.class).getFirstAnd(
              "filearea_id", "=", ret.getId(), "link_id", "=",
              link.getId()) == null) {
        ret = null;
      }
    }
    return ret;
View Full Code Here

    String code = null;
    String delete = req.queryParams("did");
    if (delete != null) {
      try {
        Long eid = Long.valueOf(delete);
        Filearea deleteArea = ORMManager.get(Filearea.class).getById(
            eid);
        if (deleteArea != null) {
          FtnTools.delete(deleteArea);
        }
      } catch (RuntimeException e) {
        code = "ERROR";
      }
    } else {
      try {
        Filearea ea;
        if (!name.matches("^[-a-zA-Z0-9_\\.]+$")) {
          code = "ENAME";
        } else {
          if (id == null || "0".equals(id)) {
            ea = new Filearea();
            ea.setName(name);
          } else {
            Long eid = Long.valueOf(id);
            ea = ORMManager.get(Filearea.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(Filearea.class).getFirstAnd(
                    "name", "=", ea.getName()) != null) {
              code = "EXISTS";
            } else {
              ORMManager.get(Filearea.class).saveOrUpdate(ea);
            }
          }
View Full Code Here

TOP

Related Classes of jnode.dto.Filearea

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.