001: //=============================================================================
002: //=== Copyright (C) 2001-2007 Food and Agriculture Organization of the
003: //=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
004: //=== and United Nations Environment Programme (UNEP)
005: //===
006: //=== This program is free software; you can redistribute it and/or modify
007: //=== it under the terms of the GNU General Public License as published by
008: //=== the Free Software Foundation; either version 2 of the License, or (at
009: //=== your option) any later version.
010: //===
011: //=== This program is distributed in the hope that it will be useful, but
012: //=== WITHOUT ANY WARRANTY; without even the implied warranty of
013: //=== MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: //=== General Public License for more details.
015: //===
016: //=== You should have received a copy of the GNU General Public License
017: //=== along with this program; if not, write to the Free Software
018: //=== Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
019: //===
020: //=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
021: //=== Rome - Italy. email: geonetwork@osgeo.org
022: //==============================================================================
023:
024: package org.fao.oaipmh.responses;
025:
026: import org.fao.oaipmh.OaiPmh;
027: import org.fao.oaipmh.requests.GetRecordRequest;
028: import org.jdom.Element;
029:
030: //=============================================================================
031:
032: public class GetRecordResponse extends AbstractResponse {
033: //---------------------------------------------------------------------------
034: //---
035: //--- Constructor
036: //---
037: //---------------------------------------------------------------------------
038:
039: public GetRecordResponse() {
040: }
041:
042: //---------------------------------------------------------------------------
043:
044: public GetRecordResponse(Element response) {
045: super (response);
046: build(response);
047: }
048:
049: //---------------------------------------------------------------------------
050: //---
051: //--- API methods
052: //---
053: //---------------------------------------------------------------------------
054:
055: public Record getRecord() {
056: return record;
057: }
058:
059: //---------------------------------------------------------------------------
060:
061: public void setRecord(Record r) {
062: record = r;
063: }
064:
065: //---------------------------------------------------------------------------
066:
067: public Element toXml() {
068: Element root = new Element(GetRecordRequest.VERB,
069: OaiPmh.Namespaces.OAI_PMH);
070:
071: root.addContent(record.toXml());
072:
073: return root;
074: }
075:
076: //---------------------------------------------------------------------------
077: //---
078: //--- Private methods
079: //---
080: //---------------------------------------------------------------------------
081:
082: private void build(Element response) {
083: Element getRec = response.getChild("GetRecord",
084: OaiPmh.Namespaces.OAI_PMH);
085: Element record = getRec.getChild("record",
086: OaiPmh.Namespaces.OAI_PMH);
087:
088: this .record = new Record(record);
089: }
090:
091: //---------------------------------------------------------------------------
092: //---
093: //--- Variables
094: //---
095: //---------------------------------------------------------------------------
096:
097: private Record record;
098: }
099:
100: //=============================================================================
|