コード例 #1
0
 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));
     config.setSessionKey(CipherUtils.generateKey());
     getDao().getConfigDao().save(config);
   }
 }
コード例 #2
0
 public void readConfigs(Element configElement) throws DaoTaskException {
   ConfigEntity config = getBusiness().getConfigBusiness().getConfig();
   for (Iterator<Element> i = configElement.elementIterator(); i.hasNext(); ) {
     Element element = i.next();
     if (element.getName().equals("google-analytics")) {
       config.setGoogleAnalyticsId(element.getText());
     }
     if (element.getName().equals("email")) {
       config.setSiteEmail(element.getText());
     }
     if (element.getName().equals("domain")) {
       config.setSiteDomain(element.getText());
     }
     if (element.getName().equals("edit-ext")) {
       config.setEditExt(element.getText());
     }
     if (element.getName().equals("recaptchaPrivateKey")) {
       config.setRecaptchaPrivateKey(element.getText());
     }
     if (element.getName().equals("recaptchaPublicKey")) {
       config.setRecaptchaPublicKey(element.getText());
     }
     if (element.getName().equals("commentsEmail")) {
       config.setCommentsEmail(element.getText());
     }
     if (element.getName().equals("commentsTemplate")) {
       config.setCommentsTemplate(element.getText());
     }
     if (element.getName().equals("languages")) {
       readLanguages(element);
     }
     if (element.getName().equals("enableRecaptcha")) {
       config.setEnableRecaptcha(XmlUtil.readBooleanText(element, false));
     }
     if (element.getName().equals("siteUserLoginUrl")) {
       config.setSiteUserLoginUrl(element.getText());
     }
   }
   getDaoTaskAdapter().configSave(config);
 }