KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > frontoffice > objectSelector > ListOnlineSubSections


1 /*
2  * ĻON content management system.
3  * Copyright (C) 2002 Guillaume Bort(gbort@msn.com). All rights reserved.
4  *
5  * Copyright (c) 2000 The Apache Software Foundation. All rights reserved.
6  * Copyright 2000-2002 (C) Intalio Inc. All Rights Reserved.
7  *
8  * ĻON is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * ĻON core framework, ĻON content server, ĻON backoffice, ĻON frontoffice
14  * and ĻON admin application are parts of ĻON and are distributed under
15  * same terms of licence.
16  *
17  *
18  * ĻON includes software developed by the Apache Software Foundation (http://www.apache.org/)
19  * and software developed by the Exolab Project (http://www.exolab.org).
20  *
21  * ĻON is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  */

26
27 package org.nextime.ion.frontoffice.objectSelector;
28
29 import java.util.Collection JavaDoc;
30 import java.util.Hashtable JavaDoc;
31 import java.util.Vector JavaDoc;
32
33 import javax.servlet.http.HttpServletRequest JavaDoc;
34 import javax.servlet.http.HttpServletResponse JavaDoc;
35
36 import org.nextime.ion.framework.business.Section;
37 import org.nextime.ion.framework.mapping.Mapping;
38 import org.nextime.ion.framework.logger.Logger;
39
40 /**
41  * Renvoi une collection d'objets Section situées directement
42  * sous la Section spécifiée par le parametre "rootSection"
43  */

44 public class ListOnlineSubSections implements ObjectSelector {
45
46     public Collection JavaDoc selectObjects(Hashtable JavaDoc params, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws SelectException {
47         try {
48             String JavaDoc rootSection = (String JavaDoc) params.get("rootSection");
49             Section root = Section.getInstance(rootSection);
50             Vector JavaDoc v = root.listSubSections();
51             Vector JavaDoc result = new Vector JavaDoc();
52             for( int i=0; i<v.size(); i++ ) {
53                     Section s = (Section)v.get(i);
54                     if( !"offline".equalsIgnoreCase(s.getMetaData("status")+"") ) {
55                         result.add(s);
56                     }
57             }
58             return result;
59         } catch (Exception JavaDoc e) {
60             Logger.getInstance().error("Erreur du SelectObject", this, e);
61             throw new SelectException(e.getMessage());
62         }
63     }
64
65 }
Popular Tags