Package org.vosao.entity

Examples of org.vosao.entity.ConfigEntity


 
  @Override
  public CommentEntity addComment(String name, String content,
      PageEntity page) {

    ConfigEntity config = VosaoContext.getInstance().getConfig();
    CommentEntity comment = new CommentEntity(name, content,
        new Date(), page.getFriendlyURL());
    getDao().getCommentDao().save(comment);
    getBusiness().getSystemService().getPageCache().remove(
        page.getFriendlyURL());
    List<String> toAddresses = StrUtil.fromCSV(config.getCommentsEmail());
    if (toAddresses.size() == 0) {
      toAddresses.add(config.getSiteEmail());
    }
    for (String email : toAddresses) {
      EmailUtil.sendEmail(createCommentLetter(comment, page),
        COMMENT_LETTER_SUBJECT,
        config.getSiteEmail(),
        config.getSiteDomain() + " admin",
        StringUtils.strip(email));
      logger.debug("New comment letter was sent to " + email);
    }
    return comment;
  }
View Full Code Here


    }
    return comment;
  }
 
  private String createCommentLetter(CommentEntity comment, PageEntity page) {
    ConfigEntity config = VosaoContext.getInstance().getConfig();
    StringBuffer b = new StringBuffer();
    b.append("<p>New comment was added to page ")
        .append(config.getSiteDomain()).append(page.getFriendlyURL())
        .append(" by ").append(comment.getName()).append("</p>")
        .append(comment.getContent());
    return b.toString();
  }
View Full Code Here

    // set default value to all children
    if (attr.isInherited()
        && StringUtils.isNotEmpty(attr.getDefaultValue())) {
     
      PageEntity page = getDao().getPageDao().getByUrl(attr.getPageUrl());
      ConfigEntity config = VosaoContext.getInstance().getConfig();

      getBusiness().getPageAttributeBusiness().setAttribute(page,
          attr.getName(), config.getDefaultLanguage(),
          attr.getDefaultValue(), true);
    }
    return ServiceResponse.createSuccessResponse(Messages.get("success"));
  }
View Full Code Here

    }
    catch (IOException e) {
      logger.error(e.getMessage());
      return;
    }
    ConfigEntity config = VosaoContext.getInstance().getConfig();
    VelocityContext context = new VelocityContext();
    context.put("user", user);
    context.put("config", config);
    context.put("key", key);
    String letter = getSystemService().render(template, context);
    String error = EmailUtil.sendEmail(letter, "Forgot password",
        config.getSiteEmail(), "Site admin", email);
    if (error != null) {
      logger.error(error);
    }
  }
View Full Code Here

    List<ConfigEntity> list = select();
    if (list.size() > 0) {
      return list.get(0);
    }
    logger.error("Config for site was not found!");
    return new ConfigEntity();
  }
View Full Code Here

    }
    FormEntity form = getDao().getFormDao().getByName(formName);
    if (form == null) {
      throw new UploadException(Messages.get("form.not_found", formName));
    }
    ConfigEntity config = VosaoContext.getInstance().getConfig();
    String challenge = parameters.get("recaptcha_challenge_field");
    String response = parameters.get("recaptcha_response_field");
    if (form.isEnableCaptcha() && config.isEnableRecaptcha()) {
      ReCaptchaResponse recaptchaResponse = RecaptchaUtil.check(
          config.getRecaptchaPublicKey(),
          config.getRecaptchaPrivateKey(),
          challenge, response, request);
      if (!recaptchaResponse.isValid()) {
        return createMessage("error", Messages.get("incorrect_captcha"));
      }
    }
View Full Code Here

  @Override
  public PicasawebService getPicasawebService() {
    if (picasawebService == null) {
      picasawebService = new PicasawebService("vosao-cms");
      ConfigEntity config = VosaoContext.getInstance().getConfig();
      if (config.isEnablePicasa()) {
        try {
          picasawebService.setUserCredentials(config.getPicasaUser(),
            config.getPicasaPassword());
        }
        catch (AuthenticationException e) {
          logger.error("Picasa auth problem. " + e.getMessage());
        }
      }
View Full Code Here

        }
        if (url.equals("/")) {
          showNoApprovedContent(httpResponse);
          return;
        }
        ConfigEntity config = ctx.getConfig();
        if (!StringUtils.isEmpty(config.getSite404Url())) {
            page = getPage(config.getSite404Url(), httpRequest);
            if (page != null) {
              renderPage(httpRequest, httpResponse, page, url);
            }
        }
        httpResponse.setStatus(HttpServletResponse.SC_NOT_FOUND);
      }
      catch (AccessDeniedException e) {
      HttpSession session = httpRequest.getSession(true);
            String userEmail = (String)session.getAttribute(
                AuthenticationFilter.USER_SESSION_ATTR);
            UserEntity user = getDao().getUserDao().getByEmail(userEmail);
        ConfigEntity config = ctx.getConfig();
        if (user != null) {
          renderMessage(httpResponse, Messages.get("access_denied_page"));
          return;
        }
        if (StringUtils.isEmpty(config.getSiteUserLoginUrl())) {
          renderMessage(httpResponse, Messages.get("login_not_configured"));
          return;
        }
         session.setAttribute(AuthenticationFilter.ORIGINAL_VIEW_KEY,
             httpRequest.getRequestURI());
         httpResponse.sendRedirect(httpRequest.getContextPath()
             + config.getSiteUserLoginUrl());
      }
    }
View Full Code Here

  public ConfigEntity getConfig() {
    if (config == null) {
      config = getBusiness().getDao().getConfigDao().getConfig();
      if (config == null) {
        config = new ConfigEntity();
      }
    }
    return config;
  }
View Full Code Here

        messages.put(key, bundle.getString(key));
      }
      catch (MissingResourceException e) {
      }
    }
    ConfigEntity config = VosaoContext.getInstance().getConfig();
    StringBuffer result = new StringBuffer();
    result.append("var locale = '").append(ctx.getLocale().toString())
        .append("';\n");
    result.append("var locale_language = '")
      .append(ctx.getLocale().getLanguage()).append("';\n");
View Full Code Here

TOP

Related Classes of org.vosao.entity.ConfigEntity

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.