Examples of Publication


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

    // user need cancel
    if (request.getParameter("cancel") != null) {
      try {
        Mapping.begin();
        Publication publication = Publication.getInstance(id);

        //        LockManager locks =
        //          (LockManager) servlet.getServletContext().getAttribute(
        //            "locks");
        //        locks.unlock(publication);

        Mapping.rollback();
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }
      // Forward to the next page
      return (mapping.findForward("cancel"));
    }

    // fill data | first time
    if (request.getParameter("itsOk") == null) {
      try {
        Mapping.begin();
        Publication publication = Publication.getInstance(id);
        String editForm = FormGenerator.getForm(publication);

        //        LockManager locks =
        //          (LockManager) servlet.getServletContext().getAttribute(
        //            "locks");
        //           
        //        if( locks.isLocked(publication) ) {
        //          throw new Exception("La publication "+publication.getId()+" est bloqu�e par un autre utilisateur." );
        //        }
        //           
        //        locks.lock(
        //          publication,
        //          User.getInstance(
        //            request.getSession().getAttribute("userLogin") + ""));

        Mapping.rollback();

        request.setAttribute("publication", publication);
        request.setAttribute("editForm", editForm);
        SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
        sform.setDate(formatter.format(publication.getDate()));

      } 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();
        Publication publication = Publication.getInstance(id);
        Hashtable data = new Hashtable();
        Enumeration names = request.getParameterNames();
        while (names.hasMoreElements()) {
          String name = names.nextElement().toString();
          data.put(name, request.getParameter(name));
        }
        String editForm =
          FormGenerator.getForm(publication.getType(), data);
        Mapping.rollback();

        request.setAttribute("publication", publication);
        request.setAttribute("editForm", editForm);
        request.setAttribute(ERROR_KEY, errors);
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }

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

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

      Publication publication = Publication.getInstance(id);
      Hashtable data = new Hashtable();
      Enumeration names = request.getParameterNames();
      while (names.hasMoreElements()) {
        String name = names.nextElement().toString();
        String value = request.getParameter(name);
        if (!value.trim().equals("")) {
          data.put(name, request.getParameter(name));
        }
      }
      publication.setData(data, true);
      SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
      publication.setDate(formatter.parse(sform.getDate()));

      //      LockManager locks =
      //        (LockManager) servlet.getServletContext().getAttribute("locks");
      //      locks.unlock(publication);
View Full Code Here

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

      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) {
      Mapping.rollback();
View Full Code Here

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

        String style = request.getParameter("style");
       
        try {
          Mapping.begin();
         
          Publication publication = Publication.getInstance(id);
          TypePublication type = publication.getType();
          // list only XSL styles (not XSL-FO)
          Vector styleNames = type.listStyles();
          Vector styles = new Vector();
          for( int i=0; i<styleNames.size(); i++ ) {
            String n = styleNames.get(i).toString();
View Full Code Here

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

        String id = request.getParameter("id");       
       
        try {
          Mapping.begin();
         
          Publication publication = Publication.getInstance(id);
          request.setAttribute("history", publication.getWorkflow().getHistorySteps());
          request.setAttribute("current", publication.getWorkflow().getCurrentSteps());
         
          Mapping.rollback();
        } catch( Exception e ) {
          Mapping.rollback();
          throw new ServletException(e);
View Full Code Here

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

   * @see org.nextime.ion.framework.event.WcmListener#objectCreated(WcmEvent)
   */
  public void objectCreated(WcmEvent event) {
    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

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

   * @see org.nextime.ion.framework.event.WcmListener#objectDeleted(WcmEvent)
   */
  public void objectDeleted(WcmEvent event) {
    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

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

   * @see org.nextime.ion.framework.event.WcmListener#objectModified(WcmEvent)
   */
  public void objectModified(WcmEvent event) {
    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.