Examples of ConfigEntity


Examples of org.vosao.entity.ConfigEntity

    }
    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

Examples of org.vosao.entity.ConfigEntity

    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

Examples of org.vosao.entity.ConfigEntity

    }
    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

Examples of org.vosao.entity.ConfigEntity

  @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

Examples of org.vosao.entity.ConfigEntity

        }
        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

Examples of org.vosao.entity.ConfigEntity

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

Examples of org.vosao.entity.ConfigEntity

        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

Examples of org.vosao.entity.ConfigEntity

  public TimeZone getTimeZone() {
    if (getUser() != null
        && !StringUtils.isEmpty(getUser().getTimezone())) {
      return TimeZone.getTimeZone(getUser().getTimezone());
    }
    ConfigEntity config = VosaoContext.getInstance().getConfig();
    if (!StringUtils.isEmpty(config.getDefaultTimezone())) {
      return TimeZone.getTimeZone(config.getDefaultTimezone());
    }
    return TimeZone.getDefault();
  }
View Full Code Here

Examples of org.vosao.entity.ConfigEntity

  public static final String COMMENTS_TEMPLATE_FILE =
      "org/vosao/resources/html/comments.html";
 
  private void initConfigs() {
    ConfigEntity config = getBusiness().getConfigBusiness().getConfig();
    if (config.getId() == null || config.getId() == 0) {
          config.setVersion(VERSION);
      config.setGoogleAnalyticsId("");
          config.setSiteEmail("");
          config.setSiteDomain("");
          config.setEditExt("css,js,xml");
          config.setSiteUserLoginUrl("/login");
          config.setCommentsTemplate(loadResource(
              COMMENTS_TEMPLATE_FILE));
          getDao().getConfigDao().save(config);
    }
  }
View Full Code Here

Examples of org.vosao.entity.ConfigEntity

import org.vosao.entity.ConfigEntity;

public class ConfigDaoTest extends AbstractDaoTest {

  public void testGetConfig() {
    ConfigEntity config = getDao().getConfigDao().getConfig();
    assertNull(config.getId());
    config.setEditExt("gif");
    config.setAttribute("host", "test");
    getDao().getConfigDao().save(config);
    config = getDao().getConfigDao().getConfig();
    assertEquals("gif", config.getEditExt());   
    assertEquals("test", config.getAttribute("host"));   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.