use of org.xwiki.localization.wiki.internal.TranslationDocumentModel.Scope in project xwiki-platform by xwiki.
the class DocumentTranslationBundleFactory method registerTranslationBundle.
/**
* @param document the translation document
* @throws TranslationBundleDoesNotExistsException when no translation bundle could be created from the provided
* document
* @throws ComponentRepositoryException when the actual registration of the document bundle failed
* @throws AccessDeniedException when the document author does not have enough right to register the translation
* bundle
*/
private void registerTranslationBundle(XWikiDocument document) throws TranslationBundleDoesNotExistsException, ComponentRepositoryException, AccessDeniedException {
Scope scope = getScope(document);
if (scope != null && scope != Scope.ON_DEMAND) {
checkRegistrationAuthorization(document, scope);
ComponentDescriptor<TranslationBundle> descriptor = createComponentDescriptor(document.getDocumentReference());
ComponentDocumentTranslationBundle bundle = createComponentDocumentBundle(document, descriptor);
getComponentManager(document, scope, true).registerComponent(descriptor, bundle);
}
}
use of org.xwiki.localization.wiki.internal.TranslationDocumentModel.Scope in project xwiki-platform by xwiki.
the class DocumentTranslationBundleFactory method unregisterTranslationBundle.
/**
* @param document the translation document
*/
private void unregisterTranslationBundle(XWikiDocument document) {
Scope scope = getScope(document);
// Unregister component
if (scope != null && scope != Scope.ON_DEMAND) {
ComponentDescriptor<TranslationBundle> descriptor = createComponentDescriptor(document.getDocumentReference());
getComponentManager(document, scope, true).unregisterComponent(descriptor);
}
// Remove from cache
this.onDemandBundleCache.remove(this.uidSerializer.serialize(document.getDocumentReference()));
}
Aggregations