2008-03-13 14:43:08 +01:00
|
|
|
/*
|
2008-03-14 10:00:56 +01:00
|
|
|
* Copyright 2008 National Library of Sweden
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2008-03-13 14:43:08 +01:00
|
|
|
*/
|
2008-03-14 10:00:56 +01:00
|
|
|
|
2008-03-13 14:43:08 +01:00
|
|
|
package se.kb.oai.pmh;
|
|
|
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
2008-03-14 11:24:18 +01:00
|
|
|
import org.dom4j.Document;
|
2008-03-13 14:43:08 +01:00
|
|
|
import org.dom4j.Node;
|
|
|
|
|
2008-03-14 16:45:59 +01:00
|
|
|
/**
|
|
|
|
* Class that represents the response from a <code>ListSets</code> request.
|
2008-03-17 11:39:33 +01:00
|
|
|
* Can be used to get a list of <code>Sets</code>, i.e. <code>asList()</code>
|
|
|
|
* will return a <code>List<Set></code>.
|
2008-03-14 16:45:59 +01:00
|
|
|
*
|
|
|
|
* @author Oskar Grenholm, National Library of Sweden
|
|
|
|
*/
|
2008-03-16 20:15:05 +01:00
|
|
|
public class SetsList extends ListBase<Set> {
|
2008-03-13 14:43:08 +01:00
|
|
|
|
|
|
|
private static final String SET_XPATH = "oai:ListSets/oai:set";
|
2008-03-16 20:15:05 +01:00
|
|
|
|
2008-03-14 16:45:59 +01:00
|
|
|
/**
|
|
|
|
* Creates an <code>SetsList</code> from the returned response.
|
|
|
|
*
|
|
|
|
* @param document the response
|
|
|
|
* @throws ErrorResponseException
|
|
|
|
*/
|
2008-03-14 10:00:56 +01:00
|
|
|
public SetsList(Document document) throws ErrorResponseException {
|
2008-03-13 14:43:08 +01:00
|
|
|
super(document);
|
|
|
|
|
2008-03-16 20:15:05 +01:00
|
|
|
super.list = new LinkedList<Set>();
|
2008-03-13 14:43:08 +01:00
|
|
|
for (Node set : xpath.selectNodes(SET_XPATH)) {
|
2008-03-16 20:15:05 +01:00
|
|
|
list.add(new Set(set));
|
2008-03-13 14:43:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|