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


001:        /*
002:         * Constants.java
003:         *
004:         * Version: $Revision: 1417 $
005:         *
006:         * Date: $Date: 2006-02-13 04:33:50 -0600 (Mon, 13 Feb 2006) $
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.core;
041:
042:        /**
043:         * Class with constants and matching strings, for DSpace types. These numbers
044:         * must never be changed!!
045:         * 
046:         * @author David Stuve
047:         * @version $Revision: 1417 $
048:         */
049:        public class Constants {
050:            /** Type of bitstream objects */
051:            public static final int BITSTREAM = 0;
052:
053:            /** Type of bundle objects */
054:            public static final int BUNDLE = 1;
055:
056:            /** Type of item objects */
057:            public static final int ITEM = 2;
058:
059:            /** Type of collection objects */
060:            public static final int COLLECTION = 3;
061:
062:            /** Type of community objects */
063:            public static final int COMMUNITY = 4;
064:
065:            /** DSpace site type */
066:            public static final int SITE = 5;
067:
068:            /** Type of eperson groups */
069:            public static final int GROUP = 6;
070:
071:            /** Type of individual eperson objects */
072:            public static final int EPERSON = 7;
073:
074:            /**
075:             * lets you look up type names from the type IDs
076:             */
077:            public static final String[] typeText = { "BITSTREAM", "BUNDLE",
078:                    "ITEM", "COLLECTION", "COMMUNITY", "SITE", "GROUP",
079:                    "EPERSON", };
080:
081:            /**
082:             * Special Bundle and Bitstream Names:
083:             */
084:
085:            /** Magic name of item license, as bitstream in LICENSE_BUNDLE_NAME  */
086:            public static final String LICENSE_BITSTREAM_NAME = "license.txt";
087:
088:            /** Magic name of bundle containing item license */
089:            public static final String LICENSE_BUNDLE_NAME = "LICENSE";
090:
091:            /**
092:             * Default bundle name for the "original" item content;
093:             * "derived" content such as thumbnails goes in other bundles.
094:             */
095:            public static final String DEFAULT_BUNDLE_NAME = "ORIGINAL";
096:
097:            /**
098:             * Name of bundle for user-visible "content" (same as default for now).
099:             */
100:            public static final String CONTENT_BUNDLE_NAME = "ORIGINAL";
101:
102:            /** Bundle name for structured metadata bitstreams. */
103:            public static final String METADATA_BUNDLE_NAME = "METADATA";
104:
105:            /** Action of reading, viewing or downloading something */
106:            public static final int READ = 0;
107:
108:            /** Action of modifying something */
109:            public static final int WRITE = 1;
110:
111:            /**
112:             * Action of deleting something. Different from removing something from a
113:             * container. (DELETE is now obsolete)
114:             * 
115:             * @see #REMOVE
116:             */
117:            public static final int DELETE = 2;
118:
119:            /**
120:             * Action of adding something to a container. For example, to add an item to
121:             * a collection, a user must have <code>ADD</code> permission on the
122:             * collection.
123:             */
124:            public static final int ADD = 3;
125:
126:            /**
127:             * Action of removing something from a container. Different from deletion.
128:             * 
129:             * @see #DELETE
130:             */
131:            public static final int REMOVE = 4;
132:
133:            /** Action of performing workflow step 1 */
134:            public static final int WORKFLOW_STEP_1 = 5;
135:
136:            /** Action of performing workflow step 2 */
137:            public static final int WORKFLOW_STEP_2 = 6;
138:
139:            /** Action of performing workflow step 3 */
140:            public static final int WORKFLOW_STEP_3 = 7;
141:
142:            /** Action of performing a workflow */
143:            public static final int WORKFLOW_ABORT = 8;
144:
145:            /** Default Read policies for Bitstreams submitted to container */
146:            public static final int DEFAULT_BITSTREAM_READ = 9;
147:
148:            /** Default Read policies for Items submitted to container */
149:            public static final int DEFAULT_ITEM_READ = 10;
150:
151:            /**
152:             * collection admin -- metadata, logo, item metadata, submitters, withdraw
153:             * items, etc.
154:             */
155:            public static final int COLLECTION_ADMIN = 11;
156:
157:            /** Position of front page news item -- top box */
158:            public static final int NEWS_TOP = 0;
159:
160:            /** Position of front page news item -- sidebar */
161:            public static final int NEWS_SIDE = 1;
162:
163:            /**
164:             * lets you look up action names from the action IDs
165:             */
166:            public static final String[] actionText = { "READ", "WRITE",
167:                    "OBSOLETE (DELETE)", "ADD", "REMOVE", "WORKFLOW_STEP_1",
168:                    "WORKFLOW_STEP_2", "WORKFLOW_STEP_3", "WORKFLOW_ABORT",
169:                    "DEFAULT_BITSTREAM_READ", "DEFAULT_ITEM_READ",
170:                    "COLLECTION_ADMIN" };
171:
172:            /**
173:             * constants for the relevance array generating dynamicallis is simple: just
174:             * 1 < < TYPE
175:             */
176:            public static final int RBITSTREAM = 1 << BITSTREAM;
177:
178:            public static final int RBUNDLE = 1 << BUNDLE;
179:
180:            public static final int RITEM = 1 << ITEM;
181:
182:            public static final int RCOLLECTION = 1 << COLLECTION;
183:
184:            public static final int RCOMMUNITY = 1 << COMMUNITY;
185:
186:            /**
187:             * Array of relevances of actions to objects - used by the UI to only
188:             * display actions that are relevant to an object type To see if an action
189:             * is relevant to an object, just OR the relevance type above with the value
190:             * in actionTypeRelevance[] (To see if READ is relevant to community, just
191:             * test actionTypeRelevance[READ] | RCOMMUNITY, 0 = irrelevant
192:             */
193:            public static final int[] actionTypeRelevance = {
194:                    RBITSTREAM | RBUNDLE | RITEM | RCOLLECTION | RCOMMUNITY, // 0 - READ
195:                    RBITSTREAM | RBUNDLE | RITEM | RCOLLECTION | RCOMMUNITY, // 1 -
196:                    // WRITE
197:                    0, // 2 - DELETE (obsolete)
198:                    RBUNDLE | RITEM | RCOLLECTION | RCOMMUNITY, // 3 - ADD
199:                    RBUNDLE | RITEM | RCOLLECTION | RCOMMUNITY, // 4 - REMOVE
200:                    0, // 5 - WORKFLOW_STEP_1
201:                    0, // 6 - WORKFLOW_STEP_2
202:                    0, // 7 - WORKFLOW_STEP_3
203:                    0, // 8 - WORKFLOW_ABORT
204:                    RCOLLECTION, // 9 - DEFAULT_BITSTREAM_READ
205:                    RCOLLECTION, // 10 - DEFAULT_ITEM_READ
206:                    RCOLLECTION // 11 - COLLECTION_ADMIN
207:            };
208:
209:            public static final String DEFAULT_ENCODING = "UTF-8";
210:
211:            /**
212:             * If you know the type string, look up the corresponding type ID constant.
213:             * 
214:             * @param type
215:             *            String with the name of the type (must be exact match)
216:             * 
217:             * @return the corresponding type ID, or <code>-1</code> if the type
218:             *         string is unknown
219:             */
220:            public static int getTypeID(String type) {
221:                for (int i = 0; i < typeText.length; i++) {
222:                    if (typeText[i].equals(type)) {
223:                        return i;
224:                    }
225:                }
226:
227:                return -1;
228:            }
229:
230:            /**
231:             * If you know the action string, look up the corresponding type ID
232:             * constant.
233:             * 
234:             * @param action
235:             *            String with the name of the action (must be exact match)
236:             * 
237:             * @return the corresponding action ID, or <code>-1</code> if the action
238:             *         string is unknown
239:             */
240:            public static int getActionID(String action) {
241:                for (int i = 0; i < actionText.length; i++) {
242:                    if (actionText[i].equals(action)) {
243:                        return i;
244:                    }
245:                }
246:
247:                return -1;
248:            }
249:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.