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.requests;
025:
026: import java.io.IOException;
027: import java.util.HashMap;
028: import java.util.Map;
029: import org.fao.geonet.util.ISODate;
030: import org.fao.oaipmh.exceptions.OaiPmhException;
031: import org.fao.oaipmh.responses.ListIdentifiersResponse;
032: import org.jdom.JDOMException;
033: import org.xml.sax.SAXException;
034:
035: //=============================================================================
036:
037: public class ListIdentifiersRequest extends ListRequest {
038: public static final String VERB = "ListIdentifiers";
039:
040: //---------------------------------------------------------------------------
041: //---
042: //--- API methods
043: //---
044: //---------------------------------------------------------------------------
045:
046: public ISODate getFrom() {
047: return from;
048: }
049:
050: public ISODate getUntil() {
051: return until;
052: }
053:
054: public String getMetadataPrefix() {
055: return mdPrefix;
056: }
057:
058: public String getSet() {
059: return set;
060: }
061:
062: //---------------------------------------------------------------------------
063:
064: public void setFrom(ISODate date) {
065: from = date;
066: }
067:
068: //---------------------------------------------------------------------------
069:
070: public void setUntil(ISODate date) {
071: until = date;
072: }
073:
074: //---------------------------------------------------------------------------
075:
076: public void setMetadataPrefix(String mdPrefix) {
077: this .mdPrefix = mdPrefix;
078: }
079:
080: //---------------------------------------------------------------------------
081:
082: public void setSet(String set) {
083: this .set = set;
084: }
085:
086: //---------------------------------------------------------------------------
087:
088: public ListIdentifiersResponse execute() throws IOException,
089: OaiPmhException, JDOMException, SAXException, Exception {
090: Map<String, String> params = new HashMap<String, String>();
091:
092: if (resumpToken != null)
093: params.put("resumptionToken", resumpToken);
094: else {
095: params.put("metadataPrefix", mdPrefix);
096:
097: if (from != null)
098: params.put("from", (from.isShort) ? from.getDate()
099: : from.toString() + "Z");
100:
101: if (until != null)
102: params.put("until", (until.isShort) ? until.getDate()
103: : until.toString() + "Z");
104:
105: if (set != null)
106: params.put("set", set);
107: }
108:
109: return new ListIdentifiersResponse(this , sendRequest(params));
110: }
111:
112: //---------------------------------------------------------------------------
113:
114: public String getVerb() {
115: return VERB;
116: }
117:
118: //---------------------------------------------------------------------------
119: //---
120: //--- Variables
121: //---
122: //---------------------------------------------------------------------------
123:
124: private ISODate from;
125: private ISODate until;
126: private String mdPrefix;
127: private String set;
128: }
129:
130: //=============================================================================
|