Source Code Cross Referenced for EditCollectionMetadataForm.java in  » Content-Management-System » dspace » org » dspace » app » xmlui » aspect » administrative » collection » 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.app.xmlui.aspect.administrative.collection 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * EditCollectionMetadataForm.java
003:         *
004:         * Version: $Revision: 1.0 $
005:         *
006:         * Date: $Date: 2006/07/13 23:20:54 $
007:         *
008:         * Copyright (c) 2002, 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.app.xmlui.aspect.administrative.collection;
041:
042:        import java.sql.SQLException;
043:
044:        import org.dspace.app.xmlui.aspect.administrative.FlowContainerUtils;
045:        import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
046:        import org.dspace.app.xmlui.wing.Message;
047:        import org.dspace.app.xmlui.wing.WingException;
048:        import org.dspace.app.xmlui.wing.element.Body;
049:        import org.dspace.app.xmlui.wing.element.Button;
050:        import org.dspace.app.xmlui.wing.element.Division;
051:        import org.dspace.app.xmlui.wing.element.Item;
052:        import org.dspace.app.xmlui.wing.element.List;
053:        import org.dspace.app.xmlui.wing.element.PageMeta;
054:        import org.dspace.app.xmlui.wing.element.Para;
055:        import org.dspace.app.xmlui.wing.element.Text;
056:        import org.dspace.app.xmlui.wing.element.TextArea;
057:        import org.dspace.authorize.AuthorizeException;
058:        import org.dspace.authorize.AuthorizeManager;
059:        import org.dspace.content.Collection;
060:
061:        /**
062:         * Presents the user (in this case an administrator over the collection) with the
063:         * form to edit that collection's metadata, logo, and item template.
064:         * @author Alexey Maslov
065:         */
066:        public class EditCollectionMetadataForm extends
067:                AbstractDSpaceTransformer {
068:            /** Language Strings */
069:            private static final Message T_dspace_home = message("xmlui.general.dspace_home");
070:
071:            private static final Message T_collection_trail = message("xmlui.administrative.collection.general.collection_trail");
072:            private static final Message T_options_metadata = message("xmlui.administrative.collection.general.options_metadata");
073:            private static final Message T_options_roles = message("xmlui.administrative.collection.general.options_roles");
074:
075:            private static final Message T_submit_return = message("xmlui.general.return");
076:
077:            private static final Message T_title = message("xmlui.administrative.collection.EditCollectionMetadataForm.title");
078:            private static final Message T_trail = message("xmlui.administrative.collection.EditCollectionMetadataForm.trail");
079:
080:            private static final Message T_main_head = message("xmlui.administrative.collection.EditCollectionMetadataForm.main_head");
081:
082:            private static final Message T_label_name = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_name");
083:            private static final Message T_label_short_description = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_short_description");
084:            private static final Message T_label_introductory_text = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_introductory_text");
085:            private static final Message T_label_copyright_text = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_copyright_text");
086:            private static final Message T_label_side_bar_text = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_side_bar_text");
087:            private static final Message T_label_license = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_license");
088:            private static final Message T_label_provenance_description = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_provenance_description");
089:
090:            private static final Message T_label_logo = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_logo");
091:            private static final Message T_label_existing_logo = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_existing_logo");
092:
093:            private static final Message T_label_item_template = message("xmlui.administrative.collection.EditCollectionMetadataForm.label_item_template");
094:
095:            private static final Message T_submit_create_template = message("xmlui.administrative.collection.EditCollectionMetadataForm.submit_create_template");
096:            private static final Message T_submit_edit_template = message("xmlui.administrative.collection.EditCollectionMetadataForm.submit_edit_template");
097:            private static final Message T_submit_delete_template = message("xmlui.general.delete");
098:
099:            private static final Message T_submit_delete_logo = message("xmlui.administrative.collection.EditCollectionMetadataForm.submit_delete_logo");
100:            private static final Message T_submit_delete = message("xmlui.administrative.collection.EditCollectionMetadataForm.submit_delete");
101:            private static final Message T_submit_save = message("xmlui.administrative.collection.EditCollectionMetadataForm.submit_save");
102:
103:            private static final Message T_sysadmins_only = message("xmlui.administrative.collection.EditCollectionMetadataForm.sysadmins_only");
104:
105:            public void addPageMeta(PageMeta pageMeta) throws WingException {
106:                pageMeta.addMetadata("title").addContent(T_title);
107:                pageMeta.addTrailLink(contextPath + "/", T_dspace_home);
108:                pageMeta.addTrail().addContent(T_collection_trail);
109:                pageMeta.addTrail().addContent(T_trail);
110:            }
111:
112:            public void addBody(Body body) throws WingException, SQLException,
113:                    AuthorizeException {
114:                int collectionID = parameters.getParameterAsInteger(
115:                        "collectionID", -1);
116:                Collection this Collection = Collection.find(context,
117:                        collectionID);
118:
119:                String baseURL = contextPath
120:                        + "/admin/collection?administrative-continue="
121:                        + knot.getId();
122:
123:                String short_description_error = FlowContainerUtils
124:                        .checkXMLFragment(this Collection
125:                                .getMetadata("short_description"));
126:                String introductory_text_error = FlowContainerUtils
127:                        .checkXMLFragment(this Collection
128:                                .getMetadata("introductory_text"));
129:                String copyright_text_error = FlowContainerUtils
130:                        .checkXMLFragment(this Collection
131:                                .getMetadata("copyright_text"));
132:                String side_bar_text_error = FlowContainerUtils
133:                        .checkXMLFragment(this Collection
134:                                .getMetadata("side_bar_text"));
135:                String license_error = FlowContainerUtils
136:                        .checkXMLFragment(this Collection.getMetadata("license"));
137:                String provenance_description_error = FlowContainerUtils
138:                        .checkXMLFragment(this Collection
139:                                .getMetadata("provenance_description"));
140:
141:                // DIVISION: main
142:                Division main = body.addInteractiveDivision(
143:                        "collection-metadata-edit", contextPath
144:                                + "/admin/collection",
145:                        Division.METHOD_MULTIPART,
146:                        "primary administrative collection");
147:                main.setHead(T_main_head.parameterize(this Collection
148:                        .getMetadata("name")));
149:
150:                List options = main.addList("options", List.TYPE_SIMPLE,
151:                        "horizontal");
152:                options.addItem().addHighlight("bold").addXref(
153:                        baseURL + "&submit_metadata", T_options_metadata);
154:                options.addItem().addXref(baseURL + "&submit_roles",
155:                        T_options_roles);
156:
157:                // The grand list of metadata options
158:                List metadataList = main.addList("metadataList", "form");
159:
160:                // collection name
161:                metadataList.addLabel(T_label_name);
162:                Text name = metadataList.addItem().addText("name");
163:                name.setSize(40);
164:                name.setValue(this Collection.getMetadata("name"));
165:
166:                // short description
167:                metadataList.addLabel(T_label_short_description);
168:                Text short_description = metadataList.addItem().addText(
169:                        "short_description");
170:                short_description.setValue(this Collection
171:                        .getMetadata("short_description"));
172:                short_description.setSize(40);
173:                if (short_description_error != null)
174:                    short_description.addError(short_description_error);
175:
176:                // introductory text
177:                metadataList.addLabel(T_label_introductory_text);
178:                TextArea introductory_text = metadataList.addItem()
179:                        .addTextArea("introductory_text");
180:                introductory_text.setValue(this Collection
181:                        .getMetadata("introductory_text"));
182:                introductory_text.setSize(6, 40);
183:                if (introductory_text_error != null)
184:                    introductory_text.addError(introductory_text_error);
185:
186:                // copyright text
187:                metadataList.addLabel(T_label_copyright_text);
188:                TextArea copyright_text = metadataList.addItem().addTextArea(
189:                        "copyright_text");
190:                copyright_text.setValue(this Collection
191:                        .getMetadata("copyright_text"));
192:                copyright_text.setSize(6, 40);
193:                if (copyright_text_error != null)
194:                    copyright_text.addError(copyright_text_error);
195:
196:                // legacy sidebar text; may or may not be used for news 
197:                metadataList.addLabel(T_label_side_bar_text);
198:                TextArea side_bar_text = metadataList.addItem().addTextArea(
199:                        "side_bar_text");
200:                side_bar_text.setValue(this Collection
201:                        .getMetadata("side_bar_text"));
202:                side_bar_text.setSize(6, 40);
203:                if (side_bar_text_error != null)
204:                    side_bar_text.addError(side_bar_text_error);
205:
206:                // license text
207:                metadataList.addLabel(T_label_license);
208:                TextArea license = metadataList.addItem()
209:                        .addTextArea("license");
210:                license.setValue(this Collection.getMetadata("license"));
211:                license.setSize(6, 40);
212:                if (license_error != null)
213:                    license.addError(license_error);
214:
215:                // provenance description
216:                metadataList.addLabel(T_label_provenance_description);
217:                TextArea provenance_description = metadataList.addItem()
218:                        .addTextArea("provenance_description");
219:                provenance_description.setValue(this Collection
220:                        .getMetadata("provenance_description"));
221:                provenance_description.setSize(6, 40);
222:                if (provenance_description_error != null)
223:                    provenance_description
224:                            .addError(provenance_description_error);
225:
226:                // the row to upload a new logo 
227:                metadataList.addLabel(T_label_logo);
228:                metadataList.addItem().addFile("logo");
229:
230:                // the row displaying an existing logo
231:                Item item;
232:                if (this Collection.getLogo() != null) {
233:                    metadataList.addLabel(T_label_existing_logo);
234:                    item = metadataList.addItem();
235:                    item.addFigure(contextPath + "/bitstream/id/"
236:                            + this Collection.getLogo().getID() + "/bob.jpg",
237:                            null, null);
238:                    item.addButton("submit_delete_logo").setValue(
239:                            T_submit_delete_logo);
240:                }
241:
242:                // item template creation and removal
243:                metadataList.addLabel(T_label_item_template);
244:                item = metadataList.addItem();
245:
246:                if (this Collection.getTemplateItem() == null)
247:                    addAdministratorOnlyButton(item, "submit_create_template",
248:                            T_submit_create_template);
249:                else {
250:                    item.addButton("submit_edit_template").setValue(
251:                            T_submit_edit_template);
252:                    addAdministratorOnlyButton(item, "submit_delete_template",
253:                            T_submit_delete_template);
254:                }
255:
256:                Para buttonList = main.addPara();
257:                buttonList.addButton("submit_save").setValue(T_submit_save);
258:                if (AuthorizeManager.isAdmin(context))
259:                    buttonList.addButton("submit_delete").setValue(
260:                            T_submit_delete);
261:                buttonList.addButton("submit_return").setValue(T_submit_return);
262:
263:                main.addHidden("administrative-continue")
264:                        .setValue(knot.getId());
265:            }
266:
267:            private void addAdministratorOnlyButton(Item item,
268:                    String buttonName, Message buttonLabel)
269:                    throws WingException, SQLException {
270:                Button button = item.addButton(buttonName);
271:                button.setValue(buttonLabel);
272:                if (!AuthorizeManager.isAdmin(context)) {
273:                    // Only admins can create or delete
274:                    button.setDisabled();
275:                    item.addHighlight("fade").addContent(T_sysadmins_only);
276:                }
277:            }
278:        }
w__w__w___._java___2___s.c___o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.