Source Code Cross Referenced for FeedBean.java in  » Portal » Open-Portal » com » sun » portal » app » blog » 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 » Portal » Open Portal » com.sun.portal.app.blog.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright ? 2006 Sun Microsystems, Inc. All rights reserved. 
003:         *
004:         * Sun Microsystems, Inc. has intellectual property rights relating to
005:         * technology embodied in the product that is described in this document. 
006:         * In particular, and without limitation, these intellectual property 
007:         * rights may include one or more of the U.S. patents listed at 
008:         * http://www.sun.com/patents and one or more additional patents or
009:         * pending patent applications in the U.S. and in other countries.
010:         * 
011:         * U.S. Government Rights - Commercial software. Government users are subject
012:         * to the Sun Microsystems, Inc. standard license agreement and applicable 
013:         * provisions of the FAR and its supplements. Use is subject to license terms. 
014:         * This distribution may include materials developed by third parties.
015:         * Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
016:         * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
017:         */
018:        package com.sun.portal.app.blog.model;
019:
020:        import com.sun.portal.app.blog.Resources;
021:        import com.sun.syndication.feed.atom.Feed;
022:        import com.sun.syndication.feed.atom.Link;
023:        import java.util.Collections;
024:        import java.util.HashMap;
025:        import java.util.Iterator;
026:        import java.util.List;
027:        import java.util.Map;
028:        import javax.faces.context.FacesContext;
029:        import javax.faces.el.ValueBinding;
030:
031:        public class FeedBean {
032:            private static Resources resources = new Resources(
033:                    "com.sun.portal.app.blog.model.FeedBean");
034:
035:            private String userName;
036:            private String password;
037:            private String url;
038:            private String title;
039:            private String link;
040:            private List entryBeans;
041:            private Map entryBeanMap;
042:            private boolean initialized;
043:            private long refreshed = -1;
044:
045:            public String getTitle() {
046:                //TODO: get from res bundle
047:                return (title == null || title.length() == 0) ? resources
048:                        .get("getTitle.noTitle") : title;
049:            }
050:
051:            public String getLink() {
052:                return link;
053:            }
054:
055:            public boolean isLinkExists() {
056:                return link != null;
057:            }
058:
059:            public String getUserName() {
060:                return userName;
061:            }
062:
063:            public void setUserName(String userName) {
064:                this .userName = userName;
065:            }
066:
067:            public String getPassword() {
068:                return password;
069:            }
070:
071:            public void setPassword(String password) {
072:                this .password = password;
073:            }
074:
075:            public String getUrl() {
076:                return url;
077:            }
078:
079:            public void setUrl(String url) {
080:                this .url = url;
081:            }
082:
083:            public void setTitle(String title) {
084:                this .title = title;
085:            }
086:
087:            public void setLink(String link) {
088:                this .link = link;
089:            }
090:
091:            public List getEntryBeans() {
092:                return entryBeans;
093:            }
094:
095:            public int getEntryBeansSize() {
096:                return entryBeans.size();
097:            }
098:
099:            public void setEntryBeans(List entryBeans) {
100:                this .entryBeans = entryBeans;
101:                entryBeanMap = new HashMap();
102:                for (Iterator i = entryBeans.iterator(); i.hasNext();) {
103:                    EntryBean eb = (EntryBean) i.next();
104:                    entryBeanMap.put(eb.getId(), eb);
105:                }
106:            }
107:
108:            public EntryBean getEntryBean(String id) {
109:                return (EntryBean) entryBeanMap.get(id);
110:            }
111:
112:            public void populate(Feed feed) {
113:                List entryBeans = EntryBean.getEntryBeans(feed.getEntries(),
114:                        userName);
115:                setEntryBeans(entryBeans);
116:                setTitle(feed.getTitle());
117:                List altLinks = feed.getAlternateLinks();
118:                setLink(getHref(altLinks, "alternate"));
119:
120:                setRefreshed();
121:            }
122:
123:            private static String getHref(List links, String rel) {
124:                String href = null;
125:                if (links != null) {
126:                    for (Iterator i = links.iterator(); i.hasNext();) {
127:                        Link l = (Link) i.next();
128:                        if (l.getRel().equals(rel)) {
129:                            href = l.getHref();
130:                            break;
131:                        }
132:                    }
133:                }
134:                return href;
135:            }
136:
137:            /*
138:            public List filterEntryBeans() {
139:                List entryBeans = getEntryBeans();        
140:                if (entryBeans == null) {
141:                    return Collections.EMPTY_LIST;
142:                }
143:                String basicFilter = getEntryFilter().getBasicFilter();
144:                if (basicFilter != null && basicFilter.equals(EntryFilter.OPTION_ALL)) {
145:                    return new ArrayList(entryBeans);
146:                }
147:                String titleKeyword = getEntryFilter().getCustomFilter();
148:                if (titleKeyword == null || titleKeyword.length() == 0) {
149:                    return new ArrayList(entryBeans);
150:                }
151:                //canonicalize to lowercase
152:                titleKeyword = titleKeyword.toLowerCase();
153:                List newEntryBeans = new ArrayList();
154:                for (Iterator i = entryBeans.iterator(); i.hasNext(); ) {
155:                    EntryBean entryBean = (EntryBean)i.next();    
156:                    //canonicalize to lowercase 
157:                    String title = entryBean.getTitle().toLowerCase();
158:                    if (title.indexOf(titleKeyword) != -1) {
159:                        newEntryBeans.add(entryBean);
160:                    }            
161:                }
162:                return newEntryBeans;
163:            }    
164:             */
165:
166:            public boolean isInitialized() {
167:                return initialized;
168:            }
169:
170:            public void setInitialized(boolean initialized) {
171:                this .initialized = initialized;
172:            }
173:
174:            public void clear() {
175:                userName = null;
176:                password = null;
177:                url = null;
178:                title = null;
179:                link = null;
180:                entryBeans = null;
181:                entryBeanMap = null;
182:                initialized = false;
183:            }
184:
185:            public void sortByTitle(boolean asc) {
186:                Collections
187:                        .sort(entryBeans, new EntryBean.TitleComparator(asc));
188:            }
189:
190:            public void sortByAuthor(boolean asc) {
191:                Collections.sort(entryBeans,
192:                        new EntryBean.AuthorComparator(asc));
193:            }
194:
195:            public void sortByUpdated(boolean asc) {
196:                Collections.sort(entryBeans, new EntryBean.UpdatedComparator(
197:                        asc));
198:            }
199:
200:            public long getRefreshed() {
201:                return refreshed;
202:            }
203:
204:            private void setRefreshed() {
205:                this.refreshed = System.currentTimeMillis();
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.