use of org.ambraproject.rhino.model.ingest.ArticlePackage 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);
}
use of org.ambraproject.rhino.model.ingest.ArticlePackage in project rhino by PLOS.
the class IngestionService method processIngestPackage.
private ArticleIngestion processIngestPackage(IngestPackage ingestPackage) {
Doi doi = ArticleIdentifier.create(ingestPackage.getArticleMetadata().getDoi()).getDoi();
ArticlePackage articlePackage = ingestPackage.getArticlePackage();
for (ManifestXml.Asset asset : articlePackage.getManifest().getAssets()) {
Doi assetDoi = Doi.create(asset.getUri());
validateAssetUniqueness(doi, articleCrudService.getAllArticleItems(assetDoi));
}
validateManuscript(doi, articlePackage.getManifest().getArticleAsset().getUri());
return persistArticle(ingestPackage, doi, articlePackage);
}
Aggregations