Search in sources :

Example 1 with ItemHelper

use of com.lyncode.xoai.dataprovider.handlers.helpers.ItemHelper in project dataverse by IQSS.

the class XlistRecordsHandler method createRecord.

private Record createRecord(OAICompiledRequest parameters, Item item) throws BadArgumentException, CannotDisseminateRecordException, OAIException, NoMetadataFormatsException, CannotDisseminateFormatException {
    MetadataFormat format = getContext().formatForPrefix(parameters.getMetadataPrefix());
    Header header = new Header();
    Dataset dataset = ((Xitem) item).getDataset();
    Xrecord xrecord = new Xrecord().withFormatName(parameters.getMetadataPrefix()).withDataset(dataset);
    header.withIdentifier(item.getIdentifier());
    ItemHelper itemHelperWrap = new ItemHelper(item);
    header.withDatestamp(item.getDatestamp());
    for (Set set : itemHelperWrap.getSets(getContext(), getRepository().getFilterResolver())) header.withSetSpec(set.getSpec());
    if (item.isDeleted())
        header.withStatus(Header.Status.DELETED);
    xrecord.withHeader(header);
    xrecord.withMetadata(item.getMetadata());
    return xrecord;
}
Also used : ItemHelper(com.lyncode.xoai.dataprovider.handlers.helpers.ItemHelper) MetadataFormat(com.lyncode.xoai.dataprovider.model.MetadataFormat) Set(com.lyncode.xoai.dataprovider.model.Set) Dataset(edu.harvard.iq.dataverse.Dataset)

Example 2 with ItemHelper

use of com.lyncode.xoai.dataprovider.handlers.helpers.ItemHelper in project dataverse by IQSS.

the class XgetRecordHandler method createRecord.

private Xrecord createRecord(OAICompiledRequest parameters, Item item) throws BadArgumentException, CannotDisseminateRecordException, OAIException, NoMetadataFormatsException, CannotDisseminateFormatException {
    MetadataFormat format = getContext().formatForPrefix(parameters.getMetadataPrefix());
    Header header = new Header();
    Dataset dataset = ((Xitem) item).getDataset();
    Xrecord xrecord = new Xrecord().withFormatName(parameters.getMetadataPrefix()).withDataset(dataset);
    header.withIdentifier(item.getIdentifier());
    ItemHelper itemHelperWrap = new ItemHelper(item);
    header.withDatestamp(item.getDatestamp());
    for (Set set : itemHelperWrap.getSets(getContext(), getRepository().getFilterResolver())) header.withSetSpec(set.getSpec());
    if (item.isDeleted())
        header.withStatus(Header.Status.DELETED);
    xrecord.withHeader(header);
    xrecord.withMetadata(item.getMetadata());
    return xrecord;
}
Also used : ItemHelper(com.lyncode.xoai.dataprovider.handlers.helpers.ItemHelper) MetadataFormat(com.lyncode.xoai.dataprovider.model.MetadataFormat) Set(com.lyncode.xoai.dataprovider.model.Set) Dataset(edu.harvard.iq.dataverse.Dataset)

Aggregations

ItemHelper (com.lyncode.xoai.dataprovider.handlers.helpers.ItemHelper)2 MetadataFormat (com.lyncode.xoai.dataprovider.model.MetadataFormat)2 Set (com.lyncode.xoai.dataprovider.model.Set)2 Dataset (edu.harvard.iq.dataverse.Dataset)2