Examples of Section


Examples of org.nextime.ion.framework.business.Section

      // add sections
      Mapping.begin();
      Vector sections = Section.listAll();
      Mapping.rollback();
      for (int i = 0; i < sections.size(); i++) {
        Section section = (Section) sections.get(i);
        try {
          URL url =
            new URL(
              frontUrl+"/section/"
                + section.getId()
                + ".html?static=true&nocache=true");
          BufferedReader reader =
            new BufferedReader(
              new InputStreamReader(url.openStream()));
          String content = "<!-- �ON static export -->";
          String line = "";
          while (line != null) {
            line = reader.readLine();
            if (line != null) {
              content += line;
            }
          }

          ZipEntry ze =
            new ZipEntry("section/" + section.getId() + ".html");
          zip.putNextEntry(ze);
          zip.write(content.getBytes());
          zip.closeEntry();
        } catch (Exception e) {
          System.out.println(
            "Static export error, section " + section.getId());
        }
      }

      // add publications
      Mapping.begin();
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

     
      // recup�re une instance sur la Publication
      Publication publication = Publication.getInstance(requestedId);
     
      // recup�re la section de cette publication
      Section section = (Section)publication.listSections().firstElement();
     
      // cr�� le bean de status
      IonStatus status = new IonStatus();
      status.setCurrentSection(section);
      status.setCurrentPublication(publication);
      if( request.getParameter("static")!=null ) status.setIsStatic(true);
      request.setAttribute("ionStatus", status);

      // utilise la metaData "template" de la section
      // pour decider vers quelle vue rediriger le flux
      String template = (String) section.getMetaData("template");
      if (template == null)
        template = "default"
       
      String jsp = SectionTypes.getSectionBean(this,template).getJsp();
     
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

  public Collection selectObjects(Hashtable params) throws SelectException {
    try {
      //Mapping.begin();
      String currentSection = (String)params.get("currentSection");
      Vector v = new Vector();
      Section current = Section.getInstance(currentSection);
      while( current != null ) {
        v.add( current );
        current = current.getParent();
      }
      Collections.reverse(v);
      //Mapping.rollback();
      return v;
    } catch (Exception e) {
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

    TreeControlNode node = tree.findNode(selectedId);

    try {
      Mapping.begin();

      Section section = Section.getInstance(selectedId);
      section.remove();
      // update tree
      try {
        TreeControlNode parent = node.getParent();
        node.remove();
        if (parent != null) {
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

        TreeControlNode node = tree.findNode(selectedId);
               
        try {
          Mapping.begin();         
         
          Section section = Section.getInstance(selectedId);
          String newId = IdGenerator.nextSectionId();
          Section newSection = section.create(section,newId);
          newSection.setMetaData("status","offline");
          request.setAttribute("id",newId);
          // update tree
          TreeControlNode newNode = WcmTreeBuilder.buildNode(newSection);
          node.addChild(newNode);
          newNode.rebuildLast();
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

    // get section
    try {
      Mapping.begin();
     
      Section section = Section.getInstance(request.getParameter("id"));
      TreeControlNode node = ((TreeControl)(request.getSession().getAttribute("treeControlTest"))).findNode(request.getParameter("id"));
      // up or down ?
      if( request.getParameter("type").equals("up") ) {
        section.up();
        node.up();
      } else {
        section.down();
        node.down();
      }
     
      Mapping.commit();
    } catch (Exception e) {
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

    // fill data | first time
    if (sform.getName() == null) {
      try {
        Mapping.begin();
       
        Section section = Section.getInstance(id);
        String template = section.getMetaData("template")+"";
        TypeBean type = SectionTypes.getSectionBean(servlet,template);
        request.setAttribute("types",type.getPublicationTypes());
        request.setAttribute("workflows",Workflow.listTypes());

        Mapping.rollback();
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }

      // Forward to the view page
      return (mapping.findForward("view"));
    }

    // fill data | errors
    if (errors.size() > 0) {
      try {
        Mapping.begin();
       
        Section section = Section.getInstance(id);
        String template = section.getMetaData("template")+"";
        TypeBean type = SectionTypes.getSectionBean(servlet,template);
        request.setAttribute("types",type.getPublicationTypes());
        request.setAttribute(ERROR_KEY,errors);

        Mapping.rollback();
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }

      // Forward to the view page
      return (mapping.findForward("view"));
    }

    // all it's ok : create publication
    try {
      Mapping.begin();
     
      Section section = Section.getInstance(id);
      String newId = IdGenerator.nextPublicationId();
      TypePublication type = TypePublication.getInstance(sform.getType());
      Publication publi = Publication.create(User.getInstance(request.getSession().getAttribute("userLogin")+""),newId,type, section.getMetaData("workflow")+"");
      section.addPublication(publi);
      publi.setMetaData("name", sform.getName());     
      request.setAttribute("id", newId);

      Mapping.commit();
    } catch (Exception e) {
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

      Mapping.begin();

      Vector sections;
      Vector publications;

      Section section = Section.getInstance(request.getParameter("id"));
      sections = section.listSubSections();
      publications = section.listPublications();
      request.setAttribute("section",section);
      request.setAttribute("sectionName", section.getMetaData("name"));
      try {
        String description = SectionTypes.getSectionBean(servlet,section.getMetaData("template")+"").getDescription();
        request.setAttribute("sectionDescription", description);
      } catch (Exception e) {
        //e.printStackTrace();
      }
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

    // fill data | first time
    if (sform.getName() == null) {
      try {
        Mapping.begin();
        Section section = Section.getInstance(id);
        Mapping.rollback();

        request.setAttribute("section", section);
        sform.setName(
          (section.getMetaData("name") != null)
            ? section.getMetaData("name") + ""
            : "");
        sform.setTemplate(section.getMetaData("template") + "");
        sform.setStatus(section.getMetaData("status") + "");
        sform.setWorkflow(section.getMetaData("workflow")+"");
        request.setAttribute(
          "types",
          SectionTypes.getSectionsBeans(servlet));
        request.setAttribute(
          "type",
          SectionTypes.getSectionBean(
            servlet,
            section.getMetaData("template") + ""));
        request.setAttribute("workflows", Workflow.listTypes());
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }

      // Forward to the view page
      return (mapping.findForward("view"));
    }

    // fill data | template has changed
    if (request.getParameter("ok") == null) {
      try {
        Mapping.begin();
        Section section = Section.getInstance(id);
        Mapping.rollback();

        request.setAttribute("section", section);
        request.setAttribute(
          "types",
          SectionTypes.getSectionsBeans(servlet));
        request.setAttribute(
          "type",
          SectionTypes.getSectionBean(servlet, sform.getTemplate()));
        request.setAttribute("workflows", Workflow.listTypes());
        request.setAttribute(ERROR_KEY, errors);
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }

      // Forward to the view page
      return (mapping.findForward("view"));
    }

    // fill data | errors
    if (errors.size() > 0) {
      try {
        Mapping.begin();
        Section section = Section.getInstance(id);
        Mapping.rollback();

        request.setAttribute("section", section);
        request.setAttribute(
          "types",
          SectionTypes.getSectionsBeans(servlet));
        request.setAttribute(
          "type",
          SectionTypes.getSectionBean(servlet, sform.getTemplate()));
        request.setAttribute(ERROR_KEY, errors);
        request.setAttribute("workflows", Workflow.listTypes());
        // copy metadata
        Enumeration names = request.getParameterNames();
        request.setAttribute("copyMeta", "true");
        while (names.hasMoreElements()) {
          String name = names.nextElement() + "";
          if (name.startsWith("META_")) {
            request.setAttribute(name, request.getParameter(name));
          }
        }
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }

      // Forward to the view page
      return (mapping.findForward("view"));
    }

    // all it's ok : update section
    try {
      Mapping.begin();

      Section section = Section.getInstance(id);
      section.setMetaData("name", sform.getName());
      section.setMetaData("template", sform.getTemplate());
      section.setMetaData("status", sform.getStatus());
      section.setMetaData("workflow", sform.getWorkflow());
      // update metadata
      Enumeration names = request.getParameterNames();
      while (names.hasMoreElements()) {
        String name = names.nextElement() + "";
        if (name.startsWith("META_")) {
          section.setMetaData(
            name.substring(5),
            request.getParameter(name));
        }
      }
      // update the tree ...
      TreeControlNode node =
        (
          (TreeControl) request.getSession().getAttribute(
            "treeControlTest")).findNode(
          request.getParameter("id"));
      node.setLabel(sform.getName());
      String img = "section.gif";
      if ("offline".equals(section.getMetaData("status"))) {
        img = "section-offline.gif";
      }
      node.setIcon(img);

      Mapping.commit();
View Full Code Here

Examples of org.nextime.ion.framework.business.Section

    Object o = event.getSource();
    if( o instanceof Publication ) {
      Publication p = (Publication)o;
      Vector v = p.listSections();
      for( int i=0; i<v.size(); i++ ) {
        Section s = (Section)v.get(i);
        new File(cachePath,"section$"+s.getId()+".html").delete();
      }
      new File(cachePath,"publication$"+p.getId()+".html").delete();
    }
    if( o instanceof Section ) {
      cleanCache();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.