Source Code Cross Referenced for MatchItem.java in  » ERP-CRM-Financial » sakai » edu » indiana » lib » twinpeaks » search » 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 » ERP CRM Financial » sakai » edu.indiana.lib.twinpeaks.search 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         *
003:         * Copyright (c) 2003, 2004 The Regents of the University of Michigan, Trustees of Indiana University,
004:         *                  Board of Trustees of the Leland Stanford, Jr., University, and The MIT Corporation
005:         *
006:         * Licensed under the Educational Community License Version 1.0 (the "License");
007:         * By obtaining, using and/or copying this Original Work, you agree that you have read,
008:         * understand, and will comply with the terms and conditions of the Educational Community License.
009:         * You may obtain a copy of the License at:
010:         *
011:         *      http://cvs.sakaiproject.org/licenses/license_1_0.html
012:         *
013:         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
014:         * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
015:         * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
016:         * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
017:         * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
018:         *
019:         **********************************************************************************/package edu.indiana.lib.twinpeaks.search;
020:
021:        import edu.indiana.lib.twinpeaks.util.*;
022:
023:        import java.io.*;
024:        import java.util.*;
025:
026:        import org.osid.repository.Asset;
027:        import org.osid.repository.AssetIterator;
028:        import org.osid.repository.Record;
029:        import org.osid.repository.Part;
030:        import org.osid.repository.PartStructure;
031:
032:        /**
033:         * Encapsulate one matching search item
034:         */
035:        public class MatchItem {
036:
037:            private static org.apache.commons.logging.Log _log = LogUtils
038:                    .getLog(MatchItem.class);
039:
040:            private String _displayName;
041:            private String _description;
042:            private String _id;
043:            private String _openUrl;
044:            private List _partStructureList;
045:
046:            private String _previewUrl;
047:            private String _previewImage;
048:            private String _previewText;
049:            private String _persistentUrl;
050:            private String _persistentParameters;
051:            private String _persistentParametersForEncoding;
052:            private String _persistentText;
053:
054:            /**
055:             * Constructor
056:             */
057:            public MatchItem() {
058:                super ();
059:
060:                _partStructureList = new ArrayList();
061:            }
062:
063:            /**
064:             * Fetch the Asset "display name"
065:             * @return Display name text
066:             */
067:            public String getDisplayName() {
068:                return _displayName;
069:            }
070:
071:            /**
072:             * Set the Asset "display name"
073:             * @param displayName Display name text
074:             */
075:            public void setDisplayName(String displayName) {
076:                _displayName = displayName;
077:            }
078:
079:            /**
080:             * Fetch additional descriptive text
081:             * @return Additional text
082:             */
083:            public String getDescription() {
084:                return _description;
085:            }
086:
087:            /**
088:             * Set description text
089:             * @param text Description text
090:             */
091:            public void setDescription(String text) {
092:                _description = normalizeDescription(text);
093:            }
094:
095:            /**
096:             * Fetch the Asset ID
097:             * @return ID text
098:             */
099:            public String getId() {
100:                return _id;
101:            }
102:
103:            /**
104:             * Set the ID
105:             * @param id ID text
106:             */
107:            public void setId(String id) {
108:                _id = normalizeDescription(id);
109:            }
110:
111:            /**
112:             * Add an additional PartStructure too the list
113:             * @param partStructureId The PartStructure Id to add
114:             * @param value PartStructure value
115:             */
116:            public void addPartStructure(org.osid.shared.Id partStructureId,
117:                    Serializable value) {
118:                _partStructureList.add(new PartPair(partStructureId, value));
119:            }
120:
121:            /**
122:             * Get an interator for the PartStructureId list (PartPair objects)
123:             * @return PartStructure list Iterator
124:             */
125:            public Iterator partPairIterator() {
126:                return _partStructureList.iterator();
127:            }
128:
129:            /**
130:             * Fetch the OpenURL generated at search time
131:             * @return The generated OpenURL
132:             */
133:            public String getOpenUrl() {
134:                return _openUrl;
135:            }
136:
137:            /**
138:             * Save the OpenUrl discovered at search time
139:             * @param url URL string
140:             */
141:            public void setOpenUrl(String url) {
142:                _openUrl = url;
143:            }
144:
145:            /**
146:             * Fetch the URL of the "preview" view of the matching item
147:             * @return A fully qualified URL value
148:             */
149:            public String getPreviewUrl() {
150:                return _previewUrl;
151:            }
152:
153:            /**
154:             * Set the "preview" URL
155:             * @param url Preview URL string
156:             */
157:            public void setPreviewUrl(String url) {
158:                _previewUrl = url;
159:            }
160:
161:            /**
162:             * Fetch the image associated with the "preview" URL
163:             * @return Image source specification
164:             */
165:            public String getPreviewImage() {
166:                return _previewImage;
167:            }
168:
169:            /**
170:             * Set "preview" URL image
171:             * @param source Image source specification
172:             */
173:            public void setPreviewImage(String source) {
174:                _previewImage = source;
175:            }
176:
177:            /**
178:             * Fetch the text associated with the "preview" URL
179:             * @return Text
180:             */
181:            public String getPreviewText() {
182:                return _previewText;
183:            }
184:
185:            /**
186:             * Set "preview" URL text
187:             * @param text Preview text
188:             */
189:            public void setPreviewText(String text) {
190:                _previewText = text;
191:            }
192:
193:            /**
194:             * Fetch the URL for the persistent reference
195:             * @return A fully qualified URL value (minus any arguments)
196:             */
197:            public String getPersistentUrl() {
198:                return _persistentUrl;
199:            }
200:
201:            /**
202:             * Set the persistent URL
203:             * @param url Persistent URL
204:             */
205:            public void setPersistentUrl(String url) {
206:                _persistentUrl = url;
207:            }
208:
209:            /**
210:             * Set the persistent URL and simple parameters
211:             * @param persistentHref Persistent URL
212:             */
213:            public void setPersistentUrlAndParameters(String persistentHref) {
214:                String url = persistentHref;
215:
216:                if (!StringUtils.isNull(url)) {
217:                    int index;
218:
219:                    if ((index = url.indexOf('?')) != -1) {
220:                        if (++index < url.length()) {
221:                            _persistentParameters = url.substring(index);
222:                        }
223:                        url = url.substring(0, index);
224:                    }
225:                }
226:                _persistentUrl = url;
227:            }
228:
229:            /**
230:             * Fetch simple parameters for the persistent reference
231:             * @return Parameters (<code>?name1=value1&name2=value2</code>)
232:             */
233:            public String getPersistentUrlParameters() {
234:                return (_persistentParameters == null) ? ""
235:                        : _persistentParameters;
236:            }
237:
238:            /**
239:             * Set persistent URL parameter values
240:             * @param parameters Parameter text (name=value pairs)
241:             */
242:            public void setPersistentUrlParameters(String parameters) {
243:                _persistentParameters = parameters;
244:            }
245:
246:            /**
247:             * Fetch any persistent reference parameters that <i>must be</i> URL encoded.
248:             *<p>
249:             * Note: When used with IE, the HTML editor parses encoded text, replacing
250:             * entity sequences and the like with "real" characters - in rare cases, this
251:             * will cause the resultant URL to fail.  As a work around, the query handler
252:             * can specifiy parameters that need to be wrapped in a JavaScript escape()
253:             * at URL "click time".
254:             *
255:             * @return Parameters (<code>?name3=value3&name4=value4</code>)
256:             */
257:            public String getPersistentUrlParametersForEncoding() {
258:                return _persistentParametersForEncoding;
259:            }
260:
261:            /**
262:             * Set any persistent URL parameter values that require JavaScript encoding
263:             * @param parameters Parameter text (name=value pairs)
264:             */
265:            public void setPersistentUrlParametersForEncoding(String parameters) {
266:                _persistentParametersForEncoding = parameters;
267:            }
268:
269:            /**
270:             * Fetch the link text associated with the persistent reference
271:             * @return Anchor text
272:             */
273:            public String getPersistentText() {
274:                return _persistentText;
275:            }
276:
277:            /**
278:             * Set persistent URL text
279:             * @param text Anchor text
280:             */
281:            public void setPersistentText(String text) {
282:                _persistentText = normalizePersistentText(text);
283:            }
284:
285:            /*
286:             * Helpers
287:             */
288:
289:            /**
290:             * Normalize persistent text:
291:             * <ul>
292:             * <li> Remove trailing dots (.)
293:             * </ul>
294:             * @param text Persistent text
295:             * @return Normalized text
296:             */
297:            private String normalizePersistentText(String text) {
298:                return StringUtils.trimEnd(text, '.');
299:            }
300:
301:            /**
302:             * Normalize description text:
303:             * <ul>
304:             * <li> Remove leading dots (.)
305:             * </ul>
306:             * @param text Description text
307:             * @return Normalized description
308:             */
309:            private String normalizeDescription(String text) {
310:                String result = StringUtils.trimFront(text, '.');
311:
312:                result = StringUtils.trimFront(result, ',');
313:                result = StringUtils.trimFront(result, ';');
314:
315:                return result;
316:            }
317:
318:            /**
319:             * Container class for Part ID and Value
320:             */
321:            public static class PartPair {
322:                private org.osid.shared.Id __id;
323:                private Serializable __value;
324:
325:                /**
326:                 * Simple constructor (unused)
327:                 */
328:                private PartPair() {
329:                }
330:
331:                /**
332:                 * Constructor (save ID and Value)
333:                 */
334:                private PartPair(org.osid.shared.Id id, Serializable value) {
335:                    __id = id;
336:                    __value = value;
337:                }
338:
339:                /**
340:                 * Return ID
341:                 */
342:                public org.osid.shared.Id getId() {
343:                    return __id;
344:                }
345:
346:                /**
347:                 * Return Value
348:                 */
349:                public Serializable getValue() {
350:                    return __value;
351:                }
352:            }
353:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.