Source Code Cross Referenced for ContentItem.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » portal » coplets » basket » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.portal.coplets.basket 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.cocoon.portal.coplets.basket;
018:
019:        import java.io.Serializable;
020:
021:        import org.apache.cocoon.portal.coplet.CopletInstanceData;
022:
023:        /**
024:         * This is an item that contains a link or a content.
025:         * The item can either reference a coplet or an URL.
026:         *
027:         * @version CVS $Id: ContentItem.java 433543 2006-08-22 06:22:54Z crossley $
028:         */
029:        public class ContentItem extends AbstractItem implements  Serializable {
030:
031:            /** The id of the referenced coplet */
032:            protected String copletId;
033:            /** Do we store the content or just the link? */
034:            protected boolean storesContent;
035:            /** The referenced url */
036:            protected String url;
037:            /** The cached string rep */
038:            protected String stringRep;
039:            /** The content */
040:            protected byte[] content;
041:
042:            /**
043:             * Create a new item referencing a coplet instance data
044:             * @param cid     The coplet
045:             * @param content Do we store the content (false: a link)
046:             */
047:            public ContentItem(CopletInstanceData cid, boolean content) {
048:                this .copletId = cid.getId();
049:                this .storesContent = content;
050:            }
051:
052:            /**
053:             * Create a new item referencing to a url
054:             * @param url     The url
055:             * @param content Do we store the content (false: a link)
056:             */
057:            public ContentItem(String url, boolean content) {
058:                this .url = url;
059:                this .storesContent = content;
060:            }
061:
062:            /**
063:             * Return the url of null for a coplet
064:             */
065:            public String getURL() {
066:                return this .url;
067:            }
068:
069:            /**
070:             * Return the referenced coplet or null for a url
071:             */
072:            public String getCopletId() {
073:                return this .copletId;
074:            }
075:
076:            /**
077:             * Do we store the content? (or just the link)
078:             */
079:            public boolean isContent() {
080:                return this .storesContent;
081:            }
082:
083:            /**
084:             * Set the content
085:             */
086:            public void setContent(byte[] c) {
087:                this .storesContent = true;
088:                this .content = c;
089:            }
090:
091:            /**
092:             * Get the content or null
093:             */
094:            public byte[] getContent() {
095:                return this .content;
096:            }
097:
098:            /**
099:             * Return the size if content is stored
100:             * Otherwise -1 is returned
101:             */
102:            public int size() {
103:                if (this .content != null) {
104:                    return this .content.length;
105:                }
106:                return -1;
107:            }
108:
109:            /* (non-Javadoc)
110:             * @see java.lang.Object#toString()
111:             */
112:            public String toString() {
113:                if (this .stringRep == null) {
114:                    if (this .copletId != null) {
115:                        this .stringRep = "Coplet:" + this .copletId + "("
116:                                + this .storesContent + ")";
117:                    } else {
118:                        this .stringRep = "URL:" + this .url + "("
119:                                + this .storesContent + ")";
120:                    }
121:                }
122:                return this .stringRep;
123:            }
124:
125:            /**
126:             * Compare one item with another
127:             */
128:            public boolean equalsItem(ContentItem ci) {
129:                if (ci != null && ci.storesContent == this .storesContent) {
130:                    if (ci.url != null && ci.url.equals(this .url)) {
131:                        return true;
132:                    }
133:                    if (ci.copletId != null && this .copletId != null
134:                            && ci.copletId.equals(this .copletId)) {
135:                        return true;
136:                    }
137:                }
138:                return false;
139:            }
140:
141:            public void setTitle(String title) {
142:                this.stringRep = title;
143:            }
144:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.