Search in sources :

Example 1 with Description

use of org.mycore.oai.pmh.Description in project mycore by MyCoRe-Org.

the class MCROAISetManager method createSet.

private MCRSet createSet(String setId, Element setElement) {
    String setSpec = setElement.getChildText("setSpec", NS_OAI);
    String setName = setElement.getChildText("setName", NS_OAI);
    MCRSet set = new MCRSet(setId, getSetSpec(setSpec), setName);
    set.getDescription().addAll(setElement.getChildren("setDescription", NS_OAI).stream().flatMap(// first childElement of setDescription
    e -> e.getChildren().stream().limit(1)).peek(Element::detach).map(d -> (Description) new Description() {

        @Override
        public Element toXML() {
            return d;
        }

        @Override
        public void fromXML(Element descriptionElement) {
            throw new UnsupportedOperationException();
        }
    }).collect(Collectors.toList()));
    return set;
}
Also used : Description(org.mycore.oai.pmh.Description) Element(org.jdom2.Element) MCRSet(org.mycore.oai.set.MCRSet)

Aggregations

Element (org.jdom2.Element)1 Description (org.mycore.oai.pmh.Description)1 MCRSet (org.mycore.oai.set.MCRSet)1