use of org.apache.openmeetings.db.entity.basic.Configuration in project openmeetings by apache.
the class ConfigsPanel method onInitialize.
@Override
protected void onInitialize() {
SearchableDataView<Configuration> dataView = new SearchableDataView<Configuration>("configList", new SearchableDataProvider<>(ConfigurationDao.class)) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final Item<Configuration> item) {
final Configuration c = item.getModelObject();
item.add(new Label("id"));
item.add(new Label("key"));
item.add(new Label("value"));
item.add(new AjaxEventBehavior(EVT_CLICK) {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
form.hideNewRecord();
form.setModelObject(c);
target.add(form, listContainer);
reinitJs(target);
}
});
item.add(AttributeModifier.replace(ATTR_CLASS, getRowClass(c.getId(), form.getModelObject().getId())));
}
};
add(listContainer.add(dataView).setOutputMarkupId(true));
PagedEntityListPanel navigator = new PagedEntityListPanel("navigator", dataView) {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
target.add(listContainer);
}
};
DataViewContainer<Configuration> container = new DataViewContainer<>(listContainer, dataView, navigator);
container.addLink(new OmOrderByBorder<>("orderById", "id", container)).addLink(new OmOrderByBorder<>("orderByKey", "key", container)).addLink(new OmOrderByBorder<>("orderByValue", "value", container));
add(container.getLinks());
add(navigator);
form = new ConfigForm("form", listContainer, new Configuration());
form.showNewRecord();
add(form);
super.onInitialize();
}
use of org.apache.openmeetings.db.entity.basic.Configuration in project openmeetings by apache.
the class TestLoginUI method testCompleteRegister.
// complex test
@Test
public void testCompleteRegister() throws ReflectiveOperationException, SecurityException {
// set activation properties
List<Configuration> cfgs = cfgDao.get(CONFIG_EMAIL_AT_REGISTER, CONFIG_EMAIL_VERIFICATION);
for (Configuration c : cfgs) {
c.setValueB(true);
cfgDao.update(c, null);
}
try {
tester.startPage(SignInPage.class);
tester.assertRenderedPage(SignInPage.class);
// number uid is used to prevent password validation errors
String uid = String.valueOf(Math.abs(rnd.nextLong()));
performRegister(uid, "warn.notverified");
// activate
User u = userDao.getByLogin(getLogin(uid), User.Type.user, null);
assertNotNull(u);
assertFalse(u.getRights().contains(User.Right.Login));
tester.startPage(ActivatePage.class, new PageParameters().add(ActivatePage.ACTIVATION_PARAM, u.getActivatehash()));
tester.assertRenderedPage(SignInPage.class);
// check activated
u = userDao.getByLogin(getLogin(uid), User.Type.user, null);
assertNotNull(u);
assertNull(u.getActivatehash());
assertTrue(u.getRights().contains(User.Right.Login));
checkLogin(getEmail(uid), userpass);
// logout
Locale loc = tester.getSession().getLocale();
tester.getSession().invalidateNow();
tester.getSession().setLocale(loc);
// forget by 'random'
performForget(uid);
// reset password
u = userDao.getByEmail(getEmail(uid));
assertNotNull(u);
assertNotNull(u.getResethash());
tester.startPage(ResetPage.class, new PageParameters().add(ResetPage.RESET_PARAM, u.getResethash()));
tester.assertRenderedPage(ResetPage.class);
// check reset
String passwd = "q1W@e3r4t5";
FormTester resetTester = tester.newFormTester("resetPassword:form");
resetTester.setValue("password", passwd);
resetTester.setValue("confirmPassword", passwd);
resetTester.submit("submit");
checkErrors(0);
tester.assertLabel("resetPassword:confirmReset:container:message", getEscapedString("332"));
} finally {
for (Configuration c : cfgs) {
c.setValueB(false);
cfgDao.update(c, null);
}
}
}
use of org.apache.openmeetings.db.entity.basic.Configuration in project openmeetings by apache.
the class ConfigurationDao method forceGet.
/**
* Retrieves Configuration regardless of its deleted status
*
* @param key - key of the {@link Configuration} to get
* @return correspondent {@link Configuration} or null
*/
public Configuration forceGet(String key) {
try {
List<Configuration> list = em.createNamedQuery("forceGetConfigurationByKey", Configuration.class).setParameter("key", key).getResultList();
if (list.isEmpty()) {
return null;
}
Configuration c = list.get(0);
return c.getKey().equals(key) ? c : null;
} catch (Exception e) {
log.error("[forceGet]: ", e);
}
return null;
}
use of org.apache.openmeetings.db.entity.basic.Configuration in project openmeetings by apache.
the class TestConfig method getConfigs.
@Test
public void getConfigs() {
try {
List<Configuration> list = cfgDao.get(4, 6);
for (Configuration conf : list) {
log.error("conf.getKey() " + conf.getKey());
log.error("conf.getUser() " + conf.getUser());
if (conf.getUser() != null) {
log.error("conf.getUsers() " + conf.getUser().getLogin());
}
}
assertEquals(list.size(), 6);
} catch (Exception err) {
log.error("[startConversion]", err);
}
}
use of org.apache.openmeetings.db.entity.basic.Configuration in project openmeetings by apache.
the class TestConfig method getConfigKey.
@Test
public void getConfigKey() {
System.err.println("THIS");
Configuration smtp_server = cfgDao.get(CONFIG_SMTP_SERVER);
System.err.println("smtp_server " + smtp_server.getUser());
assertNull(smtp_server.getUser());
}
Aggregations