@Test public void getAvailableRendererSyntax(MockitoComponentManager componentManager) throws Exception { PrintRendererFactory factory1 = componentManager.registerMockComponent(PrintRendererFactory.class, Syntax.PLAIN_1_0.toIdString()); PrintRendererFactory factory2 = componentManager.registerMockComponent(PrintRendererFactory.class, Syntax.ANNOTATED_XHTML_1_0.toIdString()); when(factory1.getSyntax()).thenReturn(Syntax.PLAIN_1_0); when(factory2.getSyntax()).thenReturn(Syntax.ANNOTATED_XHTML_1_0); assertEquals(Syntax.PLAIN_1_0, this.apiXWiki.getAvailableRendererSyntax("plain", "1.0")); assertEquals(Syntax.PLAIN_1_0, this.apiXWiki.getAvailableRendererSyntax("Plain", "1.0")); assertEquals(Syntax.PLAIN_1_0, this.apiXWiki.getAvailableRendererSyntax("plain", null)); assertNull(this.apiXWiki.getAvailableRendererSyntax("plai", "1.0")); assertNull(this.apiXWiki.getAvailableRendererSyntax("plai", null)); }
public Syntax getAvailableRendererSyntax(String syntaxType, String syntaxVersion) { Syntax syntax = null; try { List<PrintRendererFactory> factories = Utils.getContextComponentManager().getInstanceList((Type) PrintRendererFactory.class); for (PrintRendererFactory factory : factories) { Syntax factorySyntax = factory.getSyntax(); if (syntaxVersion != null) { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && factorySyntax.getVersion().equals(syntaxVersion)) { syntax = factorySyntax; break; } } else { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && (syntax == null || factorySyntax.getVersion().compareTo(syntax.getVersion()) > 0)) { syntax = factorySyntax; } } } } catch (ComponentLookupException e) { LOGGER.error("Failed to lookup available renderer syntaxes", e); } return syntax; }
XWiki extends Api { public Syntax getAvailableRendererSyntax(String syntaxType, String syntaxVersion) { Syntax syntax = null; try { List<PrintRendererFactory> factories = Utils.getContextComponentManager().getInstanceList((Type) PrintRendererFactory.class); for (PrintRendererFactory factory : factories) { Syntax factorySyntax = factory.getSyntax(); if (syntaxVersion != null) { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && factorySyntax.getVersion().equals(syntaxVersion)) { syntax = factorySyntax; break; } } else { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && (syntax == null || factorySyntax.getVersion().compareTo(syntax.getVersion()) > 0)) { syntax = factorySyntax; } } } } catch (ComponentLookupException e) { LOGGER.error("Failed to lookup available renderer syntaxes", e); } return syntax; } }
XWiki extends Api { public Syntax getAvailableRendererSyntax(String syntaxType, String syntaxVersion) { Syntax syntax = null; try { List<PrintRendererFactory> factories = Utils.getContextComponentManager().getInstanceList((Type) PrintRendererFactory.class); for (PrintRendererFactory factory : factories) { Syntax factorySyntax = factory.getSyntax(); if (syntaxVersion != null) { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && factorySyntax.getVersion().equals(syntaxVersion)) { syntax = factorySyntax; break; } } else { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && (syntax == null || factorySyntax.getVersion().compareTo(syntax.getVersion()) > 0)) { syntax = factorySyntax; } } } } catch (ComponentLookupException e) { LOGGER.error("Failed to lookup available renderer syntaxes", e); } return syntax; } XWiki(com.xpn.xwiki.XWiki xwiki, XWikiContext context); }
XWiki extends Api { public Syntax getAvailableRendererSyntax(String syntaxType, String syntaxVersion) { Syntax syntax = null; try { List<PrintRendererFactory> factories = Utils.getContextComponentManager().getInstanceList((Type) PrintRendererFactory.class); for (PrintRendererFactory factory : factories) { Syntax factorySyntax = factory.getSyntax(); if (syntaxVersion != null) { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && factorySyntax.getVersion().equals(syntaxVersion)) { syntax = factorySyntax; break; } } else { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && (syntax == null || factorySyntax.getVersion().compareTo(syntax.getVersion()) > 0)) { syntax = factorySyntax; } } } } catch (ComponentLookupException e) { LOGGER.error("Failed to lookup available renderer syntaxes", e); } return syntax; } XWiki(com.xpn.xwiki.XWiki xwiki, XWikiContext context); @Programming com.xpn.xwiki.XWiki getXWiki(); XWikiInitializerJobStatus getJobStatus(); JobStatus getCurrentInitializerJobStatus(); String getVersion(); String getRequestURL(); String getRelativeRequestURL(); Document getDocument(String documentReference); Document getEntityDocument(String reference, EntityType type); Document getDocument(DocumentReference reference); Document getDocument(EntityReference reference); Document getDocumentAsAuthor(String fullName); Document getDocumentAsAuthor(DocumentReference reference); List<DeletedDocument> getDeletedDocuments(String fullname, String locale); List<DeletedDocument> getDeletedDocuments(String batchId); @Deprecated DeletedDocument getDeletedDocument(String fullname, String locale, String index); DeletedDocument getDeletedDocument(String index); List<DeletedAttachment> getDeletedAttachments(String docName); List<DeletedAttachment> getDeletedAttachments(String docName, String filename); DeletedAttachment getDeletedAttachment(String id); boolean exists(String fullname); boolean exists(DocumentReference reference); boolean checkAccess(String docname, String right); Document getDocument(String space, String fullname); Document getDocument(Document doc, String rev); Document getDocument(DocumentReference reference, String revision); String getTextArea(String content); List<String> getClassList(); MetaClass getMetaclass(); @Deprecated List<String> searchDocuments(String wheresql); @Deprecated List<String> searchDocuments(String wheresql, int nb, int start); @Deprecated List<String> searchDocuments(String wheresql, int nb, int start, String selectColumns); List<Document> searchDocuments(String wheresql, boolean distinctbylocale); List<Document> searchDocuments(String wheresql, boolean distinctbylocale, int nb, int start); @Deprecated List<String> searchDocuments(String parameterizedWhereClause, int maxResults, int startOffset,
        List<?> parameterValues); @Deprecated List<String> searchDocuments(String parameterizedWhereClause, List<?> parameterValues); @Deprecated List<String> searchDocumentsNames(String wikiName, String parameterizedWhereClause, int maxResults,
        int startOffset, List<?> parameterValues); List<String> searchSpacesNames(String parametrizedSqlClause, int nb, int start, List<?> parameterValues); List<Attachment> searchAttachments(String parametrizedSqlClause, int nb, int start, List<?> parameterValues); int countAttachments(String parametrizedSqlClause, List<?> parameterValues); List<Document> wrapDocs(List<?> docs); @Deprecated String parseContent(String content); String parseTemplate(String template); String renderTemplate(String template); String invokeServletAndReturnAsString(String url); String getSkinFile(String filename); String getSkinFile(String filename, boolean forceSkinAction); String getSkin(); String getBaseSkin(); String getSpaceCopyright(); String getXWikiPreference(String preference); String getXWikiPreference(String preference, String defaultValue); String getSpacePreference(String preference); String getSpacePreference(String preference, String defaultValue); String getSkinPreference(String preference); String getSkinPreference(String preference, String defaultValue); String getSpacePreferenceFor(String preference, String space); String getSpacePreferenceFor(String preference, String space, String defaultValue); String getSpacePreferenceFor(String preference, SpaceReference spaceReference); String getSpacePreferenceFor(String preference, SpaceReference spaceReference, String defaultValue); long getXWikiPreferenceAsLong(String preference, long defaultValue); long getXWikiPreferenceAsLong(String preference); long getSpacePreferenceAsLong(String preference, long defaultValue); long getSpacePreferenceAsLong(String preference); int getXWikiPreferenceAsInt(String preference, int defaultValue); int getXWikiPreferenceAsInt(String preference); int getSpacePreferenceAsInt(String preference, int defaultValue); int getSpacePreferenceAsInt(String preference); String getUserPreference(String preference); String getUserPreferenceFromCookie(String preference); @Deprecated String getLanguagePreference(); Locale getLocalePreference(); @Deprecated String getInterfaceLanguagePreference(); Locale getInterfaceLocalePreference(); @Unstable List<Locale> getAvailableLocales(); List<String> getWikiNames(); boolean hasSubWikis(); boolean isMultiLingual(); void flushCache(); int createUser(); int createUser(boolean withValidation); int createUser(boolean withValidation, String userRights); int validateUser(boolean withConfirmEmail); void addToAllGroup(String fullwikiname); void sendConfirmationMail(String xwikiname, String password, String email, String add_message,
        String contentfield); void sendConfirmationMail(String xwikiname, String password, String email, String contentfield); @Unstable boolean renameDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference,
        boolean overwrite, List<DocumentReference> backlinkDocumentReferences,
        List<DocumentReference> childDocumentReferences); boolean copyDocument(String docname, String targetdocname); boolean copyDocument(String docname, String targetdocname, String wikilocale); boolean copyDocument(String docname, String sourceWiki, String targetWiki, String wikilocale); boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki,
        String wikilocale, boolean reset); boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki,
        String wikilocale, boolean reset, boolean force); boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference,
        String wikilocale, boolean resetHistory, boolean overwrite); int copySpaceBetweenWikis(String space, String sourceWiki, String targetWiki, String locale, boolean clean); String includeTopic(String topic); String includeForm(String topic); String includeTopic(String topic, boolean pre); String includeForm(String topic, boolean pre); boolean hasAccessLevel(String level); boolean hasAccessLevel(String level, String user, String docname); @Deprecated List<String> getSpaces(); @Deprecated List<String> getSpaceDocsName(String spaceReference); String getEncoding(); String getAttachmentURL(String fullname, String filename); String getURL(String fullname); String getURL(EntityReference reference); String getURL(EntityReference reference, String action, String querystring); String getURL(DocumentReference reference); String getURL(String fullname, String action); String getURL(String fullname, String action, String querystring); String getURL(DocumentReference reference, String action, String querystring); String getURL(String fullname, String action, String querystring, String anchor); String getRefererText(String referer); String getShortRefererText(String referer, int length); String getPlainUserName(DocumentReference userReference); String getUserName(String user); String getUserName(String user, String format); String getLocalUserName(String user); String getLocalUserName(String user, String format); String getUserName(String user, boolean link); String getUserName(String user, String format, boolean link); String getLocalUserName(String user, boolean link); String getLocalUserName(String user, String format, boolean link); User getUser(); User getUser(String username); @Unstable User getUser(DocumentReference userReference); String formatDate(Date date); String formatDate(Date date, String format); String getUserTimeZone(); Api get(String name); Api getPlugin(String name); String getAdType(); String getAdClientId(); @Programming String getURLContent(String surl, String username, String password); @Programming String getURLContent(String surl); @Programming String getURLContent(String surl, String username, String password, int timeout); @Programming String getURLContent(String surl, int timeout); @Programming byte[] getURLContentAsBytes(String surl, String username, String password); @Programming byte[] getURLContentAsBytes(String surl); List<String> getIncludedMacros(String defaultSpace, String content); boolean isReadOnly(); void setReadOnly(boolean ro); void refreshLinks(); boolean hasBacklinks(); boolean hasTags(); boolean hasEditComment(); boolean isEditCommentFieldHidden(); boolean isEditCommentSuggested(); boolean isEditCommentMandatory(); boolean hasMinorEdit(); boolean hasRecycleBin(); String getEditorPreference(); java.lang.Object parseGroovyFromString(String script); java.lang.Object parseGroovyFromPage(String script, String jarWikiPage); java.lang.Object parseGroovyFromPage(String fullname); String getMacroList(); String getWysiwygToolbars(); com.xpn.xwiki.api.Object getObjectFromRequest(String className); Document createDocument(); String convertUsername(String username); com.xpn.xwiki.api.PropertyClass getPropertyClassFromName(String propPath); String getUniquePageName(String name); String getUniquePageName(String space, String name); String addTooltip(String html, String message, String params); String addTooltip(String html, String message); String addTooltipJS(); String addMandatory(); Class getClass(String documentName); Class getClass(EntityReference docReference); String getCounter(String name); XWikiUser checkAuth(); XWikiUser checkAuth(String username, String password, String rememberme); StatsService getStatsService(); CriteriaService getCriteriaService(); @Deprecated List<String> getConfiguredSyntaxes(); String getServletPath(String wikiName); String getServletPath(); String getWebAppPath(); String getDefaultDocumentSyntax(); Syntax getAvailableRendererSyntax(String syntaxType, String syntaxVersion); boolean hasSectionEdit(); long getSectionEditingDepth(); boolean isTitleInCompatibilityMode(); String getCurrentContentSyntaxId(); }
XWiki extends Api { public Syntax getAvailableRendererSyntax(String syntaxType, String syntaxVersion) { Syntax syntax = null; try { List<PrintRendererFactory> factories = Utils.getContextComponentManager().getInstanceList((Type) PrintRendererFactory.class); for (PrintRendererFactory factory : factories) { Syntax factorySyntax = factory.getSyntax(); if (syntaxVersion != null) { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && factorySyntax.getVersion().equals(syntaxVersion)) { syntax = factorySyntax; break; } } else { if (factorySyntax.getType().getId().equalsIgnoreCase(syntaxType) && (syntax == null || factorySyntax.getVersion().compareTo(syntax.getVersion()) > 0)) { syntax = factorySyntax; } } } } catch (ComponentLookupException e) { LOGGER.error("Failed to lookup available renderer syntaxes", e); } return syntax; } XWiki(com.xpn.xwiki.XWiki xwiki, XWikiContext context); @Programming com.xpn.xwiki.XWiki getXWiki(); XWikiInitializerJobStatus getJobStatus(); JobStatus getCurrentInitializerJobStatus(); String getVersion(); String getRequestURL(); String getRelativeRequestURL(); Document getDocument(String documentReference); Document getEntityDocument(String reference, EntityType type); Document getDocument(DocumentReference reference); Document getDocument(EntityReference reference); Document getDocumentAsAuthor(String fullName); Document getDocumentAsAuthor(DocumentReference reference); List<DeletedDocument> getDeletedDocuments(String fullname, String locale); List<DeletedDocument> getDeletedDocuments(String batchId); @Deprecated DeletedDocument getDeletedDocument(String fullname, String locale, String index); DeletedDocument getDeletedDocument(String index); List<DeletedAttachment> getDeletedAttachments(String docName); List<DeletedAttachment> getDeletedAttachments(String docName, String filename); DeletedAttachment getDeletedAttachment(String id); boolean exists(String fullname); boolean exists(DocumentReference reference); boolean checkAccess(String docname, String right); Document getDocument(String space, String fullname); Document getDocument(Document doc, String rev); Document getDocument(DocumentReference reference, String revision); String getTextArea(String content); List<String> getClassList(); MetaClass getMetaclass(); @Deprecated List<String> searchDocuments(String wheresql); @Deprecated List<String> searchDocuments(String wheresql, int nb, int start); @Deprecated List<String> searchDocuments(String wheresql, int nb, int start, String selectColumns); List<Document> searchDocuments(String wheresql, boolean distinctbylocale); List<Document> searchDocuments(String wheresql, boolean distinctbylocale, int nb, int start); @Deprecated List<String> searchDocuments(String parameterizedWhereClause, int maxResults, int startOffset,
        List<?> parameterValues); @Deprecated List<String> searchDocuments(String parameterizedWhereClause, List<?> parameterValues); @Deprecated List<String> searchDocumentsNames(String wikiName, String parameterizedWhereClause, int maxResults,
        int startOffset, List<?> parameterValues); List<String> searchSpacesNames(String parametrizedSqlClause, int nb, int start, List<?> parameterValues); List<Attachment> searchAttachments(String parametrizedSqlClause, int nb, int start, List<?> parameterValues); int countAttachments(String parametrizedSqlClause, List<?> parameterValues); List<Document> wrapDocs(List<?> docs); @Deprecated String parseContent(String content); String parseTemplate(String template); String renderTemplate(String template); String invokeServletAndReturnAsString(String url); String getSkinFile(String filename); String getSkinFile(String filename, boolean forceSkinAction); String getSkin(); String getBaseSkin(); String getSpaceCopyright(); String getXWikiPreference(String preference); String getXWikiPreference(String preference, String defaultValue); String getSpacePreference(String preference); String getSpacePreference(String preference, String defaultValue); String getSkinPreference(String preference); String getSkinPreference(String preference, String defaultValue); String getSpacePreferenceFor(String preference, String space); String getSpacePreferenceFor(String preference, String space, String defaultValue); String getSpacePreferenceFor(String preference, SpaceReference spaceReference); String getSpacePreferenceFor(String preference, SpaceReference spaceReference, String defaultValue); long getXWikiPreferenceAsLong(String preference, long defaultValue); long getXWikiPreferenceAsLong(String preference); long getSpacePreferenceAsLong(String preference, long defaultValue); long getSpacePreferenceAsLong(String preference); int getXWikiPreferenceAsInt(String preference, int defaultValue); int getXWikiPreferenceAsInt(String preference); int getSpacePreferenceAsInt(String preference, int defaultValue); int getSpacePreferenceAsInt(String preference); String getUserPreference(String preference); String getUserPreferenceFromCookie(String preference); @Deprecated String getLanguagePreference(); Locale getLocalePreference(); @Deprecated String getInterfaceLanguagePreference(); Locale getInterfaceLocalePreference(); @Unstable List<Locale> getAvailableLocales(); List<String> getWikiNames(); boolean hasSubWikis(); boolean isMultiLingual(); void flushCache(); int createUser(); int createUser(boolean withValidation); int createUser(boolean withValidation, String userRights); int validateUser(boolean withConfirmEmail); void addToAllGroup(String fullwikiname); void sendConfirmationMail(String xwikiname, String password, String email, String add_message,
        String contentfield); void sendConfirmationMail(String xwikiname, String password, String email, String contentfield); @Unstable boolean renameDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference,
        boolean overwrite, List<DocumentReference> backlinkDocumentReferences,
        List<DocumentReference> childDocumentReferences); boolean copyDocument(String docname, String targetdocname); boolean copyDocument(String docname, String targetdocname, String wikilocale); boolean copyDocument(String docname, String sourceWiki, String targetWiki, String wikilocale); boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki,
        String wikilocale, boolean reset); boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki,
        String wikilocale, boolean reset, boolean force); boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference,
        String wikilocale, boolean resetHistory, boolean overwrite); int copySpaceBetweenWikis(String space, String sourceWiki, String targetWiki, String locale, boolean clean); String includeTopic(String topic); String includeForm(String topic); String includeTopic(String topic, boolean pre); String includeForm(String topic, boolean pre); boolean hasAccessLevel(String level); boolean hasAccessLevel(String level, String user, String docname); @Deprecated List<String> getSpaces(); @Deprecated List<String> getSpaceDocsName(String spaceReference); String getEncoding(); String getAttachmentURL(String fullname, String filename); String getURL(String fullname); String getURL(EntityReference reference); String getURL(EntityReference reference, String action, String querystring); String getURL(DocumentReference reference); String getURL(String fullname, String action); String getURL(String fullname, String action, String querystring); String getURL(DocumentReference reference, String action, String querystring); String getURL(String fullname, String action, String querystring, String anchor); String getRefererText(String referer); String getShortRefererText(String referer, int length); String getPlainUserName(DocumentReference userReference); String getUserName(String user); String getUserName(String user, String format); String getLocalUserName(String user); String getLocalUserName(String user, String format); String getUserName(String user, boolean link); String getUserName(String user, String format, boolean link); String getLocalUserName(String user, boolean link); String getLocalUserName(String user, String format, boolean link); User getUser(); User getUser(String username); @Unstable User getUser(DocumentReference userReference); String formatDate(Date date); String formatDate(Date date, String format); String getUserTimeZone(); Api get(String name); Api getPlugin(String name); String getAdType(); String getAdClientId(); @Programming String getURLContent(String surl, String username, String password); @Programming String getURLContent(String surl); @Programming String getURLContent(String surl, String username, String password, int timeout); @Programming String getURLContent(String surl, int timeout); @Programming byte[] getURLContentAsBytes(String surl, String username, String password); @Programming byte[] getURLContentAsBytes(String surl); List<String> getIncludedMacros(String defaultSpace, String content); boolean isReadOnly(); void setReadOnly(boolean ro); void refreshLinks(); boolean hasBacklinks(); boolean hasTags(); boolean hasEditComment(); boolean isEditCommentFieldHidden(); boolean isEditCommentSuggested(); boolean isEditCommentMandatory(); boolean hasMinorEdit(); boolean hasRecycleBin(); String getEditorPreference(); java.lang.Object parseGroovyFromString(String script); java.lang.Object parseGroovyFromPage(String script, String jarWikiPage); java.lang.Object parseGroovyFromPage(String fullname); String getMacroList(); String getWysiwygToolbars(); com.xpn.xwiki.api.Object getObjectFromRequest(String className); Document createDocument(); String convertUsername(String username); com.xpn.xwiki.api.PropertyClass getPropertyClassFromName(String propPath); String getUniquePageName(String name); String getUniquePageName(String space, String name); String addTooltip(String html, String message, String params); String addTooltip(String html, String message); String addTooltipJS(); String addMandatory(); Class getClass(String documentName); Class getClass(EntityReference docReference); String getCounter(String name); XWikiUser checkAuth(); XWikiUser checkAuth(String username, String password, String rememberme); StatsService getStatsService(); CriteriaService getCriteriaService(); @Deprecated List<String> getConfiguredSyntaxes(); String getServletPath(String wikiName); String getServletPath(); String getWebAppPath(); String getDefaultDocumentSyntax(); Syntax getAvailableRendererSyntax(String syntaxType, String syntaxVersion); boolean hasSectionEdit(); long getSectionEditingDepth(); boolean isTitleInCompatibilityMode(); String getCurrentContentSyntaxId();  }