Package org.openmeetings.app.persistence.beans.basic

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


  public UserSipData openSIPgUserCreateUser(String first_name, String middle_i,
      String last_name, String email, String login, String password) {
    try {
     
      //Check if the OpenXG Gateway is enabled in general
      Configuration sip_openxg_enable = Configurationmanagement.getInstance().getConfKey(3L, "sip.openxg.enable");
     
      if (sip_openxg_enable == null || !sip_openxg_enable.getConf_value().equals("yes")) {
        log.debug("SIP is disabled");
        return null;
      }
     
      //client_id and client_secret
      Configuration openxg_client_id = Configurationmanagement.getInstance().getConfKey(3L, "openxg.client.id");
      Configuration openxg_client_secret = Configurationmanagement.getInstance().getConfKey(3L, "openxg.client.secret");
      if (openxg_client_id == null || openxg_client_secret == null) {
        throw new Exception("openxg.client.id or openxg.client.secret missing in Configuration table");
      }
      String client_id = openxg_client_id.getConf_value();
      String client_secret = openxg_client_secret.getConf_value();
       
      //domain
      Configuration openxg_client_domain = Configurationmanagement.getInstance().getConfKey(3L, "openxg.client.domain");
      if (openxg_client_domain == null) {
        throw new Exception("openxg.client.domain missing in Configuration table");
      }
        String domain = openxg_client_domain.getConf_value();
       
        //openxg_community_code
        Configuration openxg_community_code = Configurationmanagement.getInstance().getConfKey(3L, "openxg.community.code");
      if (openxg_community_code == null) {
        throw new Exception("openxg.community.code missing in Configuration table");
      }
        String community_code = openxg_community_code.getConf_value();
       
        //language_code
        Configuration openxg_language_code = Configurationmanagement.getInstance().getConfKey(3L, "openxg.language.code");
      if (openxg_language_code == null) {
        throw new Exception("openxg.language.code missing in Configuration table");
      }
        String language_code = openxg_language_code.getConf_value();
       
        //adminid
        Configuration openxg_adminid = Configurationmanagement.getInstance().getConfKey(3L, "openxg.adminid");
      if (openxg_adminid == null) {
        throw new Exception("openxg.adminid missing in Configuration table");
      }
        String adminid = openxg_adminid.getConf_value();
       
        //sip_language_phonecode, for example +358, is important as port of the
        //number/login for the SIP-User via the applet
        Configuration sip_language_phonecode = Configurationmanagement.getInstance().getConfKey(3L, "sip.language.phonecode");
     
      if (sip_language_phonecode == null) {
        throw new Exception("No sip.language.phonecode set in Configuration");
      }
     
        //Calculate the number in national format
        Configuration sip_phonerange_start = Configurationmanagement.getInstance().getConfKey(3L, "sip.phonerange.start");
        Configuration sip_phonerange = Configurationmanagement.getInstance().getConfKey(3L, "sip.phonerange");
        Configuration sip_phonerange_currentindex = Configurationmanagement.getInstance().getConfKey(3L, "sip.phonerange.currentindex");
        if (sip_phonerange_start == null || sip_phonerange == null || sip_phonerange_currentindex == null) {
          throw new Exception("sip.phonerange.start, sip.phonerange or sip.phonerange.currentindex missing in Configuration table");
        }
       
//        Long sipPhoneRangeStart = Long.parseLong(sip_phonerange_start.getConf_value());
View Full Code Here


 
  public OpenXGReturnObject openSIPgCreateConference() {
    try {
     
      //Check if the OpenXG Gateway is enabled in general
      Configuration sip_openxg_enable = Configurationmanagement.getInstance().getConfKey(3L, "sip.openxg.enable");
     
      if (sip_openxg_enable == null || !sip_openxg_enable.getConf_value().equals("yes")) {
        log.debug("SIP is disabled");
        return null;
      }
     
      //client_id and client_secret
      Configuration openxg_client_id = Configurationmanagement.getInstance().getConfKey(3L, "openxg.client.id");
      Configuration openxg_client_secret = Configurationmanagement.getInstance().getConfKey(3L, "openxg.client.secret");
      if (openxg_client_id == null || openxg_client_secret == null) {
        throw new Exception("openxg.client.id or openxg.client.secret missing in Configuration table");
      }
      String client_id = openxg_client_id.getConf_value();
      String client_secret = openxg_client_secret.getConf_value();
       
      //domain
      Configuration openxg_client_domain = Configurationmanagement.getInstance().getConfKey(3L, "openxg.client.domain");
      if (openxg_client_domain == null) {
        throw new Exception("openxg.client.domain missing in Configuration table");
      }
        String domain = openxg_client_domain.getConf_value();
     
      //language_code
        Configuration openxg_language_code = Configurationmanagement.getInstance().getConfKey(3L, "openxg.language.code");
      if (openxg_language_code == null) {
        throw new Exception("openxg.language.code missing in Configuration table");
      }
        String language_code = openxg_language_code.getConf_value();
       
        //adminid
        Configuration openxg_adminid = Configurationmanagement.getInstance().getConfKey(3L, "openxg.adminid");
      if (openxg_adminid == null) {
        throw new Exception("openxg.adminid missing in Configuration table");
      }
        String adminid = openxg_adminid.getConf_value();
     
        Date d = new Date();
        long starttime = d.getTime()/1000;
       
        long endTime = (d.getTime()/1000) + (60 * 60);
       
        //"0", "2147483647",
       
        //permanent conferences
        starttime = 0;
        endTime = 2147483647;
       
        String digest = this.digest_calculate(new Object[]{client_id, "067201101", domain, ""+starttime,
                         ""+endTime, language_code, adminid,
                         client_secret});
       
      Configuration openxg_wrapper_url = Configurationmanagement.getInstance().getConfKey(3L, "openxg.wrapper.url");
     
      if (openxg_wrapper_url == null) {
        throw new Exception("No openxg.wrapper.url set in Configuration");
      }
     
      String strURL = openxg_wrapper_url.getConf_value();
     
      // Prepare HTTP post
          PostMethod post = new PostMethod(strURL);
          post.addRequestHeader("User-Agent", "OpenSIPg XML_RPC Client");

View Full Code Here

  }
 
  public OpenXGReturnObject openSIPgPost(String stringToPost) {
    try {
     
          Configuration openxg_wrapper_url = Configurationmanagement.getInstance().getConfKey(3L, "openxg.wrapper.url");
     
      if (openxg_wrapper_url == null) {
        throw new Exception("No openxg.wrapper.url set in Configuration");
      }
         
      String strURL = openxg_wrapper_url.getConf_value();
     
      // Prepare HTTP post
          PostMethod post = new PostMethod(strURL);
          post.addRequestHeader("User-Agent", "OpenSIPg XML_RPC Client");
View Full Code Here

   
    Long newUserId = null;
   
    try{
     
      Configuration conf = Configurationmanagement.getInstance().getConfKey(3L, "default.timezone");
      String jName_timeZone = "";
     
      if (conf != null) {
        jName_timeZone = conf.getConf_value();
      }
     
     
      //CHeck if LDAP Users get a SIP Account Issue 1099
     
View Full Code Here

  }
  public Configuration getConfKey(long user_level, String CONF_KEY) {
    try {
      if (AuthLevelmanagement.getInstance().checkUserLevel(user_level)) {
        Configuration configuration = null;
        Object idf = PersistenceSessionUtil.createSession();
        EntityManager session = PersistenceSessionUtil.getSession();
        EntityTransaction tx = session.getTransaction();
        tx.begin();
        Query query = session.createQuery("select c from Configuration as c where c.conf_key = :conf_key and c.deleted = :deleted");
View Full Code Here

 
  public Configuration getConfByConfigurationId(long user_level, long configuration_id) {
    try {
      log.debug("getConfByConfigurationId1: user_level "+user_level);
      if (AuthLevelmanagement.getInstance().checkAdminLevel(user_level)) {
        Configuration configuration = null;
        Object idf = PersistenceSessionUtil.createSession();
        EntityManager session = PersistenceSessionUtil.getSession();
        EntityTransaction tx = session.getTransaction();
        tx.begin();
        Query query = session.createQuery("select c from Configuration as c where c.configuration_id = :configuration_id");
        query.setParameter("configuration_id", configuration_id);
        query.setMaxResults(1);
            try {
          configuration = (Configuration) query.getSingleResult();
            } catch (NoResultException e) {
            }
        tx.commit();
        PersistenceSessionUtil.closeSession(idf);
        log.debug("getConfByConfigurationId4: "+configuration);
       
        if (configuration!=null && configuration.getUser_id()!=null) {
          configuration.setUsers(UsersDaoImpl.getInstance().getUser(configuration.getUser_id()));
        }
        return configuration;
      } else {
        log.error("[getConfByConfigurationId] Permission denied "+user_level);
      }
View Full Code Here

  public String addConfByKey(long user_level, String CONF_KEY,
      String CONF_VALUE, Long USER_ID, String comment) {
    String ret = "Add Configuration";
    if (AuthLevelmanagement.getInstance().checkAdminLevel(user_level)) {
      Configuration configuration = new Configuration();
      configuration.setConf_key(CONF_KEY);
      configuration.setConf_value(CONF_VALUE);
      configuration.setStarttime(new Date());
      configuration.setDeleted("false");
      configuration.setComment(comment);
      if (USER_ID!=null) configuration.setUser_id(USER_ID);
      try {
        Object idf = PersistenceSessionUtil.createSession();
        EntityManager session = PersistenceSessionUtil.getSession();
        EntityTransaction tx = session.getTransaction();
        tx.begin();
View Full Code Here

  }
 
  public Long saveOrUpdateConfiguration(long user_level, LinkedHashMap values, Long users_id) {
    try {
      if (AuthLevelmanagement.getInstance().checkAdminLevel(user_level)) {
        Configuration conf = (Configuration) CastMapToObject.getInstance().castByGivenObject(values, Configuration.class);
        if (conf.getConfiguration_id().equals(null) || conf.getConfiguration_id() == 0 ){
          log.info("add new Configuration");
          conf.setConfiguration_id(null);
          conf.setStarttime(new Date());
          conf.setDeleted("false");
          return this.addConfig(conf);
        } else {
          log.info("update Configuration ID: "+conf.getConfiguration_id());
          Configuration conf2 = this.getConfByConfigurationId(3L, conf.getConfiguration_id());
          conf2.setComment(conf.getComment());
          conf2.setConf_key(conf.getConf_key());
          conf2.setConf_value(conf.getConf_value());
          conf2.setUser_id(users_id);
          conf2.setDeleted("false");
          conf2.setUpdatetime(new Date());
          return this.updateConfig(conf2);
        }
      } else {
        log.error("[saveOrUpdateConfByConfigurationId] Error: Permission denied");
        return new Long(-100);
View Full Code Here

 

  public Long deleteConfByConfiguration(long user_level, LinkedHashMap values, Long users_id) {
    try
      if (AuthLevelmanagement.getInstance().checkAdminLevel(user_level)) {
        Configuration conf = (Configuration) CastMapToObject.getInstance().castByGivenObject(values, Configuration.class);
        conf.setUsers(UsersDaoImpl.getInstance().getUser(users_id));
        conf.setUpdatetime(new Date());
        conf.setDeleted("true");
       
        Configuration conf2 = this.getConfByConfigurationId(3L, conf.getConfiguration_id());
        conf2.setComment(conf.getComment());
        conf2.setConf_key(conf.getConf_key());
        conf2.setConf_value(conf.getConf_value());
        conf2.setUser_id(users_id);
        conf2.setDeleted("true");
        conf2.setUpdatetime(new Date());
       
        this.updateConfig(conf2);
        return new Long(1);
      } else {
        log.error("Error: Permission denied");
View Full Code Here

             
              String jNameTimeZone = null;
              if (us != null && us.getOmTimeZone() != null) {
                jNameTimeZone = us.getOmTimeZone().getJname();
              } else {
                Configuration conf = Configurationmanagement.getInstance().getConfKey(3L, "default.timezone");
                if (conf != null) {
                  jNameTimeZone = conf.getConf_value();
                }
              }
             
              OmTimeZone omTimeZone = OmTimeZoneDaoImpl.getInstance().getOmTimeZone(jNameTimeZone);
             
View Full Code Here

TOP

Related Classes of org.openmeetings.app.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.