/** * API to copy a translation of a document to another document of the same name in another wiki additionally * resetting the version and overwriting the previous document * * @param docname source document * @param sourceWiki source wiki * @param targetWiki target wiki * @param wikilanguage language to copy * @param reset true to reset versions * @param force true to overwrite the previous document * @return true if the copy was sucessfull * @throws XWikiException if the document was not copied properly */ public boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki, String wikilanguage, boolean reset, boolean force) throws XWikiException { DocumentReference sourceDocumentReference = this.currentMixedDocumentReferenceResolver.resolve(docname); if (!StringUtils.isEmpty(sourceWiki)) { sourceDocumentReference.setWikiReference(new WikiReference(sourceWiki)); } DocumentReference targetDocumentReference = this.currentMixedDocumentReferenceResolver.resolve(targetdocname); if (!StringUtils.isEmpty(targetWiki)) { targetDocumentReference.setWikiReference(new WikiReference(targetWiki)); } return this.copyDocument(sourceDocumentReference, targetDocumentReference, wikilanguage, reset, force); }
= NOTIFICATION_FILTER_PREFERENCE_CLASS.setWikiReference(user.getWikiReference());
reference.setWikiReference(new WikiReference(wiki));
@Override public Map<String, Boolean> getToggeableFilterActivations(DocumentReference user) throws NotificationException { XWikiContext context = contextProvider.get(); XWiki xwiki = context.getWiki(); final DocumentReference notificationPreferencesScopeClass = TOGGLEABLE_FILTER_PREFERENCE_CLASS.setWikiReference(user.getWikiReference()); Map<String, Boolean> filterStatus = new HashMap<>(); try { XWikiDocument doc = xwiki.getDocument(user, context); for (NotificationFilter filter : componentManager.<NotificationFilter>getInstanceList( NotificationFilter.class)) { if (filter instanceof ToggleableNotificationFilter) { ToggleableNotificationFilter toggleableFilter = (ToggleableNotificationFilter) filter; boolean status = toggleableFilter.isEnabledByDefault(); BaseObject obj = doc.getXObject(notificationPreferencesScopeClass, FIELD_FILTER_NAME, filter.getName()); if (obj != null) { status = obj.getIntValue(FIELD_IS_ENABLED, status ? 1 : 0) != 0; } filterStatus.put(filter.getName(), status); } } } catch (Exception e) { throw new NotificationException( String.format("Failed to get the toggleable filters preferences for the user [%s].", user), e); } return filterStatus; }
= NOTIFICATION_FILTER_PREFERENCE_CLASS.setWikiReference(wikiReference);
DocumentReference newDocReference = origDocReference.setWikiReference(new WikiReference(toWikiId));
for (String docname : list) { DocumentReference sourceDocumentReference = this.currentMixedDocumentReferenceResolver.resolve(docname); sourceDocumentReference.setWikiReference(sourceWikiReference); DocumentReference targetDocumentReference = new DocumentReference(sourceDocumentReference.clone()); targetDocumentReference.setWikiReference(targetWikiReference); copyDocument(sourceDocumentReference, targetDocumentReference, language, context); nb++;
doc.getDocumentReference().setWikiReference(new WikiReference(context.getDatabase()));