Package org.nextime.ion.framework.business

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


    // 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

    // 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

      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

    // 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

    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

    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

    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

Related Classes of org.nextime.ion.framework.business.Section

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.