コード例 #1
0
 /**
  * @param pageVersion
  * @return
  * @throws ConcurrentEditException
  */
 public PageVersion commit(PageVersion pageVersion, boolean isMinorEdit)
     throws ConcurrentEditException, PageNotModifiedException {
   wikiClient.savePageVersion(
       pageVersion.getName(),
       pageVersion.getContent(),
       pageVersion.getComment(),
       pageVersion.getVersion(),
       isMinorEdit);
   diskCache.remove(pageVersion.getServerId(), pageVersion.getName());
   return wikiClient.getPageVersion(pageVersion.getName());
 }
コード例 #2
0
 public boolean deletePageVersion(String name, int version)
     throws PageNotFoundException, PageVersionNotFoundException, PermissionDeniedException {
   PageVersion cachedVersion = diskCache.load(server.getId(), name);
   if (cachedVersion != null && cachedVersion.getVersion() == version) {
     diskCache.remove(server.getId(), name);
   }
   return wikiClient.deletePageVersion(name, version);
 }
コード例 #3
0
 /** @return */
 public List<PageInfo> loadPages() {
   String[] pageNames = wikiClient.getPageNames();
   List<PageInfo> pages = new ArrayList<PageInfo>();
   for (int i = 0; i < pageNames.length; i++) {
     String pageName = pageNames[i];
     pages.add(loadPageVersion(pageName));
   }
   return pages;
 }
コード例 #4
0
  public String[] getPageNames() {
    String[] wikiPages = wikiClient.getPageNames();
    String[] cachedNames = diskCache.getCachedPageNames(server.getId());

    Set<String> pageNamesList = new HashSet<String>();
    pageNamesList.addAll(Arrays.asList(wikiPages));
    pageNamesList.addAll(Arrays.asList(cachedNames));
    String[] pageNames = pageNamesList.toArray(new String[pageNamesList.size()]);
    Arrays.sort(pageNames);

    return pageNames;
  }
コード例 #5
0
 /**
  * @param pageName
  * @return
  * @throws PageNotFoundException
  */
 public PageVersion loadPageVersion(String pageName) {
   // try cachewikiClient.getPageNames();
   PageVersion pageVersion = diskCache.load(server.getId(), pageName);
   if (pageVersion == null) {
     try {
       // try wiki
       pageVersion = wikiClient.getPageVersion(pageName);
     } catch (PageNotFoundException e) {
       // create new page
       pageVersion = new PageVersion();
       pageVersion.setName(pageName);
       pageVersion.setServerId(server.getId());
       pageVersion.setAuthor(server.getUsername());
     }
     pageVersion.setServerId(server.getId());
   }
   return pageVersion;
 }
コード例 #6
0
 public boolean testConnection(ServerDetails server)
     throws UnknownServerException, ConnectionRefusedException, BadCredentialsException,
         PermissionDeniedException {
   return wikiClient.testConnection(server);
 }
コード例 #7
0
 public String wikiToHtml(String wikiText) {
   return wikiClient.wikiToHtml(wikiText);
 }
コード例 #8
0
 /**
  * @param pageName
  * @param version
  * @return
  * @throws PageNotFoundException
  * @throws PageVersionNotFoundException
  */
 public PageVersion loadPageVersion(String pageName, int version)
     throws PageNotFoundException, PageVersionNotFoundException {
   return wikiClient.getPageVersion(pageName, version);
 }
コード例 #9
0
 /**
  * @param pageName
  * @return
  * @throws PageNotFoundException
  */
 public List<PageInfo> getPageHistory(String pageName) throws PageNotFoundException {
   return wikiClient.getPageHistory(pageName);
 }
コード例 #10
0
 public List<PageInfo> getRecentChanges(Date since) {
   if (since == null) {
     since = new Date(0); // XXX return all changes since epoc
   }
   return wikiClient.getRecentChanges(since);
 }
コード例 #11
0
 public boolean deletePage(String name) throws PageNotFoundException, PermissionDeniedException {
   diskCache.remove(server.getId(), name);
   return wikiClient.deletePage(name);
 }
コード例 #12
0
 public PageVersion getLatestVersion(String pageName) throws PageNotFoundException {
   return wikiClient.getPageVersion(pageName);
 }
コード例 #13
0
 /**
  * @param pageVersion
  * @return
  */
 public PageVersion forceCommit(PageVersion pageVersion) throws PageNotModifiedException {
   wikiClient.savePageVersion(
       pageVersion.getName(), pageVersion.getContent(), pageVersion.getComment());
   diskCache.remove(pageVersion.getServerId(), pageVersion.getName());
   return wikiClient.getPageVersion(pageVersion.getName());
 }
コード例 #14
0
 /**
  * @param pageVersion
  * @return
  */
 public PageVersion unedit(PageVersion pageVersion) {
   diskCache.remove(pageVersion.getServerId(), pageVersion.getName());
   return wikiClient.getPageVersion(pageVersion.getName());
 }