Source Code Cross Referenced for ResultSessionData.java in  » J2EE » fleXive » com » flexive » faces » beans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » fleXive » com.flexive.faces.beans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***************************************************************
002:         *  This file is part of the [fleXive](R) project.
003:         *
004:         *  Copyright (c) 1999-2007
005:         *  UCS - unique computing solutions gmbh (http://www.ucs.at)
006:         *  All rights reserved
007:         *
008:         *  The [fleXive](R) project is free software; you can redistribute
009:         *  it and/or modify it under the terms of the GNU General Public
010:         *  License as published by the Free Software Foundation;
011:         *  either version 2 of the License, or (at your option) any
012:         *  later version.
013:         *
014:         *  The GNU General Public License can be found at
015:         *  http://www.gnu.org/copyleft/gpl.html.
016:         *  A copy is found in the textfile GPL.txt and important notices to the
017:         *  license from the author are found in LICENSE.txt distributed with
018:         *  these libraries.
019:         *
020:         *  This library is distributed in the hope that it will be useful,
021:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
022:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023:         *  GNU General Public License for more details.
024:         *
025:         *  For further information about UCS - unique computing solutions gmbh,
026:         *  please see the company website: http://www.ucs.at
027:         *
028:         *  For further information about [fleXive](R), please see the
029:         *  project website: http://www.flexive.org
030:         *
031:         *
032:         *  This copyright notice MUST APPEAR in all copies of the file!
033:         ***************************************************************/package com.flexive.faces.beans;
034:
035:        import com.flexive.faces.FxJsfUtils;
036:        import com.flexive.shared.search.FxFoundType;
037:        import com.flexive.shared.search.ResultLocation;
038:        import com.flexive.shared.search.ResultViewType;
039:        import com.flexive.shared.search.query.SqlQueryBuilder;
040:        import com.flexive.shared.value.BinaryDescriptor;
041:
042:        import javax.servlet.http.HttpSession;
043:        import java.io.Serializable;
044:        import java.util.ArrayList;
045:        import java.util.Formatter;
046:        import java.util.List;
047:
048:        /**
049:         * Wrapper class for all session data needed by a search result page.
050:         *
051:         * @author Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
052:         * @version $Rev: 1 $
053:         */
054:        public class ResultSessionData implements  Serializable {
055:            private static final long serialVersionUID = -3471062917140804393L;
056:
057:            private ResultLocation location;
058:            private int clientSizeX;
059:            private int clientSizeY;
060:            private SqlQueryBuilder queryBuilder;
061:            private BinaryDescriptor.PreviewSizes previewSize;
062:            private long briefcaseId;
063:            private ResultViewType viewType = ResultViewType.LIST;
064:            private int startRow;
065:            private int fetchRows = 25;
066:            private long typeId = -1;
067:            private List<FxFoundType> contentTypes = new ArrayList<FxFoundType>(
068:                    0);
069:
070:            // Keep a reference on the current session if not retrieved from a JSF context
071:            private transient HttpSession session = null;
072:
073:            /**
074:             * Session key for storing the current search session data. The first parameter
075:             * identifies the {@link com.flexive.shared.search.AdminResultLocations}
076:             * for the current search result. Thus each "location" is independent from the state
077:             * of others, but it is not possible to have two separate instances of the same location
078:             * (i.e. two browser windows).
079:             */
080:            private static String SESSION_DATA_STORE = "SearchResultBean/%s";
081:
082:            /**
083:             * Creates an empty session data object.
084:             *
085:             * @param location the search result location
086:             */
087:            private ResultSessionData(ResultLocation location) {
088:                this (location, -1, -1, new SqlQueryBuilder(),
089:                        BinaryDescriptor.PreviewSizes.PREVIEW2, -1);
090:            }
091:
092:            /**
093:             * Copy constructor. Creates an independent copy of the given session data object.
094:             *
095:             * @param other the session data object to be copied
096:             */
097:            public ResultSessionData(ResultSessionData other) {
098:                this (other.location, other.clientSizeX, other.clientSizeY,
099:                        new SqlQueryBuilder(other.queryBuilder),
100:                        other.previewSize, other.briefcaseId);
101:            }
102:
103:            private ResultSessionData(ResultLocation location, int clientSizeX,
104:                    int clientSizeY, SqlQueryBuilder queryBuilder,
105:                    BinaryDescriptor.PreviewSizes previewSize, long briefcaseId) {
106:                this .location = location;
107:                this .clientSizeX = clientSizeX;
108:                this .clientSizeY = clientSizeY;
109:                this .queryBuilder = queryBuilder;
110:                this .previewSize = previewSize;
111:                this .briefcaseId = briefcaseId;
112:            }
113:
114:            public static ResultSessionData getSessionData(HttpSession session,
115:                    ResultLocation location) {
116:                ResultSessionData data = (ResultSessionData) session
117:                        .getAttribute(getSessionKey(location));
118:                if (data == null) {
119:                    data = new ResultSessionData(location);
120:                    data.session = session;
121:                    data.saveInSession();
122:                }
123:                data.session = session;
124:                return data;
125:            }
126:
127:            private static String getSessionKey(ResultLocation location) {
128:                return new Formatter().format(
129:                        ResultSessionData.SESSION_DATA_STORE,
130:                        location.getName()).toString();
131:            }
132:
133:            private void saveInSession() {
134:                (session == null ? FxJsfUtils.getSession() : session)
135:                        .setAttribute(getSessionKey(location), this );
136:            }
137:
138:            public ResultLocation getLocation() {
139:                return location;
140:            }
141:
142:            public int getClientSizeX() {
143:                return clientSizeX;
144:            }
145:
146:            public void setClientSizeX(int clientSizeX) {
147:                this .clientSizeX = clientSizeX;
148:                saveInSession();
149:            }
150:
151:            public int getClientSizeY() {
152:                return clientSizeY;
153:            }
154:
155:            public void setClientSizeY(int clientSizeY) {
156:                this .clientSizeY = clientSizeY;
157:                saveInSession();
158:            }
159:
160:            public SqlQueryBuilder getQueryBuilder() {
161:                return queryBuilder;
162:            }
163:
164:            public void setQueryBuilder(SqlQueryBuilder queryBuilder) {
165:                this .queryBuilder = queryBuilder;
166:                saveInSession();
167:            }
168:
169:            public BinaryDescriptor.PreviewSizes getPreviewSize() {
170:                return previewSize;
171:            }
172:
173:            public void setPreviewSize(BinaryDescriptor.PreviewSizes previewSize) {
174:                this .previewSize = previewSize;
175:                saveInSession();
176:            }
177:
178:            public long getBriefcaseId() {
179:                return briefcaseId;
180:            }
181:
182:            public void setBriefcaseId(long briefcaseId) {
183:                this .briefcaseId = briefcaseId;
184:                saveInSession();
185:            }
186:
187:            public ResultViewType getViewType() {
188:                return viewType;
189:            }
190:
191:            public void setViewType(ResultViewType viewType) {
192:                this .viewType = viewType;
193:                saveInSession();
194:            }
195:
196:            public int getStartRow() {
197:                return startRow;
198:            }
199:
200:            public void setStartRow(int startRow) {
201:                this .startRow = startRow;
202:                saveInSession();
203:            }
204:
205:            public int getFetchRows() {
206:                return fetchRows;
207:            }
208:
209:            public void setFetchRows(int fetchRows) {
210:                this .fetchRows = fetchRows;
211:                saveInSession();
212:            }
213:
214:            public long getTypeId() {
215:                return typeId;
216:            }
217:
218:            public void setTypeId(long typeId) {
219:                this .typeId = typeId;
220:                saveInSession();
221:            }
222:
223:            public List<FxFoundType> getContentTypes() {
224:                return contentTypes;
225:            }
226:
227:            public void setContentTypes(List<FxFoundType> contentTypes) {
228:                this.contentTypes = contentTypes;
229:                saveInSession();
230:            }
231:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.