001: package edu.indiana.lib.osid.base.repository.http;
002:
003: /**********************************************************************************
004: * $URL: https://source.sakaiproject.org/svn/citations/tags/sakai_2-4-1/citations-osid/web2bridge/src/java/edu/indiana/lib/osid/base/repository/http/Part.java $
005: * $Id: Part.java 22657 2007-03-15 13:21:23Z 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 extends edu.indiana.lib.osid.base.repository.Part {
030: private static org.apache.commons.logging.Log _log = edu.indiana.lib.twinpeaks.util.LogUtils
031: .getLog(Part.class);
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:
056: this .value = value;
057: try {
058: this .id = this .idManager.createId();
059:
060: if (partStructureId.isEqual(ContributorPartStructure
061: .getInstance().getId())) {
062: this .partStructure = ContributorPartStructure
063: .getInstance();
064:
065: } else if (partStructureId.isEqual(CoveragePartStructure
066: .getInstance().getId())) {
067: this .partStructure = CoveragePartStructure
068: .getInstance();
069:
070: } else if (partStructureId.isEqual(CreatorPartStructure
071: .getInstance().getId())) {
072: this .partStructure = CreatorPartStructure.getInstance();
073:
074: } else if (partStructureId.isEqual(DatePartStructure
075: .getInstance().getId())) {
076: this .partStructure = DatePartStructure.getInstance();
077:
078: } else if (partStructureId
079: .isEqual(DateRetrievedPartStructure.getInstance()
080: .getId())) {
081: this .partStructure = DateRetrievedPartStructure
082: .getInstance();
083:
084: } else if (partStructureId.isEqual(DOIPartStructure
085: .getInstance().getId())) {
086: this .partStructure = DOIPartStructure.getInstance();
087:
088: } else if (partStructureId.isEqual(EditionPartStructure
089: .getInstance().getId())) {
090: this .partStructure = EditionPartStructure.getInstance();
091:
092: } else if (partStructureId.isEqual(EndPagePartStructure
093: .getInstance().getId())) {
094: this .partStructure = EndPagePartStructure.getInstance();
095:
096: } else if (partStructureId.isEqual(FormatPartStructure
097: .getInstance().getId())) {
098: this .partStructure = FormatPartStructure.getInstance();
099:
100: } else if (partStructureId
101: .isEqual(InLineCitationPartStructure.getInstance()
102: .getId())) {
103: this .partStructure = InLineCitationPartStructure
104: .getInstance();
105:
106: } else if (partStructureId
107: .isEqual(IsnIdentifierPartStructure.getInstance()
108: .getId())) {
109: this .partStructure = IsnIdentifierPartStructure
110: .getInstance();
111:
112: } else if (partStructureId.isEqual(IssuePartStructure
113: .getInstance().getId())) {
114: this .partStructure = IssuePartStructure.getInstance();
115:
116: } else if (partStructureId.isEqual(LanguagePartStructure
117: .getInstance().getId())) {
118: this .partStructure = LanguagePartStructure
119: .getInstance();
120:
121: } else if (partStructureId.isEqual(NotePartStructure
122: .getInstance().getId())) {
123: this .partStructure = NotePartStructure.getInstance();
124:
125: } else if (partStructureId.isEqual(OpenUrlPartStructure
126: .getInstance().getId())) {
127: this .partStructure = OpenUrlPartStructure.getInstance();
128:
129: } else if (partStructureId.isEqual(PagesPartStructure
130: .getInstance().getId())) {
131: this .partStructure = PagesPartStructure.getInstance();
132:
133: } else if (partStructureId
134: .isEqual(PublicationLocationPartStructure
135: .getInstance().getId())) {
136: this .partStructure = PublicationLocationPartStructure
137: .getInstance();
138:
139: } else if (partStructureId.isEqual(PublisherPartStructure
140: .getInstance().getId())) {
141: this .partStructure = PublisherPartStructure
142: .getInstance();
143:
144: } else if (partStructureId.isEqual(RelationPartStructure
145: .getInstance().getId())) {
146: this .partStructure = RelationPartStructure
147: .getInstance();
148:
149: } else if (partStructureId.isEqual(RightsPartStructure
150: .getInstance().getId())) {
151: this .partStructure = RightsPartStructure.getInstance();
152:
153: } else if (partStructureId.isEqual(SourcePartStructure
154: .getInstance().getId())) {
155: this .partStructure = SourcePartStructure.getInstance();
156:
157: } else if (partStructureId.isEqual(SourceTitlePartStructure
158: .getInstance().getId())) {
159: this .partStructure = SourceTitlePartStructure
160: .getInstance();
161:
162: } else if (partStructureId.isEqual(StartPagePartStructure
163: .getInstance().getId())) {
164: this .partStructure = StartPagePartStructure
165: .getInstance();
166:
167: } else if (partStructureId.isEqual(SubjectPartStructure
168: .getInstance().getId())) {
169: this .partStructure = SubjectPartStructure.getInstance();
170:
171: } else if (partStructureId.isEqual(TypePartStructure
172: .getInstance().getId())) {
173: this .partStructure = TypePartStructure.getInstance();
174:
175: } else if (partStructureId.isEqual(URLPartStructure
176: .getInstance().getId())) {
177: this .partStructure = URLPartStructure.getInstance();
178:
179: } else if (partStructureId.isEqual(VolumePartStructure
180: .getInstance().getId())) {
181: this .partStructure = VolumePartStructure.getInstance();
182:
183: } else if (partStructureId.isEqual(YearPartStructure
184: .getInstance().getId())) {
185: this .partStructure = YearPartStructure.getInstance();
186:
187: } else {
188: throw new RuntimeException("Unknown PartStructure ID: "
189: + partStructureId);
190: }
191: } catch (Throwable t) {
192: _log.error(t.getMessage());
193: throw new org.osid.repository.RepositoryException(
194: org.osid.repository.RepositoryException.OPERATION_FAILED);
195: }
196: }
197:
198: public org.osid.repository.PartIterator getParts()
199: throws org.osid.repository.RepositoryException {
200: return new PartIterator(new java.util.Vector());
201: }
202:
203: public org.osid.repository.PartStructure getPartStructure()
204: throws org.osid.repository.RepositoryException {
205: return this .partStructure;
206: }
207:
208: public java.io.Serializable getValue()
209: throws org.osid.repository.RepositoryException {
210: _log.debug("Part.getValue() = " + (String) value);
211: return this .value;
212: }
213:
214: public void updateValue(java.io.Serializable value)
215: throws org.osid.repository.RepositoryException {
216: this.value = value;
217: }
218: }
|