Source Code Cross Referenced for Asset.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » component » osid » repository » srw » 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 » org.sakaiproject.component.osid.repository.srw 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: $
003:         * $Id:  $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.component.osid.repository.srw;
021:
022:        /**
023:         * @author Massachusetts Institute of Techbology, Sakai Software Development Team
024:         * @version
025:         */
026:        public class Asset implements  org.osid.repository.Asset {
027:            private org.osid.id.IdManager idManager = Managers.getIdManager();
028:            private org.osid.logging.WritableLog log = null;
029:            private org.osid.shared.Type assetType = new Type("mit.edu",
030:                    "asset", "library_content");
031:            private org.osid.shared.Type recordStructureType = new Type(
032:                    "mit.edu", "recordStructure", "library_content");
033:            private org.osid.shared.Type dcRecordStructureType = new Type(
034:                    "mit.edu", "recordStructure", "dublinCore");
035:            private org.osid.shared.Type vueRecordStructureType = new Type(
036:                    "tufts.edu", "recordStructure", "vue");
037:            private org.osid.shared.Id id = null;
038:            private org.osid.shared.Id repositoryId = null;
039:            private String idString = null;
040:            private String displayName = null;
041:            private String description = null;
042:            private org.osid.shared.Type type = null;
043:            private java.util.Vector recordVector = new java.util.Vector();
044:            private String content = null;
045:
046:            private void log(String entry)
047:                    throws org.osid.repository.RepositoryException {
048:                if (log != null) {
049:                    try {
050:                        log.appendLog(entry);
051:                    } catch (org.osid.logging.LoggingException lex) {
052:                        // swallow exception since logging is a best attempt to log an exception anyway
053:                    }
054:                }
055:            }
056:
057:            protected Asset(String displayName, String description,
058:                    String idString, org.osid.logging.WritableLog log,
059:                    org.osid.shared.Id repositoryId)
060:                    throws org.osid.repository.RepositoryException {
061:                this .displayName = displayName;
062:                this .description = description;
063:                this .log = log;
064:                this .repositoryId = repositoryId;
065:                this .type = new Type("mit.edu", "asset", "library_content");
066:                try {
067:                    this .id = idManager.getId(idString);
068:                } catch (Throwable t) {
069:                    log(t.getMessage());
070:                }
071:
072:            }
073:
074:            public String getDisplayName()
075:                    throws org.osid.repository.RepositoryException {
076:                return this .displayName;
077:            }
078:
079:            public void updateDisplayName(String displayName)
080:                    throws org.osid.repository.RepositoryException {
081:                throw new org.osid.repository.RepositoryException(
082:                        org.osid.OsidException.UNIMPLEMENTED);
083:            }
084:
085:            public String getDescription()
086:                    throws org.osid.repository.RepositoryException {
087:                return this .description;
088:            }
089:
090:            public void updateDescription(String description)
091:                    throws org.osid.repository.RepositoryException {
092:                throw new org.osid.repository.RepositoryException(
093:                        org.osid.OsidException.UNIMPLEMENTED);
094:            }
095:
096:            public org.osid.shared.Id getId()
097:                    throws org.osid.repository.RepositoryException {
098:                return this .id;
099:            }
100:
101:            public org.osid.shared.Id getRepository()
102:                    throws org.osid.repository.RepositoryException {
103:                return this .repositoryId;
104:            }
105:
106:            public java.io.Serializable getContent()
107:                    throws org.osid.repository.RepositoryException {
108:                return this .content;
109:            }
110:
111:            public void updateContent(java.io.Serializable content)
112:                    throws org.osid.repository.RepositoryException {
113:                throw new org.osid.repository.RepositoryException(
114:                        org.osid.OsidException.UNIMPLEMENTED);
115:            }
116:
117:            public void addAsset(org.osid.shared.Id assetId)
118:                    throws org.osid.repository.RepositoryException {
119:                throw new org.osid.repository.RepositoryException(
120:                        org.osid.OsidException.UNIMPLEMENTED);
121:            }
122:
123:            public void removeAsset(org.osid.shared.Id assetId,
124:                    boolean includeChildren)
125:                    throws org.osid.repository.RepositoryException {
126:                throw new org.osid.repository.RepositoryException(
127:                        org.osid.OsidException.UNIMPLEMENTED);
128:            }
129:
130:            public org.osid.repository.AssetIterator getAssets()
131:                    throws org.osid.repository.RepositoryException {
132:                return new AssetIterator(new java.util.Vector());
133:            }
134:
135:            public org.osid.repository.AssetIterator getAssetsByType(
136:                    org.osid.shared.Type assetType)
137:                    throws org.osid.repository.RepositoryException {
138:                if (assetType == null) {
139:                    throw new org.osid.repository.RepositoryException(
140:                            org.osid.shared.SharedException.NULL_ARGUMENT);
141:                }
142:                return new AssetIterator(new java.util.Vector());
143:            }
144:
145:            public org.osid.repository.Record createRecord(
146:                    org.osid.shared.Id recordStructureId)
147:                    throws org.osid.repository.RepositoryException {
148:                if (recordStructureId == null) {
149:                    throw new org.osid.repository.RepositoryException(
150:                            org.osid.shared.SharedException.NULL_ARGUMENT);
151:                }
152:                try {
153:                    org.osid.repository.Record record = new Record(
154:                            recordStructureId, this .idManager, this .log);
155:                    this .recordVector.addElement(record);
156:                    return record;
157:                } catch (Throwable t) {
158:                    log(t.getMessage());
159:                    throw new org.osid.repository.RepositoryException(
160:                            org.osid.OsidException.OPERATION_FAILED);
161:                }
162:            }
163:
164:            public void inheritRecordStructure(org.osid.shared.Id assetId,
165:                    org.osid.shared.Id recordStructureId)
166:                    throws org.osid.repository.RepositoryException {
167:                throw new org.osid.repository.RepositoryException(
168:                        org.osid.OsidException.UNIMPLEMENTED);
169:            }
170:
171:            public void copyRecordStructure(org.osid.shared.Id assetId,
172:                    org.osid.shared.Id recordStructureId)
173:                    throws org.osid.repository.RepositoryException {
174:                throw new org.osid.repository.RepositoryException(
175:                        org.osid.OsidException.UNIMPLEMENTED);
176:            }
177:
178:            public void deleteRecord(org.osid.shared.Id recordId)
179:                    throws org.osid.repository.RepositoryException {
180:                if (recordId == null) {
181:                    throw new org.osid.repository.RepositoryException(
182:                            org.osid.shared.SharedException.NULL_ARGUMENT);
183:                }
184:                try {
185:                    for (int i = 0, size = this .recordVector.size(); i < size; i++) {
186:                        org.osid.repository.Record record = (org.osid.repository.Record) this .recordVector
187:                                .elementAt(i);
188:                        if (record.getId().isEqual(recordId)) {
189:                            this .recordVector.removeElementAt(i);
190:                            return;
191:                        }
192:                    }
193:                    throw new org.osid.repository.RepositoryException(
194:                            org.osid.shared.SharedException.UNKNOWN_ID);
195:                } catch (Throwable t) {
196:                    log(t.getMessage());
197:                    throw new org.osid.repository.RepositoryException(
198:                            org.osid.OsidException.OPERATION_FAILED);
199:                }
200:            }
201:
202:            public org.osid.repository.RecordIterator getRecords()
203:                    throws org.osid.repository.RepositoryException {
204:                return new RecordIterator(this .recordVector);
205:            }
206:
207:            public org.osid.repository.RecordIterator getRecordsByRecordStructure(
208:                    org.osid.shared.Id recordStructureId)
209:                    throws org.osid.repository.RepositoryException {
210:                if (recordStructureId == null) {
211:                    throw new org.osid.repository.RepositoryException(
212:                            org.osid.shared.SharedException.NULL_ARGUMENT);
213:                }
214:                try {
215:                    return new RecordIterator(this .recordVector);
216:                } catch (Throwable t) {
217:                    log(t.getMessage());
218:                    throw new org.osid.repository.RepositoryException(
219:                            org.osid.OsidException.OPERATION_FAILED);
220:                }
221:            }
222:
223:            public org.osid.shared.Type getAssetType()
224:                    throws org.osid.repository.RepositoryException {
225:                return this .type;
226:            }
227:
228:            public org.osid.repository.RecordStructureIterator getRecordStructures()
229:                    throws org.osid.repository.RepositoryException {
230:                java.util.Vector results = new java.util.Vector();
231:                results.addElement(new RecordStructure());
232:                return new RecordStructureIterator(results);
233:            }
234:
235:            public org.osid.repository.RecordStructure getContentRecordStructure()
236:                    throws org.osid.repository.RepositoryException {
237:                return new RecordStructure();
238:            }
239:
240:            public org.osid.repository.Record getRecord(
241:                    org.osid.shared.Id recordId)
242:                    throws org.osid.repository.RepositoryException {
243:                if (recordId == null) {
244:                    throw new org.osid.repository.RepositoryException(
245:                            org.osid.shared.SharedException.NULL_ARGUMENT);
246:                }
247:                try {
248:                    for (int i = 0, size = this .recordVector.size(); i < size; i++) {
249:                        org.osid.repository.Record record = (org.osid.repository.Record) this .recordVector
250:                                .elementAt(i);
251:                        if (record.getId().isEqual(recordId)) {
252:                            return record;
253:                        }
254:                    }
255:                    throw new org.osid.repository.RepositoryException(
256:                            org.osid.shared.SharedException.UNKNOWN_ID);
257:                } catch (Throwable t) {
258:                    log(t.getMessage());
259:                    throw new org.osid.repository.RepositoryException(
260:                            org.osid.OsidException.OPERATION_FAILED);
261:                }
262:            }
263:
264:            public org.osid.repository.Part getPart(org.osid.shared.Id partId)
265:                    throws org.osid.repository.RepositoryException {
266:                if (partId == null) {
267:                    throw new org.osid.repository.RepositoryException(
268:                            org.osid.shared.SharedException.NULL_ARGUMENT);
269:                }
270:                try {
271:                    for (int i = 0, size = this .recordVector.size(); i < size; i++) {
272:                        org.osid.repository.Record record = (org.osid.repository.Record) this .recordVector
273:                                .elementAt(i);
274:                        org.osid.repository.PartIterator partIterator = record
275:                                .getParts();
276:                        while (partIterator.hasNextPart()) {
277:                            org.osid.repository.Part part = partIterator
278:                                    .nextPart();
279:                            if (part.getId().isEqual(partId)) {
280:                                return part;
281:                            }
282:                        }
283:                    }
284:                    throw new org.osid.repository.RepositoryException(
285:                            org.osid.shared.SharedException.UNKNOWN_ID);
286:                } catch (Throwable t) {
287:                    log(t.getMessage());
288:                    throw new org.osid.repository.RepositoryException(
289:                            org.osid.OsidException.OPERATION_FAILED);
290:                }
291:            }
292:
293:            public java.io.Serializable getPartValue(org.osid.shared.Id partId)
294:                    throws org.osid.repository.RepositoryException {
295:                org.osid.repository.Part part = getPart(partId);
296:                return part.getValue();
297:            }
298:
299:            public org.osid.repository.PartIterator getPartByPart(
300:                    org.osid.shared.Id partStructureId)
301:                    throws org.osid.repository.RepositoryException {
302:                if (partStructureId == null) {
303:                    throw new org.osid.repository.RepositoryException(
304:                            org.osid.shared.SharedException.NULL_ARGUMENT);
305:                }
306:                try {
307:                    java.util.Vector results = new java.util.Vector();
308:                    for (int i = 0, size = this .recordVector.size(); i < size; i++) {
309:                        org.osid.repository.Record record = (org.osid.repository.Record) this .recordVector
310:                                .elementAt(i);
311:                        org.osid.repository.PartIterator partIterator = record
312:                                .getParts();
313:                        while (partIterator.hasNextPart()) {
314:                            org.osid.repository.Part part = partIterator
315:                                    .nextPart();
316:                            if (part.getPartStructure().getId().isEqual(
317:                                    partStructureId)) {
318:                                results.addElement(part);
319:                            }
320:                        }
321:                    }
322:                    return new PartIterator(results);
323:                } catch (Throwable t) {
324:                    log(t.getMessage());
325:                    throw new org.osid.repository.RepositoryException(
326:                            org.osid.OsidException.OPERATION_FAILED);
327:                }
328:            }
329:
330:            public org.osid.shared.ObjectIterator getPartValueByPart(
331:                    org.osid.shared.Id partStructureId)
332:                    throws org.osid.repository.RepositoryException {
333:                java.util.Vector results = new java.util.Vector();
334:                org.osid.repository.PartIterator partIterator = getPartByPart(partStructureId);
335:                while (partIterator.hasNextPart()) {
336:                    results.addElement(partIterator.nextPart().getValue());
337:                }
338:                try {
339:                    return new ObjectIterator(results);
340:                } catch (Throwable t) {
341:                    log(t.getMessage());
342:                    throw new org.osid.repository.RepositoryException(
343:                            org.osid.OsidException.OPERATION_FAILED);
344:                }
345:            }
346:
347:            public long getEffectiveDate()
348:                    throws org.osid.repository.RepositoryException {
349:                throw new org.osid.repository.RepositoryException(
350:                        org.osid.OsidException.UNIMPLEMENTED);
351:            }
352:
353:            public void updateEffectiveDate(long effectiveDate)
354:                    throws org.osid.repository.RepositoryException {
355:                throw new org.osid.repository.RepositoryException(
356:                        org.osid.OsidException.UNIMPLEMENTED);
357:            }
358:
359:            public long getExpirationDate()
360:                    throws org.osid.repository.RepositoryException {
361:                throw new org.osid.repository.RepositoryException(
362:                        org.osid.OsidException.UNIMPLEMENTED);
363:            }
364:
365:            public void updateExpirationDate(long expirationDate)
366:                    throws org.osid.repository.RepositoryException {
367:                throw new org.osid.repository.RepositoryException(
368:                        org.osid.OsidException.UNIMPLEMENTED);
369:            }
370:
371:            public org.osid.shared.ObjectIterator getPartValuesByPartStructure(
372:                    org.osid.shared.Id partStructureId)
373:                    throws org.osid.repository.RepositoryException {
374:                if (partStructureId == null) {
375:                    throw new org.osid.repository.RepositoryException(
376:                            org.osid.shared.SharedException.NULL_ARGUMENT);
377:                }
378:                try {
379:                    java.util.Vector results = new java.util.Vector();
380:                    org.osid.repository.PartIterator partIterator = getPartsByPartStructure(partStructureId);
381:                    while (partIterator.hasNextPart()) {
382:                        org.osid.repository.Part part = partIterator.nextPart();
383:                        results.addElement(part.getValue());
384:                    }
385:                    return new ObjectIterator(results);
386:                } catch (Throwable t) {
387:                    log(t.getMessage());
388:                    throw new org.osid.repository.RepositoryException(
389:                            org.osid.OsidException.OPERATION_FAILED);
390:                }
391:            }
392:
393:            public org.osid.repository.PartIterator getPartsByPartStructure(
394:                    org.osid.shared.Id partStructureId)
395:                    throws org.osid.repository.RepositoryException {
396:                if (partStructureId == null) {
397:                    throw new org.osid.repository.RepositoryException(
398:                            org.osid.shared.SharedException.NULL_ARGUMENT);
399:                }
400:                try {
401:                    java.util.Vector results = new java.util.Vector();
402:                    org.osid.repository.RecordIterator recordIterator = getRecords();
403:                    while (recordIterator.hasNextRecord()) {
404:                        org.osid.repository.Record record = recordIterator
405:                                .nextRecord();
406:                        org.osid.repository.PartIterator partIterator = record
407:                                .getParts();
408:                        while (partIterator.hasNextPart()) {
409:                            org.osid.repository.Part part = partIterator
410:                                    .nextPart();
411:                            if (part.getPartStructure().getId().isEqual(
412:                                    partStructureId)) {
413:                                results.addElement(part);
414:                            }
415:                        }
416:                    }
417:                    return new PartIterator(results);
418:                } catch (Throwable t) {
419:                    log(t.getMessage());
420:                    throw new org.osid.repository.RepositoryException(
421:                            org.osid.OsidException.OPERATION_FAILED);
422:                }
423:            }
424:
425:            public org.osid.repository.RecordIterator getRecordsByRecordStructureType(
426:                    org.osid.shared.Type recordStructureType)
427:                    throws org.osid.repository.RepositoryException {
428:                if (recordStructureType == null) {
429:                    throw new org.osid.repository.RepositoryException(
430:                            org.osid.shared.SharedException.NULL_ARGUMENT);
431:                }
432:
433:                if ((!recordStructureType.isEqual(this .recordStructureType))
434:                        && (!recordStructureType
435:                                .isEqual(this .dcRecordStructureType))
436:                        && (!recordStructureType
437:                                .isEqual(this .vueRecordStructureType))) {
438:                    throw new org.osid.repository.RepositoryException(
439:                            org.osid.shared.SharedException.UNKNOWN_TYPE);
440:                }
441:
442:                java.util.Vector results = new java.util.Vector();
443:                for (int i = 0, size = this .recordVector.size(); i < size; i++) {
444:                    org.osid.repository.Record r = (org.osid.repository.Record) this .recordVector
445:                            .elementAt(i);
446:                    if (r.getRecordStructure().getType().isEqual(
447:                            recordStructureType)) {
448:                        results.addElement(r);
449:                    }
450:                }
451:                return new RecordIterator(results);
452:            }
453:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.