Exemplo n.º 1
0
 @Transactional
 public void updateMailOption(EMailSender form) {
   optionsService.updateOptionValue("mail_host", form.getHost());
   optionsService.updateOptionValue("mail_port", form.getPort() + "");
   optionsService.updateOptionValue("mail_username", form.getUsername());
   optionsService.updateOptionValue("mail_password", form.getPassword());
 }
Exemplo n.º 2
0
 @Transactional
 public void updatePostOption(PostOption form) {
   optionsService.updateOptionValue(OptionConstants.MAXSHOW, form.getMaxshow() + "");
   optionsService.updateOptionValue(OptionConstants.ALLOW_COMMENT, form.isAllowComment() + "");
   optionsService.updateOptionValue(
       OptionConstants.DEFAULT_CATEGORY_ID, form.getDefaultCategory());
 }
Exemplo n.º 3
0
 /**
  * 更新网站基础设置,同时更新WebConstants中变量
  *
  * @param form
  */
 @Transactional
 public void updateGeneralOption(GeneralOption form) {
   optionsService.updateOptionValue(OptionConstants.TITLE, form.getTitle());
   optionsService.updateOptionValue(OptionConstants.SUBTITLE, form.getSubtitle());
   optionsService.updateOptionValue(OptionConstants.DESCRIPTION, form.getDescription());
   optionsService.updateOptionValue(OptionConstants.KEYWORDS, form.getKeywords());
 }
Exemplo n.º 4
0
  /**
   * 获取下一篇文章ID,使用select for update 保证id自增
   *
   * @return
   */
  @Transactional
  public String getNextPostid() {
    String currentid = optionsService.getOptionValueForUpdate(OptionConstants.POSTID);
    int id = NumberUtils.toInteger(currentid, PostConstants.INIT_POST_ID);
    id++;
    optionsService.updateOptionValue(OptionConstants.POSTID, id + "");

    return id + "";
  }
Exemplo n.º 5
0
  public PostOption getPostOption() {
    PostOption option = new PostOption();
    option.setMaxshow(
        NumberUtils.toInteger(optionsService.getOptionValue(OptionConstants.MAXSHOW), 10));
    option.setAllowComment(
        Boolean.parseBoolean(optionsService.getOptionValue(OptionConstants.ALLOW_COMMENT)));
    option.setDefaultCategory(optionsService.getOptionValue(OptionConstants.DEFAULT_CATEGORY_ID));

    return option;
  }
Exemplo n.º 6
0
  public EMailSender getMailOption() {
    EMailSender option = new EMailSender();
    option.setHost(optionsService.getOptionValue("mail_host"));
    if (!StringUtils.isBlank(option.getHost())) {
      option.setPort(Integer.parseInt(optionsService.getOptionValue("mail_port")));
      option.setUsername(optionsService.getOptionValue("mail_username"));
      option.setPassword(optionsService.getOptionValue("mail_password"));
    } else {
      option = null;
    }

    return option;
  }
Exemplo n.º 7
0
  /**
   * 从数据库中获取站点通用设置,不存在时返回null
   *
   * @return
   */
  public GeneralOption getGeneralOption() {
    GeneralOption form = new GeneralOption();
    form.setTitle(optionsService.getOptionValue(OptionConstants.TITLE));
    if (!StringUtils.isBlank(form.getTitle())) {
      form.setSubtitle(optionsService.getOptionValue(OptionConstants.SUBTITLE));
      form.setDescription(optionsService.getOptionValue(OptionConstants.DESCRIPTION));
      form.setKeywords(optionsService.getOptionValue(OptionConstants.KEYWORDS));
      form.setWeburl(optionsService.getOptionValue("weburl"));
    } else {
      form = null;
    }

    return form;
  }