Source Code Cross Referenced for ChatChannel.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » chat2 » model » 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 » ERP CRM Financial » sakai » org.sakaiproject.chat2.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/chat/tags/sakai_2-4-1/chat-api/api/src/java/org/sakaiproject/chat2/model/ChatChannel.java $
003:         * $Id: ChatChannel.java 29902 2007-05-03 13:00:41Z ajpoland@iupui.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2007 The Sakai Foundation.
007:         *
008:         * Licensed under the Educational Community License, Version 1.0 (the "License");
009:         * you may not use this file except in compliance with the License.
010:         * You may obtain a copy of the License at
011:         *
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         *
014:         * Unless required by applicable law or agreed to in writing, software
015:         * distributed under the License is distributed on an "AS IS" BASIS,
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:         * See the License for the specific language governing permissions and
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.chat2.model;
021:
022:        import java.util.Date;
023:        import java.util.HashSet;
024:        import java.util.Set;
025:        import java.util.Stack;
026:
027:        import org.sakaiproject.component.cover.ServerConfigurationService;
028:        import org.sakaiproject.entity.api.Entity;
029:        import org.sakaiproject.entity.api.ResourceProperties;
030:        import org.w3c.dom.Document;
031:        import org.w3c.dom.Element;
032:
033:        public class ChatChannel implements  Entity {
034:
035:            /** Message filter names */
036:            public static final String FILTER_BY_NUMBER = "SelectMessagesByNumber";
037:            public static final String FILTER_BY_TIME = "SelectMessagesByTime";
038:            public static final String FILTER_TODAY = "SelectTodaysMessages";
039:            public static final String FILTER_ALL = "SelectAllMessages";
040:            public static final int MAX_MESSAGES = -999;
041:
042:            private String id;
043:            private String context;
044:            private Date creationDate;
045:            private String title;
046:            private String description;
047:            private String filterType = FILTER_BY_TIME;
048:            private int filterParam = 3;
049:            private boolean contextDefaultChannel = false;
050:            private boolean enableUserOverride = true;
051:            private Set messages = new HashSet();
052:
053:            public ChatChannel() {
054:            }
055:
056:            /**
057:             * Set up a new ChatChannel with the set defaults
058:             * @param defaults
059:             */
060:            public ChatChannel(ChatChannel defaults) {
061:                this .filterType = defaults.getFilterType();
062:                this .filterParam = defaults.getFilterParam();
063:                this .enableUserOverride = defaults.isEnableUserOverride();
064:            }
065:
066:            public String getContext() {
067:                return context;
068:            }
069:
070:            public void setContext(String context) {
071:                this .context = context;
072:            }
073:
074:            public Date getCreationDate() {
075:                return creationDate;
076:            }
077:
078:            public void setCreationDate(Date creationDate) {
079:                this .creationDate = creationDate;
080:            }
081:
082:            public String getId() {
083:                return id;
084:            }
085:
086:            public void setId(String id) {
087:                this .id = id;
088:            }
089:
090:            public String getTitle() {
091:                return title;
092:            }
093:
094:            public void setTitle(String title) {
095:                this .title = title;
096:            }
097:
098:            public String getDescription() {
099:                return description;
100:            }
101:
102:            public void setDescription(String description) {
103:                this .description = description;
104:            }
105:
106:            public Set getMessages() {
107:                return messages;
108:            }
109:
110:            public void setMessages(Set messages) {
111:                this .messages = messages;
112:            }
113:
114:            public String getFilterType() {
115:                return filterType;
116:            }
117:
118:            public void setFilterType(String filterType) {
119:                this .filterType = filterType;
120:            }
121:
122:            public int getFilterParam() {
123:                return filterParam;
124:            }
125:
126:            public void setFilterParam(int filterParam) {
127:                this .filterParam = filterParam;
128:            }
129:
130:            public boolean isContextDefaultChannel() {
131:                return contextDefaultChannel;
132:            }
133:
134:            public void setContextDefaultChannel(boolean contextDefaultChannel) {
135:                this .contextDefaultChannel = contextDefaultChannel;
136:            }
137:
138:            public boolean isEnableUserOverride() {
139:                return enableUserOverride;
140:            }
141:
142:            public void setEnableUserOverride(boolean enableUserOverride) {
143:                this .enableUserOverride = enableUserOverride;
144:            }
145:
146:            public void setEnabledUserOverride(String enableUserOverride) {
147:                new Boolean(enableUserOverride).booleanValue();
148:            }
149:
150:            /**
151:             * Serialize the resource into XML, adding an element to the doc under the top of the stack element.
152:             * 
153:             * @param doc
154:             *        The DOM doc to contain the XML (or null for a string return).
155:             * @param stack
156:             *        The DOM elements, the top of which is the containing element of the new "resource" element.
157:             * @return The newly added element.
158:             */
159:            public Element toXml(Document doc, Stack stack) {
160:                Element channel = doc.createElement("channel");
161:
162:                if (stack.isEmpty()) {
163:                    doc.appendChild(channel);
164:                } else {
165:                    ((Element) stack.peek()).appendChild(channel);
166:                }
167:
168:                stack.push(channel);
169:
170:                channel.setAttribute("context", getContext());
171:                channel.setAttribute("id", getId());
172:                channel.setAttribute("description", getDescription());
173:                channel.setAttribute("title", getTitle());
174:                channel.setAttribute("creationDate", Long
175:                        .toString(getCreationDate().getTime()));
176:                channel.setAttribute("filterType", getFilterType());
177:                channel.setAttribute("filterParam", Integer
178:                        .toString(getFilterParam()));
179:                channel.setAttribute("contextDefaultChannel", Boolean
180:                        .toString(isContextDefaultChannel()));
181:
182:                stack.pop();
183:
184:                return channel;
185:
186:            } // toXml
187:
188:            /**
189:             * Converts the serialized xml back to a ChatChannel object
190:             * @param channelElement
191:             * @return
192:             */
193:            public static ChatChannel xmlToChatChannel(Element channelElement,
194:                    String siteId) {
195:                ChatChannel tmpChannel = new ChatChannel();
196:                //tmpChannel.setContext(channelElement.getAttribute("context"));
197:                tmpChannel.setContext(siteId);
198:
199:                if (siteId.equalsIgnoreCase(channelElement
200:                        .getAttribute("context"))) {
201:                    //If importing into the same site, keep the id.  We should get an update instead of saving a new one.
202:                    tmpChannel.setId(channelElement.getAttribute("id"));
203:                }
204:                tmpChannel.setDescription(channelElement
205:                        .getAttribute("description"));
206:                tmpChannel.setTitle(channelElement.getAttribute("title"));
207:                tmpChannel
208:                        .setCreationDate(new Date(Long.parseLong(channelElement
209:                                .getAttribute("creationDate"))));
210:                tmpChannel.setFilterType(channelElement
211:                        .getAttribute("filterType"));
212:                tmpChannel.setFilterParam(Integer.parseInt(channelElement
213:                        .getAttribute("filterParam")));
214:                tmpChannel.setContextDefaultChannel(Boolean
215:                        .parseBoolean(channelElement
216:                                .getAttribute("contextDefaultChannel")));
217:
218:                return tmpChannel;
219:            }
220:
221:            /* (non-Javadoc)
222:             * @see org.sakaiproject.entity.api.Entity#getProperties()
223:             */
224:            public ResourceProperties getProperties() {
225:                // TODO Auto-generated method stub
226:                return null;
227:            }
228:
229:            /* (non-Javadoc)
230:             * @see org.sakaiproject.entity.api.Entity#getReference()
231:             */
232:            public String getReference() {
233:                return ChatManager.REFERENCE_ROOT + Entity.SEPARATOR
234:                        + ChatManager.REF_TYPE_CHANNEL + Entity.SEPARATOR
235:                        + context + Entity.SEPARATOR + id;
236:
237:            }
238:
239:            /* (non-Javadoc)
240:             * @see org.sakaiproject.entity.api.Entity#getReference(java.lang.String)
241:             */
242:            public String getReference(String rootProperty) {
243:                return getReference();
244:            }
245:
246:            /* (non-Javadoc)
247:             * @see org.sakaiproject.entity.api.Entity#getUrl()
248:             */
249:            public String getUrl() {
250:                return ServerConfigurationService.getAccessUrl()
251:                        + getReference();
252:            }
253:
254:            /* (non-Javadoc)
255:             * @see org.sakaiproject.entity.api.Entity#getUrl(java.lang.String)
256:             */
257:            public String getUrl(String rootProperty) {
258:                return getUrl();
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.