use of org.xwiki.localization.TranslationBundleDoesNotExistsException in project xwiki-platform by xwiki.
the class DocumentTranslationBundleFactory method createOnDemandDocumentBundle.
private OnDemandDocumentTranslationBundle createOnDemandDocumentBundle(DocumentReference documentReference, String uid) throws TranslationBundleDoesNotExistsException {
XWikiContext context = this.xcontextProvider.get();
XWikiDocument document;
try {
document = context.getWiki().getDocument(documentReference, context);
} catch (XWikiException e) {
throw new TranslationBundleDoesNotExistsException("Failed to get translation document", e);
}
if (document.isNew()) {
throw new TranslationBundleDoesNotExistsException(String.format("Document [%s] does not exists", documentReference));
}
OnDemandDocumentTranslationBundle documentBundle;
try {
documentBundle = new OnDemandDocumentTranslationBundle(ID_PREFIX, document.getDocumentReference(), this.componentManagerProvider.get(), this.translationParser, this, uid);
} catch (ComponentLookupException e) {
throw new TranslationBundleDoesNotExistsException("Failed to create document bundle", e);
}
return documentBundle;
}
Aggregations