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


001:        /*
002:         * DSpaceObject.java
003:         *
004:         * Version: $Revision: 2074 $
005:         *
006:         * Date: $Date: 2007-07-19 14:40:11 -0500 (Thu, 19 Jul 2007) $
007:         *
008:         * Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
009:         * Institute of Technology.  All rights reserved.
010:         *
011:         * Redistribution and use in source and binary forms, with or without
012:         * modification, are permitted provided that the following conditions are
013:         * met:
014:         *
015:         * - Redistributions of source code must retain the above copyright
016:         * notice, this list of conditions and the following disclaimer.
017:         *
018:         * - Redistributions in binary form must reproduce the above copyright
019:         * notice, this list of conditions and the following disclaimer in the
020:         * documentation and/or other materials provided with the distribution.
021:         *
022:         * - Neither the name of the Hewlett-Packard Company nor the name of the
023:         * Massachusetts Institute of Technology nor the names of their
024:         * contributors may be used to endorse or promote products derived from
025:         * this software without specific prior written permission.
026:         *
027:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
028:         * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
029:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
030:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
031:         * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
032:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
033:         * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
034:         * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
035:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
036:         * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
037:         * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
038:         * DAMAGE.
039:         */
040:        package org.dspace.content;
041:
042:        import java.sql.SQLException;
043:
044:        import org.dspace.core.Constants;
045:        import org.dspace.core.Context;
046:        import org.dspace.eperson.EPerson;
047:        import org.dspace.eperson.Group;
048:
049:        /**
050:         * Abstract base class for DSpace objects
051:         */
052:        public abstract class DSpaceObject {
053:            // accumulate information to add to "detail" element of content Event,
054:            // e.g. to document metadata fields touched, etc.
055:            private StringBuffer eventDetails = null;
056:
057:            /**
058:             * Reset the cache of event details.
059:             */
060:            protected void clearDetails() {
061:                eventDetails = null;
062:            }
063:
064:            /**
065:             * Add a string to the cache of event details.  Automatically
066:             * separates entries with a comma.
067:             * Subclass can just start calling addDetails, since it creates
068:             * the cache if it needs to.
069:             * @param detail detail string to add.
070:             */
071:            protected void addDetails(String d) {
072:                if (eventDetails == null)
073:                    eventDetails = new StringBuffer(d);
074:                else
075:                    eventDetails.append(", ").append(d);
076:            }
077:
078:            /**
079:             * @returns summary of event details, or null if there are none.
080:             */
081:            protected String getDetails() {
082:                return (eventDetails == null ? null : eventDetails.toString());
083:            }
084:
085:            /**
086:             * Get the type of this object, found in Constants
087:             * 
088:             * @return type of the object
089:             */
090:            public abstract int getType();
091:
092:            /**
093:             * Get the internal ID (database primary key) of this object
094:             * 
095:             * @return internal ID of object
096:             */
097:            public abstract int getID();
098:
099:            /**
100:             * Get the Handle of the object. This may return <code>null</code>
101:             * 
102:             * @return Handle of the object, or <code>null</code> if it doesn't have
103:             *         one
104:             */
105:            public abstract String getHandle();
106:
107:            /**
108:             * Get a proper name for the object. This may return <code>null</code>.
109:             * Name should be suitable for display in a user interface.
110:             *
111:             * @return Name for the object, or <code>null</code> if it doesn't have
112:             *         one
113:             */
114:            abstract public String getName();
115:
116:            /**
117:             * Generic find for when the precise type of a DSO is not known, just the
118:             * a pair of type number and database ID.
119:             *
120:             * @param context - the context
121:             * @param type - type number
122:             * @param id - id within table of type'd objects
123:             * @return the object found, or null if it does not exist.
124:             * @throws SQLException only upon failure accessing the database.
125:             */
126:            public static DSpaceObject find(Context context, int type, int id)
127:                    throws SQLException {
128:                switch (type) {
129:                case Constants.BITSTREAM:
130:                    return Bitstream.find(context, id);
131:                case Constants.BUNDLE:
132:                    return Bundle.find(context, id);
133:                case Constants.ITEM:
134:                    return Item.find(context, id);
135:                case Constants.COLLECTION:
136:                    return Collection.find(context, id);
137:                case Constants.COMMUNITY:
138:                    return Community.find(context, id);
139:                case Constants.GROUP:
140:                    return Group.find(context, id);
141:                case Constants.EPERSON:
142:                    return EPerson.find(context, id);
143:                case Constants.SITE:
144:                    return Site.find(context, id);
145:                }
146:                return null;
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.