001: package org.sakaibrary.osid.repository.xserver;
002:
003: /**********************************************************************************
004: * $URL: https://source.sakaiproject.org/svn/citations/tags/sakai_2-4-1/citations-osid/xserver/src/java/org/sakaibrary/osid/repository/xserver/Part.java $
005: * $Id: Part.java 22640 2007-03-14 21:04:07Z jimeng@umich.edu $
006: **********************************************************************************
007: *
008: * Copyright (c) 2003, 2004, 2005 The Regents of the University of Michigan, Trustees of Indiana University,
009: * Board of Trustees of the Leland Stanford, Jr., University, and The MIT Corporation
010: *
011: * Licensed under the Educational Community License Version 1.0 (the "License");
012: * By obtaining, using and/or copying this Original Work, you agree that you have read,
013: * understand, and will comply with the terms and conditions of the Educational Community License.
014: * You may obtain a copy of the License at:
015: *
016: * http://cvs.sakaiproject.org/licenses/license_1_0.html
017: *
018: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
019: * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
020: * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
021: * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
022: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
023: *
024: **********************************************************************************/
025: /**
026: * @author Massachusetts Institute of Techbology, Sakai Software Development Team
027: * @version
028: */
029: public class Part implements org.osid.repository.Part {
030: private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
031: .getLog("org.sakaibrary.osid.repository.xserver.Part");
032:
033: private org.osid.repository.PartStructure partStructure = null;
034: private org.osid.shared.Id partStructureId = null;
035: private java.io.Serializable value = null;
036: private org.osid.id.IdManager idManager = null;
037: private String displayName = null;
038: private org.osid.shared.Id id = null;
039:
040: public String getDisplayName()
041: throws org.osid.repository.RepositoryException {
042: return this .displayName;
043: }
044:
045: public org.osid.shared.Id getId()
046: throws org.osid.repository.RepositoryException {
047: return this .id;
048: }
049:
050: protected Part(org.osid.shared.Id partStructureId,
051: java.io.Serializable value, org.osid.id.IdManager idManager)
052: throws org.osid.repository.RepositoryException {
053: this .idManager = idManager;
054: this .partStructureId = partStructureId;
055: this .value = value;
056:
057: try {
058: this .id = this .idManager.createId();
059: if (partStructureId.isEqual(DateRetrievedPartStructure
060: .getInstance().getId())) {
061: this .partStructure = DateRetrievedPartStructure
062: .getInstance();
063: } else if (partStructureId.isEqual(EditionPartStructure
064: .getInstance().getId())) {
065: this .partStructure = EditionPartStructure.getInstance();
066: } else if (partStructureId.isEqual(CreatorPartStructure
067: .getInstance().getId())) {
068: this .partStructure = CreatorPartStructure.getInstance();
069: } else if (partStructureId.isEqual(DatePartStructure
070: .getInstance().getId())) {
071: this .partStructure = DatePartStructure.getInstance();
072: } else if (partStructureId.isEqual(DOIPartStructure
073: .getInstance().getId())) {
074: this .partStructure = DOIPartStructure.getInstance();
075: } else if (partStructureId
076: .isEqual(InLineCitationPartStructure.getInstance()
077: .getId())) {
078: this .partStructure = InLineCitationPartStructure
079: .getInstance();
080: } else if (partStructureId.isEqual(LanguagePartStructure
081: .getInstance().getId())) {
082: this .partStructure = LanguagePartStructure
083: .getInstance();
084: } else if (partStructureId.isEqual(PublisherPartStructure
085: .getInstance().getId())) {
086: this .partStructure = PublisherPartStructure
087: .getInstance();
088: } else if (partStructureId.isEqual(IssuePartStructure
089: .getInstance().getId())) {
090: this .partStructure = IssuePartStructure.getInstance();
091: } else if (partStructureId
092: .isEqual(LocIdentifierPartStructure.getInstance()
093: .getId())) {
094: this .partStructure = LocIdentifierPartStructure
095: .getInstance();
096: } else if (partStructureId.isEqual(SourceTitlePartStructure
097: .getInstance().getId())) {
098: this .partStructure = SourceTitlePartStructure
099: .getInstance();
100: } else if (partStructureId.isEqual(SubjectPartStructure
101: .getInstance().getId())) {
102: this .partStructure = SubjectPartStructure.getInstance();
103: } else if (partStructureId.isEqual(TypePartStructure
104: .getInstance().getId())) {
105: this .partStructure = TypePartStructure.getInstance();
106: } else if (partStructureId.isEqual(NotePartStructure
107: .getInstance().getId())) {
108: this .partStructure = NotePartStructure.getInstance();
109: } else if (partStructureId
110: .isEqual(IsnIdentifierPartStructure.getInstance()
111: .getId())) {
112: this .partStructure = IsnIdentifierPartStructure
113: .getInstance();
114: } else if (partStructureId.isEqual(URLPartStructure
115: .getInstance().getId())) {
116: this .partStructure = URLPartStructure.getInstance();
117: } else if (partStructureId.isEqual(URLLabelPartStructure
118: .getInstance().getId())) {
119: this .partStructure = URLLabelPartStructure
120: .getInstance();
121: } else if (partStructureId.isEqual(URLFormatPartStructure
122: .getInstance().getId())) {
123: this .partStructure = URLFormatPartStructure
124: .getInstance();
125: } else if (partStructureId.isEqual(OpenUrlPartStructure
126: .getInstance().getId())) {
127: this .partStructure = OpenUrlPartStructure.getInstance();
128: } else if (partStructureId.isEqual(PagesPartStructure
129: .getInstance().getId())) {
130: this .partStructure = PagesPartStructure.getInstance();
131: } else if (partStructureId
132: .isEqual(PublicationLocationPartStructure
133: .getInstance().getId())) {
134: this .partStructure = PublicationLocationPartStructure
135: .getInstance();
136: } else if (partStructureId.isEqual(RightsPartStructure
137: .getInstance().getId())) {
138: this .partStructure = RightsPartStructure.getInstance();
139: } else if (partStructureId.isEqual(VolumePartStructure
140: .getInstance().getId())) {
141: this .partStructure = VolumePartStructure.getInstance();
142: } else if (partStructureId.isEqual(YearPartStructure
143: .getInstance().getId())) {
144: this .partStructure = YearPartStructure.getInstance();
145: } else if (partStructureId.isEqual(StartPagePartStructure
146: .getInstance().getId())) {
147: this .partStructure = StartPagePartStructure
148: .getInstance();
149: } else if (partStructureId.isEqual(EndPagePartStructure
150: .getInstance().getId())) {
151: this .partStructure = EndPagePartStructure.getInstance();
152: }
153:
154: this .displayName = this .partStructure.getDisplayName();
155: } catch (Throwable t) {
156: LOG.warn(t.getMessage());
157: throw new org.osid.repository.RepositoryException(
158: org.osid.repository.RepositoryException.OPERATION_FAILED);
159: }
160: }
161:
162: public org.osid.repository.Part createPart(
163: org.osid.shared.Id partStructureId,
164: java.io.Serializable value)
165: throws org.osid.repository.RepositoryException {
166: throw new org.osid.repository.RepositoryException(
167: org.osid.OsidException.UNIMPLEMENTED);
168: }
169:
170: public void deletePart(org.osid.shared.Id partStructureId)
171: throws org.osid.repository.RepositoryException {
172: throw new org.osid.repository.RepositoryException(
173: org.osid.OsidException.UNIMPLEMENTED);
174: }
175:
176: public void updateDisplayName(String displayName)
177: throws org.osid.repository.RepositoryException {
178: throw new org.osid.repository.RepositoryException(
179: org.osid.OsidException.UNIMPLEMENTED);
180: }
181:
182: public org.osid.repository.PartIterator getParts()
183: throws org.osid.repository.RepositoryException {
184: return new PartIterator(new java.util.Vector());
185: }
186:
187: public org.osid.repository.PartStructure getPartStructure()
188: throws org.osid.repository.RepositoryException {
189: return this .partStructure;
190: }
191:
192: public java.io.Serializable getValue()
193: throws org.osid.repository.RepositoryException {
194: return this .value;
195: }
196:
197: public void updateValue(java.io.Serializable value)
198: throws org.osid.repository.RepositoryException {
199: this.value = value;
200: }
201: }
|