Example #1
0
  public void init() {
    if (!isInitialized) {

      if (getFileId() == null)
        throw new InvalidWikiRequestException("Missing filedId request parameter");

      log.debug("initializing document history with file id: " + getFileId());

      if (currentFile == null) {
        log.debug("loading current file: " + getFileId());
        currentFile = wikiNodeDAO.findWikiDocument(getFileId());

        if (currentFile == null) {
          throw new org.jboss.seam.framework.EntityNotFoundException(
              getFileId(), WikiDocument.class);
        }

        if (!Identity.instance().hasPermission("Node", "read", currentFile)) {
          throw new AuthorizationException("You don't have permission for this operation");
        }
      }

      initializeHistoricalFileList();
    }

    isInitialized = true;
  }
Example #2
0
 @Factory("historicalFileList")
 public void initializeHistoricalFileList() {
   if (historicalFileList == null) {
     log.debug("initializing list of historical files for file:" + getCurrentFile());
     historicalFileList = wikiNodeDAO.findHistoricalFiles(getCurrentFile());
   }
 }
Example #3
0
 private void refreshTree() {
   log.debug("Loading menu items tree");
   WikiPreferences wikiPreferences = Preferences.instance().get(WikiPreferences.class);
   tree =
       WikiNodeDAO.instance()
           .findMenuItemTree(
               (WikiDirectory) Component.getInstance("wikiRoot"),
               wikiPreferences.getMainMenuDepth(),
               wikiPreferences.getMainMenuLevels(),
               wikiPreferences.isMainMenuShowAdminOnly());
 }
Example #4
0
  private void bindBlogEntryWhereClause(
      Query query,
      WikiDirectory startDir,
      WikiDocument ignoreDoc,
      Integer year,
      Integer month,
      Integer day,
      String tag) {
    query.setParameterList("directoryIDs", wikiNodeDAO.findWikiDirectoryTreeIDs(startDir));
    query.setParameter("currentAccessLevel", currentAccessLevel);

    if (ignoreDoc != null && ignoreDoc.getId() != null) query.setParameter("ignoreDoc", ignoreDoc);
    if (tag != null && tag.length() > 0) query.setParameter("tag", tag);
    if (year != null) query.setParameter("limitYear", year);
    if (month != null) query.setParameter("limitMonth", month);
    if (day != null) query.setParameter("limitDay", day);
  }
Example #5
0
  // This methods takes the historicalFileId parameter to load a revision from the DB
  public void diff() {
    init(); // TODO: Why doesn't Seam execute my page action but instead s:link action="diff" in a
            // fake RENDER RESPONSE?!?
    displayedHistoricalFile = null;

    if (historicalFileId == null) return;
    selectedHistoricalFile =
        wikiNodeDAO.findHistoricalFile(
            getCurrentFile().getHistoricalEntityName(), historicalFileId);
    if (selectedHistoricalFile == null) {
      statusMessages.addFromResourceBundleOrDefault(
          ERROR,
          "lacewiki.msg.HistoricalNodeNotFound",
          "Couldn't find historical node: {0}",
          historicalFileId);
      return;
    }
    diffHistoricalRevision();
  }
Example #6
0
 @Restrict("#{s:hasPermission('User', 'isAdmin', currentUser)}")
 public String purgeHistory() {
   wikiNodeDAO.removeHistoricalFiles(getCurrentFile());
   return "purgedHistory";
 }