Package org.jamwiki.model

Examples of org.jamwiki.model.VirtualWiki


    ofy.put(page);
    return page;
  }

  public static VirtualWiki update(VirtualWiki role) {
    VirtualWiki existingEntity = null;
    try {
      Objectify ofy = OS.begin();
      existingEntity = ofy.get(VirtualWiki.class, role.getVirtualWikiId());
      existingEntity.setName(role.getName());
      existingEntity.setDefaultTopicName(role.getDefaultTopicName());
      ofy.put(existingEntity);
      cache.put(existingEntity.getName(), existingEntity);
    } catch (EntityNotFoundException enf) {
    }
    return existingEntity;
  }
View Full Code Here


    Objectify ofy = OS.begin();
    ofy.delete(role);
  }

  public static VirtualWiki findByName(String name) {
    VirtualWiki role = (VirtualWiki) cache.get(name);
    if (role != null) {
      return role;
    }
    try {
      Objectify ofy = OS.begin();
View Full Code Here

    if (virtualWikiName == null) {
      logger.severe("No virtual wiki available for page request "
          + request.getRequestURI());
      virtualWikiName = WikiBase.DEFAULT_VWIKI;
    }
    VirtualWiki virtualWiki = ServletUtil.retrieveVirtualWiki(virtualWikiName);
    // build the layout contents
    String leftMenu = ServletUtil.cachedContent(request.getContextPath(),
        request.getLocale(), virtualWikiName, WikiBase.SPECIAL_PAGE_LEFT_MENU,
        true);
    next.addObject("leftMenu", leftMenu);
    next.addObject("defaultTopic", virtualWiki.getDefaultTopicName());
    next.addObject("virtualWiki", virtualWiki.getName());
    next.addObject("logo", Environment
        .getValue(Environment.PROP_BASE_LOGO_IMAGE));
    String bottomArea = ServletUtil.cachedContent(request.getContextPath(),
        request.getLocale(), virtualWiki.getName(),
        WikiBase.SPECIAL_PAGE_BOTTOM_AREA, true);
    next.addObject("bottomArea", bottomArea);
    next.addObject(WikiUtil.PARAMETER_VIRTUAL_WIKI, virtualWiki.getName());
    // int cssRevision = 0;
    // try {
    // cssRevision =
    // WikiBase.getDataHandler().lookupTopic(virtualWiki.getName(),
    // WikiBase.SPECIAL_PAGE_STYLESHEET, false, null).getCurrentVersionId();
View Full Code Here

    if (StringUtils.isBlank(virtualWikiName)) {
      virtualWikiName = WikiBase.DEFAULT_VWIKI;
    }
    String target = Environment.getValue(Environment.PROP_BASE_DEFAULT_TOPIC);
    try {
      VirtualWiki virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
      target = virtualWiki.getDefaultTopicName();
    } catch (DataAccessException e) {
      logger.warning("Unable to retrieve default topic for virtual wiki", e);
    }
    return "/" + virtualWikiName + "/" + target;
  }
View Full Code Here

    if (virtualWikiName == null) {
      logger.severe("No virtual wiki available for page request "
          + request.getRequestURI());
      virtualWikiName = WikiBase.DEFAULT_VWIKI;
    }
    VirtualWiki virtualWiki = ServletUtil.retrieveVirtualWiki(virtualWikiName);
    // build the layout contents
    String leftMenu = ServletUtil.cachedContent(request.getContextPath(),
        request.getLocale(), virtualWikiName, WikiBase.SPECIAL_PAGE_LEFT_MENU,
        true);
    next.addObject("leftMenu", leftMenu);
    next.addObject("defaultTopic", virtualWiki.getDefaultTopicName());
    next.addObject("virtualWiki", virtualWiki.getName());
    next.addObject("logo", Environment
        .getValue(Environment.PROP_BASE_LOGO_IMAGE));
    String bottomArea = ServletUtil.cachedContent(request.getContextPath(),
        request.getLocale(), virtualWiki.getName(),
        WikiBase.SPECIAL_PAGE_BOTTOM_AREA, true);
    next.addObject("bottomArea", bottomArea);
    next.addObject(WikiUtil.PARAMETER_VIRTUAL_WIKI, virtualWiki.getName());
    // int cssRevision = 0;
    // try {
    // cssRevision =
    // WikiBase.getDataHandler().lookupTopic(virtualWiki.getName(),
    // WikiBase.SPECIAL_PAGE_STYLESHEET, false, null).getCurrentVersionId();
View Full Code Here

      }
      if (isUpdate) {
        next.addObject("updateMessage", new WikiMessage("register.caption.updatesuccess"));
        this.view(request, next, pageInfo);
      } else {
        VirtualWiki virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
        String topic = virtualWiki.getDefaultTopicName();
        ServletUtil.redirect(next, virtualWikiName, topic);
      }
    }
  }
View Full Code Here

  }
  private void view(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String topicName = WikiUtil.getTopicFromURI(request);
    if (StringUtils.isBlank(topicName)) {
      String virtualWikiName = pageInfo.getVirtualWikiName();
      VirtualWiki virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
      topicName = virtualWiki.getDefaultTopicName();
    }
    String virtualWiki = pageInfo.getVirtualWikiName();
    if (StringUtils.isBlank(virtualWiki)) {
      virtualWiki = WikiBase.DEFAULT_VWIKI;
    }
View Full Code Here

   */
  private void virtualWiki(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    WikiUser user = ServletUtil.currentWikiUser();
    try {
      VirtualWiki virtualWiki = new VirtualWiki();
      if (!StringUtils.isBlank(request.getParameter("virtualWikiId"))) {
        virtualWiki.setVirtualWikiId(Long.valueOf(request
            .getParameter("virtualWikiId")));
      }
      virtualWiki.setName(request.getParameter("name"));
      String defaultTopicName = WikiUtil.getParameterFromRequest(request,
          "defaultTopicName", true);
      virtualWiki.setDefaultTopicName(defaultTopicName);
      WikiBase.getDataHandler().writeVirtualWiki(virtualWiki);
      if (StringUtils.isBlank(request.getParameter("virtualWikiId"))) {
        WikiBase.getDataHandler().setupSpecialPages(request.getLocale(), user,
            virtualWiki);
      }
View Full Code Here

   * @return A <code>VirtualWiki</code> object. If there is no virtual wiki
   *         available with the given name then the default virtual wiki is
   *         returned.
   */
  public static VirtualWiki retrieveVirtualWiki(String virtualWikiName) {
    VirtualWiki virtualWiki = null;
    if (virtualWikiName == null) {
      virtualWikiName = WikiBase.DEFAULT_VWIKI;
    }
    // FIXME - the check here for initialized properties is due to this
    // change being made late in a release cycle. Revisit in a future
    // release & clean this up.
    if (Environment.getBooleanValue(Environment.PROP_BASE_INITIALIZED)) {
      try {
        virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
      } catch (DataAccessException e) {
      }
    }
    if (virtualWiki == null) {
      logger.severe("No virtual wiki found for " + virtualWikiName);
      virtualWiki = new VirtualWiki(WikiBase.DEFAULT_VWIKI, Environment.getValue(Environment.PROP_BASE_DEFAULT_TOPIC));
    }
    return virtualWiki;
  }
View Full Code Here

    pageInfo.reset();
    String virtualWikiName = pageInfo.getVirtualWikiName();
    String target = request.getParameter(JAMWikiAuthenticationConstants.SPRING_SECURITY_LOGIN_TARGET_URL_FIELD_NAME);
    if (StringUtils.isBlank(target)) {
      if (StringUtils.isBlank(topic)) {
        VirtualWiki virtualWiki = null;
        try {
          virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
        } catch (DataAccessException e) {
          throw new WikiException(new WikiMessage("error.unknown", e.getMessage()), e);
        }
        topic = virtualWiki.getDefaultTopicName();
      }
      target = "/" + virtualWikiName + "/" + topic;
      if (!StringUtils.isBlank(request.getQueryString())) {
        target += "?" + request.getQueryString();
      }
View Full Code Here

TOP

Related Classes of org.jamwiki.model.VirtualWiki

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.