Revision: 3314
Author: seba.wagner
Date: Wed Aug 11 07:33:03 2010
Log: Implement LdapConfigDaoImpl
http://code.google.com/p/openmeetings/source/detail?r=3314
Added:
/trunk/singlewebapp/WebContent/openmeetings/modules/admin/ldap
/trunk/singlewebapp/WebContent/openmeetings/modules/admin/ldap/ldapAdmin.lzx
/trunk/singlewebapp/WebContent/openmeetings/modules/admin/ldap/library.lzx
Modified:
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/Configurationmanagement.java
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/dao/LdapConfigDaoImpl.java
=======================================
--- /dev/null
+++
/trunk/singlewebapp/WebContent/openmeetings/modules/admin/ldap/ldapAdmin.lzx
Wed Aug 11 07:33:03 2010
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<library>
+
+<!--- Organization administration module for ADMIN.-->
+<class name="orgAdmin" extends="baseContentView">
+
+ <turnOverList name="_turnoverlist" width="320" height="${ canvas.height -
110 }" x="2" y="0"
+ orderby="organisation_id" step="50" asc="true">
+
+ <handler name="oninit">
+ this.addHeaderItem(164,120);
+ this.addHeaderItem(165,184);
+ //this.getOrganisations.doCall();
+ </handler>
+
+ <handler name="oncallnext" >
+ this.getOrganisations.doCall();
+ </handler>
+
+ <handler name="oncallpre" >
+ this.getOrganisations.doCall();
+ </handler>
+
+ <handler name="onclickedItem" args="obj">
+ //Debug.write("onclickedItem",obj,obj.obj);
+ parent._orgadminvalueform.hideNewRecordText();
+
parent._orgadminvalueform.initValueFieldsByObject(obj.obj);
+ </handler>
+
+ <netRemoteCallHib name="getOrganisations"
funcname="organisationservice.getOrganisations" remotecontext="$once{
canvas.thishib }" >
+ <netparam><method name="getValue"> return canvas.sessionId;
</method></netparam>
+ <netparam><method name="getValue"> return parent.parent.start;
</method></netparam>
+ <netparam><method name="getValue"> return parent.parent.step;
</method></netparam>
+ <netparam><method name="getValue"> return parent.parent.orderby;
</method></netparam>
+ <netparam><method name="getValue"> return parent.parent.asc;
</method></netparam>
+ <handler name="ondata" args="value">
+ //Debug.write("getOrganisations ",value);
+ //this.parent.destroy();
+ this.parent.initValues(value.records);
+ this.parent.renderContent(value.result);
+ </handler>
+ </netRemoteCallHib>
+
+ <method name="renderContent" args="records">
+ <![CDATA[
+ this.clearList();
+ for (var i=0;i<records.length;i++){
+ new
lz.orgAdminListItem(this._innerlist._inn._inn,{obj:records[i],organisation_id:records[i].organisation_id,orgname:records[i].name});
+ }
+ this.sendInitialWidthUpdate();
+ ]]>
+ </method>
+
+ </turnOverList>
+
+ <orgAdminValueForm name="_orgadminvalueform" x="340">
+ <handler name="onnew" args="refObj">
+ parent._turnoverlist.clearSelection();
+ </handler>
+ </orgAdminValueForm>
+
+</class>
+
+</library>
=======================================
--- /dev/null
+++
/trunk/singlewebapp/WebContent/openmeetings/modules/admin/ldap/library.lzx
Wed Aug 11 07:33:03 2010
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<library>
+
+ <include href="orgAdmin.lzx" />
+ <include href="orgUsersRecordValueList.lzx" />
+ <include href="orgAdminListItem.lzx" />
+ <include href="orgAdminValueForm.lzx" />
+ <include href="orgAdminChooseUserWindow.lzx" />
+
+</library>
=======================================
---
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/Configurationmanagement.java
Tue May 11 13:54:08 2010
+++
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/Configurationmanagement.java
Wed Aug 11 07:33:03 2010
@@ -124,7 +124,7 @@
return null;
}
- public List getConfigurations(int start, int max, String orderby, boolean
asc) {
+ public List<Configuration> getConfigurations(int start, int max, String
orderby, boolean asc) {
try {
Object idf = HibernateUtil.createSession();
Session session = HibernateUtil.getSession();
=======================================
---
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/dao/LdapConfigDaoImpl.java
Wed Aug 11 06:27:54 2010
+++
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/dao/LdapConfigDaoImpl.java
Wed Aug 11 07:33:03 2010
@@ -1,5 +1,18 @@
package org.openmeetings.app.data.basic.dao;
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.openmeetings.app.data.user.dao.UsersDaoImpl;
+import org.openmeetings.app.hibernate.beans.basic.LdapConfig;
+import org.openmeetings.app.hibernate.utils.HibernateUtil;
import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
@@ -19,5 +32,162 @@
}
return instance;
}
+
+ public Long addLdapConfig(Boolean addDomainToUserName, String
configFileName,
+ String domain, Long insertedby) {
+ try {
+
+ LdapConfig ldapConfig = new LdapConfig();
+ ldapConfig.setAddDomainToUserName(addDomainToUserName);
+ ldapConfig.setConfigFileName(configFileName);
+ ldapConfig.setDeleted("false");
+ ldapConfig.setDomain(domain);
+ ldapConfig.setInserted(new Date());
+ if (insertedby != null) {
+
ldapConfig.setInsertedby(UsersDaoImpl.getInstance().getUser(insertedby));
+ }
+
+ Object idf = HibernateUtil.createSession();
+ Session session = HibernateUtil.getSession();
+ Transaction tx = session.beginTransaction();
+
+ Long ldapConfigId = (Long) session.save(ldapConfig);
+
+ tx.commit();
+ HibernateUtil.closeSession(idf);
+
+ if (ldapConfigId > 0) {
+ return ldapConfigId;
+ } else {
+ throw new Exception("Could not store
SOAPLogin");
+ }
+
+ } catch (HibernateException ex) {
+ log.error("[addLdapConfig]: ",ex);
+ } catch (Exception ex2) {
+ log.error("[addLdapConfig]: ",ex2);
+ }
+ return null;
+ }
+
+ public Long updateLdapConfig(Long ldapConfigId, Boolean
addDomainToUserName,
+ String configFileName, String domain, Long updatedby) {
+ try {
+
+ LdapConfig ldapConfig =
this.getLdapConfigById(ldapConfigId);
+
+ if (ldapConfig == null) {
+ return -1L;
+ }
+
+ ldapConfig.setAddDomainToUserName(addDomainToUserName);
+ ldapConfig.setConfigFileName(configFileName);
+ ldapConfig.setDeleted("false");
+ ldapConfig.setDomain(domain);
+ ldapConfig.setUpdated(new Date());
+ if (updatedby != null) {
+
ldapConfig.setUpdatedby(UsersDaoImpl.getInstance().getUser(updatedby));
+ }
+
+ Object idf = HibernateUtil.createSession();
+ Session session = HibernateUtil.getSession();
+ Transaction tx = session.beginTransaction();
+
+ session.update(ldapConfig);
+
+ tx.commit();
+ HibernateUtil.closeSession(idf);
+
+ return ldapConfigId;
+
+ } catch (HibernateException ex) {
+ log.error("[updateLdapConfig]: ",ex);
+ } catch (Exception ex2) {
+ log.error("[updateLdapConfig]: ",ex2);
+ }
+ return null;
+ }
+
+ public LdapConfig getLdapConfigById(Long ldapConfigId) {
+ try {
+
+ String hql = "Select * From LdapConfig c " +
+ "WHERE c.ldapConfigId = :ldapConfigId "
+
+ "AND c.deleted LIKE :deleted";
+
+ Object idf = HibernateUtil.createSession();
+ Session session = HibernateUtil.getSession();
+ Transaction tx = session.beginTransaction();
+
+ Query query = session.createQuery(hql);
+ query.setLong("ldapConfigId", ldapConfigId);
+ query.setString("deleted", "false");
+
+
+ LdapConfig ldapConfig = (LdapConfig)
query.uniqueResult();
+
+ tx.commit();
+ HibernateUtil.closeSession(idf);
+
+ return ldapConfig;
+
+ } catch (HibernateException ex) {
+ log.error("[getLdapConfigById]: ",ex);
+ } catch (Exception ex2) {
+ log.error("[getLdapConfigById]: ",ex2);
+ }
+ return null;
+ }
+
+ public List<LdapConfig> getLdapConfigs(int start, int max, String
orderby, boolean asc) {
+ try {
+ Object idf = HibernateUtil.createSession();
+ Session session = HibernateUtil.getSession();
+ Transaction tx = session.beginTransaction();
+ Criteria crit =
session.createCriteria(LdapConfig.class);
+ crit.add(Restrictions.eq("deleted", "false"));
+ crit.setFirstResult(start);
+ crit.setMaxResults(max);
+ if (asc) crit.addOrder(Order.asc(orderby));
+ else crit.addOrder(Order.desc(orderby));
+ List<LdapConfig> ll = crit.list();
+ tx.commit();
+ HibernateUtil.closeSession(idf);
+ return ll;
+ } catch (HibernateException ex) {
+ log.error("[getLdapConfigs]" ,ex);
+ } catch (Exception ex2) {
+ log.error("[getLdapConfigs]" ,ex2);
+ }
+ return null;
+ }
+
+ public Long deleteLdapConfigById(Long ldapConfigId) {
+ try {
+
+ LdapConfig ldapConfig =
this.getLdapConfigById(ldapConfigId);
+
+ if (ldapConfig == null) {
+ return null;
+ }
+
+ Object idf = HibernateUtil.createSession();
+ Session session = HibernateUtil.getSession();
+ Transaction tx = session.beginTransaction();
+
+ session.delete(ldapConfig);
+
+ tx.commit();
+ HibernateUtil.closeSession(idf);
+
+ return ldapConfigId;
+
+ } catch (HibernateException ex) {
+ log.error("[deleteLdapConfigById]: ",ex);
+ } catch (Exception ex2) {
+ log.error("[deleteLdapConfigById]: ",ex2);
+ }
+ return null;
+ }
}
--
You received this message because you are subscribed to the Google Groups
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/openmeetings-dev?hl=en.