Search in sources :

Example 1 with ArticlePackageBuilder

use of org.ambraproject.rhino.model.ingest.ArticlePackageBuilder in project rhino by PLOS.

the class IngestionService method createIngestPackage.

private IngestPackage createIngestPackage(Archive archive, Optional<String> bucketName) throws IOException {
    ManifestXml manifestXml = getManifestXml(archive);
    ImmutableSet<String> entryNames = archive.getEntryNames();
    manifestXml.validateManifestCompleteness(entryNames);
    String manuscriptEntry = getManuscriptEntry(entryNames, manifestXml);
    Document document = getDocument(archive, manuscriptEntry);
    ArticleXml parsedArticle = new ArticleXml(document);
    ArticleCustomMetadata customMetadata = customMetadataExtractorFactory.parse(document).build();
    ArticlePackage articlePackage = new ArticlePackageBuilder(resolveBucketName(bucketName), archive, parsedArticle, manifestXml).build();
    articlePackage.validateAssetCompleteness(parsedArticle.findAllAssetNodes().getDois());
    ArticleMetadata articleMetadata = parsedArticle.build();
    return new IngestPackage(articlePackage, articleMetadata, customMetadata);
}
Also used : ArticlePackageBuilder(org.ambraproject.rhino.model.ingest.ArticlePackageBuilder) IngestPackage(org.ambraproject.rhino.model.ingest.IngestPackage) ArticleXml(org.ambraproject.rhino.content.xml.ArticleXml) ManifestXml(org.ambraproject.rhino.content.xml.ManifestXml) ArticleCustomMetadata(org.ambraproject.rhino.model.article.ArticleCustomMetadata) Document(org.w3c.dom.Document) ArticlePackage(org.ambraproject.rhino.model.ingest.ArticlePackage) ArticleMetadata(org.ambraproject.rhino.model.article.ArticleMetadata)

Aggregations

ArticleXml (org.ambraproject.rhino.content.xml.ArticleXml)1 ManifestXml (org.ambraproject.rhino.content.xml.ManifestXml)1 ArticleCustomMetadata (org.ambraproject.rhino.model.article.ArticleCustomMetadata)1 ArticleMetadata (org.ambraproject.rhino.model.article.ArticleMetadata)1 ArticlePackage (org.ambraproject.rhino.model.ingest.ArticlePackage)1 ArticlePackageBuilder (org.ambraproject.rhino.model.ingest.ArticlePackageBuilder)1 IngestPackage (org.ambraproject.rhino.model.ingest.IngestPackage)1 Document (org.w3c.dom.Document)1