Package org.nextime.ion.framework.business

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


      // add publications
      Mapping.begin();
      Vector publications = Publication.listAll();
      Mapping.rollback();
      for (int i = 0; i < publications.size(); i++) {
        Publication publication = (Publication) publications.get(i);
        try {
          URL url =
            new URL(
              frontUrl+"/publication/"
                + publication.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(
              "publication/" + publication.getId() + ".html");
          zip.putNextEntry(ze);
          zip.write(content.getBytes());
          zip.closeEntry();
        } catch (Exception e) {
          System.out.println(
            "Static export error, publication "
              + publication.getId());
        }
      }

      // add index
      URL url =
View Full Code Here


  public Collection selectObjects(Hashtable params) throws SelectException {
    try {
      String publication = (String) params.get("publication");
      String view = (String) params.get("view");
      Publication p = Publication.getInstance(publication);
      PublicationResult r = new PublicationResult();
      r._publi = p;
      if (view != null) {
        r._view = new String(Viewer.getView(p, view));
      }
View Full Code Here

      //Mapping.begin();
      Vector v = Section.getInstance(section).listPublications();
      Vector v2 = new Vector();
      int nb = 0;
      for (int i = 0;(i < v.size() && nb < max); i++) {
        Publication p = (Publication) v.get(i);
        if (IsOnline.getStatus(p)) {
          nb++;
          PublicationResult r = new PublicationResult();
          r._publi = p;
          if( view != null ) {
View Full Code Here

        if (getUser() != null) {
          user = User.getInstance(getUser());
        }
      } catch (Exception e) {
      }
      Publication publication = null;
      try {
        if (getPublication() != null) {
          publication = Publication.getInstance(getPublication());
        }
      } catch (Exception e) {
View Full Code Here

      String index = (String) params.get("index");   
      Vector v = Searcher.search(request,index);
      Vector v2 = new Vector();
      int nb = 0;
      for (int i = 0;i < v.size() ; i++) {
        Publication p = ((SearchResult) v.get(i)).getPublication();
        if (p.getWorkflow(User.getInstance("visitor")).getPermissions().contains("canBeSearched")) {
          nb++;
          PublicationResult r = new PublicationResult();
          r._publi = p;
          if( view != null ) {
            r._view = new String(Viewer.getView(p, view));
View Full Code Here

      int max = Integer.parseInt((String) params.get("max"));
      //Mapping.begin();
        Vector v = Section.getInstance(section).listPublications();
        Vector v2 = new Vector();
        for( int i=0; (i<v.size() && i<max); i++ ) {
          Publication p = (Publication)v.get(i);
          PublicationResult r = new PublicationResult();
          r._publi = p;         
          r._view = new String(Viewer.getView(p,view));         
          v2.add(r);
        }       
View Full Code Here

      // demarre une transaction pour acc�der aux
      // donn�es du framework
      Mapping.begin();
     
      // 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);
View Full Code Here

    }

    try {
      Mapping.begin();

      Publication publication = Publication.getInstance(selectedId);
      publication.removeSection(Section.getInstance(((TreeControl)request.getSession().getAttribute("treeControlTest")).getSelected().getName()));
      //publication.remove();     

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

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

      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

TOP

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

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.