Package org.apache.openmeetings.persistence.beans.basic

Examples of org.apache.openmeetings.persistence.beans.basic.Configuration


   * @return
   */
  public <T> T getConfValue(String confKey, Class<T> typeObject,
      String defaultValue) {
    try {
      Configuration conf_reminder = get(confKey);

      if (conf_reminder == null) {
        log.warn("Could not find key in configuration CONF_KEY: " + confKey);
        if (defaultValue == null) {
          return null;
        }
      } else {
        // Use the custom value as default value
        defaultValue = conf_reminder.getConf_value();
      }

      // Either this can be directly assigned or try to find a constructor
      // that handles it
      if (typeObject.isAssignableFrom(defaultValue.getClass())) {
View Full Code Here


  }

  public String addConfByKey(String confKey, String confValue, Long userId,
      String comment) {
    String ret = "Add Configuration";
    Configuration configuration = new Configuration();
    configuration.setConf_key(confKey);
    configuration.setConf_value(confValue);
    configuration.setStarttime(new Date());
    configuration.setDeleted(false);
    configuration.setComment(comment);
    if (userId != null)
      configuration.setUser(usersDao.get(userId));
    try {
      configuration = em.merge(configuration);
      ret = "Erfolgreich";
    } catch (Exception ex2) {
      log.error("[addConfByKey]: ", ex2);
View Full Code Here

  }

  public Long saveOrUpdateConfiguration(LinkedHashMap<String, ?> values,
      Long userId) {
    try {
      Configuration conf = (Configuration) CastMapToObject.getInstance()
          .castByGivenObject(values, Configuration.class);
      if (conf.getConfiguration_id().equals(null)
          || conf.getConfiguration_id() == 0
          || conf.getConfiguration_id() == 0L) {
        conf.setConfiguration_id(null);
        conf.setStarttime(new Date());
        conf.setDeleted(false);
        return this.addConfig(conf);
      } else {
        Configuration conf2 = this.get(conf.getConfiguration_id());
        conf2.setComment(conf.getComment());
        conf2.setConf_key(conf.getConf_key());
        conf2.setConf_value(conf.getConf_value());
        conf2.setUser(usersDao.get(userId));
        conf2.setDeleted(false);
        conf2.setUpdatetime(new Date());
        return this.updateConfig(conf2);
      }
    } catch (Exception ex2) {
      log.error("[updateConfByUID]: ", ex2);
    }
View Full Code Here

      , new SearchableDataProvider<Configuration>(ConfigurationDao.class)) {
      private static final long serialVersionUID = 8715559628755439596L;

      @Override
      protected void populateItem(final Item<Configuration> item) {
        final Configuration configuration = item.getModelObject();
        item.add(new Label("configuration_id", "" + configuration.getConfiguration_id()));
        item.add(new Label("conf_key", "" + configuration.getConf_key()));
        item.add(new Label("conf_value", "" + configuration.getConf_value()));
        item.add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = -8069413566800571061L;

          protected void onEvent(AjaxRequestTarget target) {
            form.hideNewRecord();
            form.setModelObject(configuration);
            target.add(form);
            target.appendJavaScript("omConfigPanelInit();");
          }
        });
        item.add(AttributeModifier.replace("class", "clickable "
            + ((item.getIndex() % 2 == 1) ? "even" : "odd")));
      }
    };
    final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer");
    add(listContainer.add(dataView).setOutputMarkupId(true));
    DataViewContainer<Configuration> container = new DataViewContainer<Configuration>(listContainer, dataView);
    container.setLinks(new OrderByBorder<Configuration>("orderById", "configuration_id", container)
        , new OrderByBorder<Configuration>("orderByKey", "conf_key", container)
        , new OrderByBorder<Configuration>("orderByValue", "conf_value", container));
    add(container.orderLinks);
    add(new PagedEntityListPanel("navigator", dataView) {
      private static final long serialVersionUID = 5097048616003411362L;

      @Override
      protected void onEvent(AjaxRequestTarget target) {
        target.add(listContainer);
      }
    });
   
    form = new ConfigForm("form", listContainer, new Configuration());
    form.showNewRecord();
        add(form);
   
  }
View Full Code Here

  }

  public Long deleteConfByConfiguration(LinkedHashMap<String, ?> values,
      Long users_id) {
    try {
      Configuration conf = (Configuration) CastMapToObject.getInstance()
          .castByGivenObject(values, Configuration.class);
      conf.setUser(usersDao.get(users_id));
      conf.setUpdatetime(new Date());
      conf.setDeleted(true);

      Configuration conf2 = this.get(conf.getConfiguration_id());
      conf2.setComment(conf.getComment());
      conf2.setConf_key(conf.getConf_key());
      conf2.setConf_value(conf.getConf_value());
      conf2.setUser(usersDao.get(users_id));
      conf2.setDeleted(true);
      conf2.setUpdatetime(new Date());

      this.updateConfig(conf2);
      return new Long(1);
    } catch (Exception ex2) {
      log.error("[deleteConfByUID]: ", ex2);
View Full Code Here

  }
 
  @Override
  protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
    Application.getBean(ConfigurationDao.class).update(getModelObject(), WebSession.getUserId());
    Configuration conf = Application.getBean(ConfigurationDao.class).get(getModelObject().getConfiguration_id());
    this.setModelObject(conf);
    hideNewRecord();
    target.add(this);
    target.add(listContainer);
    target.appendJavaScript("omConfigPanelInit();");
View Full Code Here

    target.appendJavaScript("omConfigPanelInit();");
  }

  @Override
  protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) {
    this.setModelObject(new Configuration());
    target.add(this);
    target.appendJavaScript("omConfigPanelInit();");
  }
View Full Code Here

    target.appendJavaScript("omConfigPanelInit();");
  }
 
  @Override
  protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
    Configuration conf = this.getModelObject();
    if (conf.getConfiguration_id() != null) {
      conf = Application.getBean(ConfigurationDao.class).get(conf.getConfiguration_id());
    } else {
      conf = new Configuration();
    }
    this.setModelObject(conf);
    target.add(this);
    target.appendJavaScript("omConfigPanelInit();");
  }
View Full Code Here

  }
 
  @Override
  protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
    Application.getBean(ConfigurationDao.class).delete(this.getModelObject(), WebSession.getUserId());
    this.setModelObject(new Configuration());
    target.add(listContainer);
    target.add(this);
    target.appendJavaScript("omConfigPanelInit();");
  }
View Full Code Here

   
    try {

      System.err.println("THIS");

      Configuration smtp_server = configurationDao
          .get(
          "smtp_server");
     
      System.err.println("smtp_server " + smtp_server.getUser());
     
      assertEquals(null, smtp_server.getUser());

    } catch (Exception err) {
      log.error("[startConversion]", err);
    }
   
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.persistence.beans.basic.Configuration

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.