Author: sebawagner
Date: Sun Sep 30 07:24:40 2012
New Revision: 1391955
URL: http://svn.apache.org/viewvc?rev=1391955&view=rev
Log:
OPENMEETINGS-434 complete LdapConfig CRUD via Wicket, add "comments" field in
LdapConfig entity
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ConfigurationDaoImpl.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/LdapConfigDaoImpl.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/LdapConfigService.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/configurations/ConfigForm.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapForm.java
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.html
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.java
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ConfigurationDaoImpl.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ConfigurationDaoImpl.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ConfigurationDaoImpl.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/ConfigurationDaoImpl.java
Sun Sep 30 07:24:40 2012
@@ -338,7 +338,7 @@ public class ConfigurationDaoImpl implem
public Configuration get(long id) {
try {
- if (id == 0) {
+ if (id <= 0) {
return null;
}
return em
@@ -361,7 +361,7 @@ public class ConfigurationDaoImpl implem
public void update(Configuration entity, long userId) {
if (entity.getConfiguration_id() == null
- || entity.getConfiguration_id() == 0) {
+ || entity.getConfiguration_id() <= 0) {
entity.setStarttime(new Date());
entity.setDeleted(false);
this.updateConfig(entity);
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/LdapConfigDaoImpl.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/LdapConfigDaoImpl.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/LdapConfigDaoImpl.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/basic/dao/LdapConfigDaoImpl.java
Sun Sep 30 07:24:40 2012
@@ -24,6 +24,7 @@ import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceException;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
@@ -39,19 +40,30 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
+/**
+ * Insert/Update/Delete {@link LdapConfig}
+ *
+ *
+ * @author swagner
+ *
+ */
@Transactional
public class LdapConfigDaoImpl implements OmDAO<LdapConfig> {
- private static final Logger log =
Red5LoggerFactory.getLogger(LdapConfigDaoImpl.class,
OpenmeetingsVariables.webAppRootKey);
+ private static final Logger log = Red5LoggerFactory.getLogger(
+ LdapConfigDaoImpl.class,
OpenmeetingsVariables.webAppRootKey);
+
@PersistenceContext
private EntityManager em;
+
@Autowired
private UsersDaoImpl usersDao;
-
- public Long addLdapConfig(String name, Boolean addDomainToUserName,
String configFileName,
- String domain, Long insertedby, Boolean isActive) {
+
+ public Long addLdapConfig(String name, Boolean addDomainToUserName,
+ String configFileName, String domain, Long insertedby,
+ Boolean isActive) {
try {
-
+
LdapConfig ldapConfig = new LdapConfig();
ldapConfig.setAddDomainToUserName(addDomainToUserName);
ldapConfig.setConfigFileName(configFileName);
@@ -61,59 +73,59 @@ public class LdapConfigDaoImpl implement
ldapConfig.setName(name);
ldapConfig.setInserted(new Date());
if (insertedby != null) {
- log.debug("addLdapConfig :1:
"+usersDao.getUser(insertedby));
+ log.debug("addLdapConfig :1: " +
usersDao.getUser(insertedby));
ldapConfig.setInsertedby(usersDao.getUser(insertedby));
}
-
- log.debug("addLdapConfig :2: "+insertedby);
-
+
+ log.debug("addLdapConfig :2: " + insertedby);
+
ldapConfig = em.merge(ldapConfig);
Long ldapConfigId = ldapConfig.getLdapConfigId();
-
+
if (ldapConfigId > 0) {
return ldapConfigId;
} else {
throw new Exception("Could not store
SOAPLogin");
}
-
+
} catch (Exception ex2) {
- log.error("[addLdapConfig]: ",ex2);
+ log.error("[addLdapConfig]: ", ex2);
}
return null;
}
-
public Long addLdapConfigByObject(LdapConfig ldapConfig) {
try {
-
+
ldapConfig.setDeleted(false);
ldapConfig.setInserted(new Date());
-
+
ldapConfig = em.merge(ldapConfig);
Long ldapConfigId = ldapConfig.getLdapConfigId();
-
+
if (ldapConfigId > 0) {
return ldapConfigId;
} else {
throw new Exception("Could not store
SOAPLogin");
}
-
+
} catch (Exception ex2) {
- log.error("[addLdapConfig]: ",ex2);
+ log.error("[addLdapConfig]: ", ex2);
}
return null;
}
-
- public Long updateLdapConfig(Long ldapConfigId, String name, Boolean
addDomainToUserName,
- String configFileName, String domain, Long updatedby,
Boolean isActive) {
+
+ public Long updateLdapConfig(Long ldapConfigId, String name,
+ Boolean addDomainToUserName, String configFileName,
String domain,
+ Long updatedby, Boolean isActive) {
try {
-
- LdapConfig ldapConfig =
this.getLdapConfigById(ldapConfigId);
-
+
+ LdapConfig ldapConfig = this.get(ldapConfigId);
+
if (ldapConfig == null) {
return -1L;
}
-
+
ldapConfig.setAddDomainToUserName(addDomainToUserName);
ldapConfig.setConfigFileName(configFileName);
ldapConfig.setDeleted(false);
@@ -122,49 +134,51 @@ public class LdapConfigDaoImpl implement
ldapConfig.setName(name);
ldapConfig.setUpdated(new Date());
if (updatedby != null) {
- log.debug("updateLdapConfig :1:
"+usersDao.getUser(updatedby));
+ log.debug("updateLdapConfig :1: " +
usersDao.getUser(updatedby));
ldapConfig.setUpdatedby(usersDao.getUser(updatedby));
}
-
- log.debug("updateLdapConfig :2: "+updatedby);
-
+
+ log.debug("updateLdapConfig :2: " + updatedby);
+
ldapConfig = em.merge(ldapConfig);
ldapConfigId = ldapConfig.getLdapConfigId();
-
+
return ldapConfigId;
-
+
} catch (Exception ex2) {
- log.error("[updateLdapConfig]: ",ex2);
+ log.error("[updateLdapConfig]: ", ex2);
}
return -1L;
}
-
- public LdapConfig getLdapConfigById(Long ldapConfigId) {
+
+ public LdapConfig get(long ldapConfigId) {
try {
-
- String hql = "select c from LdapConfig c " +
- "WHERE c.ldapConfigId = :ldapConfigId "
+
- "AND c.deleted = :deleted";
-
- TypedQuery<LdapConfig> query = em.createQuery(hql,
LdapConfig.class);
+
+ String hql = "select c from LdapConfig c "
+ + "WHERE c.ldapConfigId = :ldapConfigId
"
+ + "AND c.deleted = :deleted";
+
+ TypedQuery<LdapConfig> query = em
+ .createQuery(hql, LdapConfig.class);
query.setParameter("ldapConfigId", ldapConfigId);
query.setParameter("deleted", false);
-
+
LdapConfig ldapConfig = null;
try {
ldapConfig = query.getSingleResult();
- } catch (NoResultException ex) {
- }
-
+ } catch (NoResultException ex) {
+ }
+
return ldapConfig;
-
+
} catch (Exception ex2) {
- log.error("[getLdapConfigById]: ",ex2);
+ log.error("[getLdapConfigById]: ", ex2);
}
return null;
}
-
- public List<LdapConfig> getLdapConfigs(int start, int max, String
orderby, boolean asc) {
+
+ public List<LdapConfig> getLdapConfigs(int start, int max, String
orderby,
+ boolean asc) {
try {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<LdapConfig> cq =
cb.createQuery(LdapConfig.class);
@@ -172,7 +186,7 @@ public class LdapConfigDaoImpl implement
Predicate condition = cb.equal(c.get("deleted"), false);
cq.where(condition);
cq.distinct(asc);
- if (asc){
+ if (asc) {
cq.orderBy(cb.asc(c.get(orderby)));
} else {
cq.orderBy(cb.desc(c.get(orderby)));
@@ -183,41 +197,45 @@ public class LdapConfigDaoImpl implement
List<LdapConfig> ll = q.getResultList();
return ll;
} catch (Exception ex2) {
- log.error("[getLdapConfigs]" ,ex2);
+ log.error("[getLdapConfigs]", ex2);
}
return null;
}
-
- public Long selectMaxFromLdapConfig(){
+
+ public Long selectMaxFromLdapConfig() {
try {
log.debug("selectMaxFromConfigurations ");
- //get all users
- TypedQuery<Long> query = em.createQuery("select
count(c.ldapConfigId) from LdapConfig c where c.deleted = false", Long.class);
+ // get all users
+ TypedQuery<Long> query = em
+ .createQuery(
+ "select
count(c.ldapConfigId) from LdapConfig c where c.deleted = false",
+ Long.class);
List<Long> ll = query.getResultList();
log.debug("selectMaxFromLdapConfig" + ll.get(0));
return ll.get(0);
} catch (Exception ex2) {
- log.error("[selectMaxFromLdapConfig] ",ex2);
+ log.error("[selectMaxFromLdapConfig] ", ex2);
}
return null;
- }
-
+ }
+
public Long deleteLdapConfigById(Long ldapConfigId) {
try {
-
- LdapConfig ldapConfig =
this.getLdapConfigById(ldapConfigId);
-
+
+ LdapConfig ldapConfig = this.get(ldapConfigId);
+
if (ldapConfig == null) {
return null;
}
-
- ldapConfig = em.find(LdapConfig.class,
ldapConfig.getLdapConfigId());
+
+ ldapConfig = em
+ .find(LdapConfig.class,
ldapConfig.getLdapConfigId());
em.remove(ldapConfig);
-
+
return ldapConfigId;
-
+
} catch (Exception ex2) {
- log.error("[deleteLdapConfigById]: ",ex2);
+ log.error("[deleteLdapConfigById]: ", ex2);
}
return null;
}
@@ -225,19 +243,20 @@ public class LdapConfigDaoImpl implement
public List<LdapConfig> getActiveLdapConfigs() {
try {
log.debug("selectMaxFromConfigurations ");
-
- String hql = "select c from LdapConfig c " +
- "where c.deleted = false " +
- "AND c.isActive = :isActive ";
-
- //get all users
- TypedQuery<LdapConfig> query = em.createQuery(hql,
LdapConfig.class);
+
+ String hql = "select c from LdapConfig c "
+ + "where c.deleted = false "
+ + "AND c.isActive = :isActive ";
+
+ // get all users
+ TypedQuery<LdapConfig> query = em
+ .createQuery(hql, LdapConfig.class);
query.setParameter("isActive", true);
List<LdapConfig> ll = query.getResultList();
-
- return ll;
+
+ return ll;
} catch (Exception ex2) {
- log.error("[getActiveLdapConfigs] ",ex2);
+ log.error("[getActiveLdapConfigs] ", ex2);
}
return null;
}
@@ -245,55 +264,63 @@ public class LdapConfigDaoImpl implement
public List<LdapConfig> getLdapConfigs() {
try {
log.debug("selectMaxFromConfigurations ");
-
- String hql = "select c from LdapConfig c " +
- "where c.deleted = false ";
-
- //get all users
- TypedQuery<LdapConfig> query = em.createQuery(hql,
LdapConfig.class);
+
+ String hql = "select c from LdapConfig c "
+ + "where c.deleted = false ";
+
+ // get all users
+ TypedQuery<LdapConfig> query = em
+ .createQuery(hql, LdapConfig.class);
List<LdapConfig> ll = query.getResultList();
-
- return ll;
+
+ return ll;
} catch (Exception ex2) {
- log.error("[getActiveLdapConfigs] ",ex2);
+ log.error("[getActiveLdapConfigs] ", ex2);
}
return null;
}
-
public List<LdapConfig> getNondeletedLdapConfig(int first, int count) {
- TypedQuery<LdapConfig> q =
em.createNamedQuery("getNondeletedLdapConfigs", LdapConfig.class);
+ TypedQuery<LdapConfig> q = em.createNamedQuery(
+ "getNondeletedLdapConfigs", LdapConfig.class);
q.setFirstResult(first);
q.setMaxResults(count);
return q.getResultList();
}
-
- public LdapConfig get(long id) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
public List<LdapConfig> get(int start, int count) {
return getNondeletedLdapConfig(start, count);
}
-
public long count() {
return selectMaxFromLdapConfig();
}
-
public void update(LdapConfig entity, long userId) {
- // TODO Auto-generated method stub
-
+ try {
+ if (entity.getLdapConfigId() <= 0) {
+ entity.setInserted(new Date());
+ entity.setInsertedby(usersDao.get(userId));
+ entity.setDeleted(false);
+ em.persist(entity);
+ } else {
+ entity.setUpdated(new Date());
+ entity.setUpdatedby(usersDao.get(userId));
+ entity.setDeleted(false);
+ em.merge(entity);
+ }
+ } catch (PersistenceException ex) {
+ log.error("[update LdapConfig]", ex);
+ }
}
-
public void delete(LdapConfig entity, long userId) {
- // TODO Auto-generated method stub
-
+ if (entity.getLdapConfigId() >= 0) {
+ entity.setUpdated(new Date());
+ entity.setUpdatedby(usersDao.get(userId));
+ entity.setDeleted(true);
+ em.merge(entity);
+ }
}
-
+
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
Sun Sep 30 07:24:40 2012
@@ -161,7 +161,7 @@ public class LdapLoginManagement {
// Retrieve Configuration Data
HashMap<String, String> configData;
- LdapConfig ldapConfig =
ldapConfigDao.getLdapConfigById(ldapConfigId);
+ LdapConfig ldapConfig = ldapConfigDao.get(ldapConfigId);
try {
configData =
getLdapConfigData(ldapConfig.getConfigFileName());
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java
Sun Sep 30 07:24:40 2012
@@ -28,6 +28,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
@@ -49,7 +50,7 @@ public class LdapConfig implements Seria
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
- public long ldapConfigId;
+ public long ldapConfigId = 0L;
@Column(name="name")
@Element(data=true)
@@ -88,6 +89,11 @@ public class LdapConfig implements Seria
@Column(name="deleted")
private boolean deleted;
+ @Lob
+ @Column(name = "comment_field", length = 2048)
+ @Element(data = true, required = false)
+ private String comment;
+
public long getLdapConfigId() {
return ldapConfigId;
}
@@ -164,5 +170,13 @@ public class LdapConfig implements Seria
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/LdapConfigService.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/LdapConfigService.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/LdapConfigService.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/LdapConfigService.java
Sun Sep 30 07:24:40 2012
@@ -65,7 +65,7 @@ public class LdapConfigService {
Long users_id = sessionManagement.checkSession(SID);
Long user_level = userManagement.getUserLevelByID(users_id);
if (authLevelManagement.checkAdminLevel(user_level)){
- return this.ldapConfigDaoImpl.getLdapConfigById(ldapConfigId);
+ return this.ldapConfigDaoImpl.get(ldapConfigId);
}
return null;
}
@@ -132,7 +132,8 @@ public class LdapConfigService {
Long user_level =
userManagement.getUserLevelByID(users_id);
if (authLevelManagement.checkAdminLevel(user_level)){
- Long ldapConfigId =
Long.valueOf(values.get("ldapConfigId").toString()).longValue();
+ long ldapConfigId = Long.valueOf(
+
values.get("ldapConfigId").toString()).longValue();
Boolean addDomainToUserName =
Boolean.valueOf(values.get("addDomainToUserName").toString()).booleanValue();
String configFileName =
values.get("configFileName").toString();
String name = values.get("tName").toString();
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
Sun Sep 30 07:24:40 2012
@@ -317,7 +317,7 @@ public class MainService implements IPen
// LDAP Loggedin Users cannot use the permanent
Login Flag
- LdapConfig ldapConfig =
ldapConfigDao.getLdapConfigById(ldapConfigId);
+ LdapConfig ldapConfig =
ldapConfigDao.get(ldapConfigId);
String ldapLogin = usernameOrEmail;
if (ldapConfig.getAddDomainToUserName() != null
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/configurations/ConfigForm.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/configurations/ConfigForm.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/configurations/ConfigForm.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/configurations/ConfigForm.java
Sun Sep 30 07:24:40 2012
@@ -62,17 +62,10 @@ public class ConfigForm extends AdminBas
}
- void updateView(AjaxRequestTarget target) {
- target.add(this);
- }
-
@Override
protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
Application.getBean(ConfigurationDaoImpl.class).update(getModelObject(),
WebSession.getUserId());
Configuration conf =
Application.getBean(ConfigurationDaoImpl.class).get(getModelObject().getConfiguration_id());
-
- System.out.println(conf.getUser());
-
this.setModelObject(conf);
target.add(this);
target.add(listContainer);
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapForm.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapForm.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapForm.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapForm.java
Sun Sep 30 07:24:40 2012
@@ -18,23 +18,95 @@
*/
package org.apache.openmeetings.web.components.admin.ldaps;
+import org.apache.openmeetings.data.basic.dao.LdapConfigDaoImpl;
import org.apache.openmeetings.persistence.beans.basic.LdapConfig;
+import org.apache.openmeetings.web.app.Application;
+import org.apache.openmeetings.web.app.WebSession;
import org.apache.openmeetings.web.components.admin.AdminBaseForm;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior;
+import org.apache.wicket.datetime.markup.html.basic.DateLabel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.CheckBox;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.RequiredTextField;
+import org.apache.wicket.markup.html.form.TextArea;
+import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.util.time.Duration;
+/**
+ * Form components to insert/update/delete {@link LdapConfig}
+ *
+ * @author swagner
+ *
+ */
public class LdapForm extends AdminBaseForm<LdapConfig> {
private static final long serialVersionUID = 1L;
+ private final WebMarkupContainer listContainer;
- public LdapForm(String id, final LdapConfig ldapConfig) {
+ public LdapForm(String id, WebMarkupContainer listContainer,
+ final LdapConfig ldapConfig) {
super(id, new CompoundPropertyModel<LdapConfig>(ldapConfig));
setOutputMarkupId(true);
+ this.listContainer = listContainer;
+ add(new RequiredTextField<String>("name"));
+ add(new CheckBox("isActive"));
+ add(DateLabel.forDatePattern("inserted", "dd.MM.yyyy
HH:mm:ss"));
+ add(new Label("insertedby.login"));
+ add(DateLabel.forDatePattern("updated", "dd.MM.yyyy HH:mm:ss"));
+ add(new Label("updatedby.login"));
+ add(new RequiredTextField<String>("configFileName"));
+ add(new CheckBox("addDomainToUserName"));
+ add(new TextField<String>("domain"));
+ add(new TextArea<String>("comment"));
+
// attach an ajax validation behavior to all form component's
keydown
// event and throttle it down to once per second
AjaxFormValidatingBehavior.addToAllFormComponents(this,
"keydown",
Duration.ONE_SECOND);
}
+
+ @Override
+ protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
+
Application.getBean(LdapConfigDaoImpl.class).update(getModelObject(),
+ WebSession.getUserId());
+ LdapConfig ldapConfig =
Application.getBean(LdapConfigDaoImpl.class)
+ .get(getModelObject().getLdapConfigId());
+ this.setModelObject(ldapConfig);
+ target.add(this);
+ target.add(listContainer);
+ }
+
+ @Override
+ protected void onNewSubmit(AjaxRequestTarget target, Form<?> form) {
+ this.setModelObject(new LdapConfig());
+ target.add(this);
+ }
+
+ @Override
+ protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
+ LdapConfig ldapConfig = this.getModelObject();
+ if (ldapConfig.getLdapConfigId() <= 0) {
+ ldapConfig =
Application.getBean(LdapConfigDaoImpl.class).get(
+ ldapConfig.getLdapConfigId());
+ } else {
+ ldapConfig = new LdapConfig();
+ }
+ this.setModelObject(ldapConfig);
+ target.add(this);
+ }
+
+ @Override
+ protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
+ Application.getBean(LdapConfigDaoImpl.class).delete(
+ this.getModelObject(), WebSession.getUserId());
+ this.setModelObject(new LdapConfig());
+ target.add(listContainer);
+ target.add(this);
+ }
+
}
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.html
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.html?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.html
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.html
Sun Sep 30 07:24:40 2012
@@ -49,6 +49,30 @@
<td class="adminPanelColumnForm">
<form wicket:id="form"
class="adminForm">
<div wicket:id="buttons"></div>
+ <wicket:ommessage key="1108"
/>: <input type="text" wicket:id="name"/>
+ <br/>
+ <wicket:ommessage key="1109" />: <input
type="checkbox" wicket:id="isActive"/>
+ <br/>
+ <wicket:ommessage key="1110" />: <span
wicket:id="inserted"/>
+ <br/>
+ <wicket:ommessage key="1111" />: <span
wicket:id="insertedby.login"/>
+ <br/>
+ <wicket:ommessage key="1112" />: <span
wicket:id="updated"/>
+ <br/>
+ <wicket:ommessage key="1113" />: <span
wicket:id="updatedby.login"/>
+ <br/>
+ <wicket:ommessage key="1114" />
+ <br/>
+ <wicket:ommessage key="1115" />: <input
type="text" wicket:id="configFileName"/>
+ <br/>
+ <wicket:ommessage key="1116" />
+ <br/>
+ <wicket:ommessage key="1117" />: <input
type="checkbox" wicket:id="addDomainToUserName"/>
+ <br/>
+ <wicket:ommessage key="1115" />: <input
type="text" wicket:id="domain"/>
+ <br/>
+ <wicket:ommessage key="270" />: <textarea
wicket:id="comment"/>
+ <br/>
</form>
</td>
</tr>
Modified:
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.java
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.java?rev=1391955&r1=1391954&r2=1391955&view=diff
==============================================================================
---
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.java
(original)
+++
incubator/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/admin/ldaps/LdapsPanel.java
Sun Sep 30 07:24:40 2012
@@ -31,6 +31,12 @@ import org.apache.wicket.markup.html.bas
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
+/**
+ * {@link AdminPanel} to list and modify {@link LdapConfig}
+ *
+ * @author swagner
+ *
+ */
public class LdapsPanel extends AdminPanel {
private static final long serialVersionUID = -1L;
@@ -71,7 +77,7 @@ public class LdapsPanel extends AdminPan
});
LdapConfig ldapConfig = new LdapConfig();
- form = new LdapForm("form", ldapConfig);
+ form = new LdapForm("form", listContainer, ldapConfig);
add(form);
}