Source Code Cross Referenced for ContentItem.java in  » Content-Management-System » openedit » org » openedit » repository » 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 » openedit » org.openedit.repository 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Aug 1, 2003
003:         *
004:        /*
005:        Copyright (c) 2003 eInnovation Inc. All rights reserved
006:
007:        This library is free software; you can redistribute it and/or modify it under the terms
008:        of the GNU Lesser General Public License as published by the Free Software Foundation;
009:        either version 2.1 of the License, or (at your option) any later version.
010:
011:        This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
012:        without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
013:        See the GNU Lesser General Public License for more details.
014:         */
015:        package org.openedit.repository;
016:
017:        import java.io.InputStream;
018:        import java.util.Date;
019:
020:        /**
021:         * The ContentItem is a lot like a versioned network "file".
022:         *  
023:         * @author Matt Avery, mavery@einnovation.com
024:         */
025:        public abstract class ContentItem {
026:
027:            public final static String TYPE_EDITED = "edited";
028:            public final static String TYPE_ADDED = "added";
029:            public final static String TYPE_MOVED = "moved";
030:            public final static String TYPE_COPIED = "copied";
031:            public final static String TYPE_REMOVED = "removed";
032:            public final static String TYPE_APPROVED = "approved";
033:
034:            protected String fieldAuthor;
035:            protected String fieldMessage;
036:            protected String fieldVersion;
037:            protected String fieldType;
038:            protected String fieldPath;
039:            protected String fieldActualPath; //only used when content actually comes from another path
040:            protected Date fieldLastModified;
041:            protected long fieldLength = -1;
042:            protected boolean fieldMakeVersion = true; //used when saving content
043:
044:            /**
045:             * This path is relative.
046:             * 
047:             * @return
048:             */
049:            public String getPath() {
050:                return fieldPath;
051:            }
052:
053:            public void setPath(String path) {
054:                fieldPath = path;
055:            }
056:
057:            /**
058:             * If exists() == false, this method should return 1/1/1970 instead
059:             * of null.
060:             * 
061:             * @return
062:             */
063:            public Date lastModified() {
064:                return fieldLastModified;
065:            }
066:
067:            public long getLastModified() {
068:                if (fieldLastModified != null) {
069:                    return fieldLastModified.getTime();
070:                }
071:                return 0;
072:            }
073:
074:            protected void setLastModified(Date inDate) {
075:                fieldLastModified = inDate;
076:            }
077:
078:            /**
079:             * This will return the contents of the file this item points to *or*
080:             * a listing of the path in XHTML if we are pointing to a "directory".
081:             * 
082:             * @return An input stream of the content
083:             * @throws RepositoryException
084:             */
085:            public abstract InputStream getInputStream()
086:                    throws RepositoryException;
087:
088:            public abstract boolean exists();
089:
090:            public abstract boolean isFolder();
091:
092:            public abstract boolean isWritable();
093:
094:            //valid types are edited, added, removed
095:
096:            /**
097:             * I would almost like to see this return something more structured than
098:             * a String.  For instance, I could see the Revision being used in conjunction
099:             * to an issue tracking system which might have quite a lot of information in
100:             * the "message" string.  In that case, I would store this guy as an XML file.
101:             * 
102:             * @return A meaningful message for this revision.
103:             */
104:            public String getAuthor() {
105:                return fieldAuthor;
106:            }
107:
108:            public void setAuthor(String author) {
109:                fieldAuthor = author;
110:            }
111:
112:            public String getMessage() {
113:                return fieldMessage;
114:            }
115:
116:            public void setMessage(String message) {
117:                fieldMessage = message;
118:            }
119:
120:            /**
121:             * This could be changed to return an integer.  Also, the field names could
122:             * be shortened.
123:             * 
124:             * @return
125:             */
126:            public String getType() {
127:                return fieldType;
128:            }
129:
130:            public void setType(String type) {
131:                fieldType = type;
132:            }
133:
134:            /**
135:             * This is the one and only method of the "Versioned" interface.  There
136:             * also exists "VersionComparator" and "VersionFormat" classes that could
137:             * be used in conjunction with this interface.
138:             * 
139:             * @return The version String.
140:             */
141:            public String getVersion() {
142:                return fieldVersion;
143:            }
144:
145:            public void setVersion(String version) {
146:                fieldVersion = version;
147:            }
148:
149:            /**
150:             * Should this class make a version of the file when saving
151:             * @return
152:             */
153:            public boolean isMakeVersion() {
154:                return fieldMakeVersion;
155:            }
156:
157:            public void setMakeVersion(boolean inMakeVersion) {
158:                fieldMakeVersion = inMakeVersion;
159:            }
160:
161:            /**
162:             * @return
163:             */
164:            public long getLength() {
165:                return fieldLength;
166:            }
167:
168:            public String getActualPath() {
169:                if (fieldActualPath == null) {
170:                    return getPath();
171:                }
172:                return fieldActualPath;
173:            }
174:
175:            public void setActualPath(String inActualPath) {
176:                fieldActualPath = inActualPath;
177:            }
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.