1 26 27 package org.nextime.ion.frontoffice.objectSelector; 28 29 import java.util.Collection ; 30 import java.util.Hashtable ; 31 import java.util.Vector ; 32 33 import javax.servlet.http.HttpServletRequest ; 34 import javax.servlet.http.HttpServletResponse ; 35 36 import org.nextime.ion.common.IsOnline; 37 38 import org.nextime.ion.framework.business.Publication; 39 import org.nextime.ion.framework.business.Section; 40 import org.nextime.ion.framework.helper.Viewer; 41 import org.nextime.ion.framework.logger.Logger; 42 43 public class GetPublicationView implements ObjectSelector { 44 45 public Collection selectObjects( 46 Hashtable params, 47 HttpServletRequest request, 48 HttpServletResponse response) 49 throws SelectException { 50 try { 51 String publication = (String ) params.get("publication"); 52 String view = (String ) params.get("view"); 53 54 String currentLocale = 55 request.getSession().getAttribute("currentLocale") + ""; 56 57 Publication p = Publication.getInstance(publication); 58 59 int version = 1; 60 if (params.get("version") == null) { 61 version = IsOnline.getMostRecentVersion(p); 62 } else { 63 version = Integer.parseInt(params.get("version") + ""); 64 } 65 66 PublicationResult r = new PublicationResult(); 67 r.setVersion(version); 68 r.setPublication(p); 69 if (view != null) { 70 r.setView( 71 new String ( 72 Viewer.getView(p, version, view, currentLocale))); 73 } 74 Vector v2 = new Vector (); 75 v2.add(r); 76 return v2; 77 } catch (Exception e) { 78 Logger.getInstance().error("Erreur du SelectObject", this, e); 79 throw new SelectException(e.getMessage()); 80 } 81 } 82 83 } | Popular Tags |