Search in sources :

Example 1 with XOAIMetadata

use of com.lyncode.xoai.model.xoai.XOAIMetadata in project dataverse by IQSS.

the class XsetRepository method retrieveSets.

@Override
public ListSetsResult retrieveSets(int offset, int length) {
    logger.fine("calling retrieveSets()");
    List<OAISet> dataverseOAISets = setService.findAll();
    List<Set> XOAISets = new ArrayList<Set>();
    if (dataverseOAISets != null) {
        for (int i = 0; i < dataverseOAISets.size(); i++) {
            OAISet dataverseSet = dataverseOAISets.get(i);
            Set xoaiSet = new Set(dataverseSet.getSpec());
            xoaiSet.withName(dataverseSet.getName());
            XOAIMetadata xMetadata = new XOAIMetadata();
            Element element = new Element("description");
            element.withField("description", dataverseSet.getDescription());
            xMetadata.getElements().add(element);
            xoaiSet.withDescription(xMetadata);
            XOAISets.add(xoaiSet);
        }
    }
    return new ListSetsResult(offset + length < XOAISets.size(), XOAISets.subList(offset, Math.min(offset + length, XOAISets.size())));
}
Also used : Set(com.lyncode.xoai.dataprovider.model.Set) OAISet(edu.harvard.iq.dataverse.harvest.server.OAISet) ListSetsResult(com.lyncode.xoai.dataprovider.handlers.results.ListSetsResult) Element(com.lyncode.xoai.model.xoai.Element) ArrayList(java.util.ArrayList) XOAIMetadata(com.lyncode.xoai.model.xoai.XOAIMetadata) OAISet(edu.harvard.iq.dataverse.harvest.server.OAISet)

Aggregations

ListSetsResult (com.lyncode.xoai.dataprovider.handlers.results.ListSetsResult)1 Set (com.lyncode.xoai.dataprovider.model.Set)1 Element (com.lyncode.xoai.model.xoai.Element)1 XOAIMetadata (com.lyncode.xoai.model.xoai.XOAIMetadata)1 OAISet (edu.harvard.iq.dataverse.harvest.server.OAISet)1 ArrayList (java.util.ArrayList)1