use of fi.otavanopisto.muikku.model.plugins.PluginUserSettingKey in project muikku by otavanopisto.
the class PluginUserSettingKeyDAO method create.
public PluginUserSettingKey create(String plugin, String name) {
PluginUserSettingKey pluginSettingKey = new PluginUserSettingKey();
pluginSettingKey.setName(name);
pluginSettingKey.setPlugin(plugin);
getEntityManager().persist(pluginSettingKey);
return pluginSettingKey;
}
use of fi.otavanopisto.muikku.model.plugins.PluginUserSettingKey in project muikku by otavanopisto.
the class PluginSettingsController method getPluginUserSetting.
public String getPluginUserSetting(String plugin, String name, UserEntity user) {
PluginUserSettingKey key = findPluginUserSettingKey(plugin, name);
if (key == null) {
key = pluginUserSettingKeyDAO.create(plugin, name);
}
PluginUserSetting setting = findPluginUserSetting(key, user);
if (setting != null) {
return setting.getValue();
}
return null;
}
use of fi.otavanopisto.muikku.model.plugins.PluginUserSettingKey in project muikku by otavanopisto.
the class PluginUserSettingKeyDAO method findByPluginAndName.
public PluginUserSettingKey findByPluginAndName(String plugin, String name) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<PluginUserSettingKey> criteria = criteriaBuilder.createQuery(PluginUserSettingKey.class);
Root<PluginUserSettingKey> root = criteria.from(PluginUserSettingKey.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(PluginUserSettingKey_.name), name), criteriaBuilder.equal(root.get(PluginUserSettingKey_.plugin), plugin)));
return getSingleResult(entityManager.createQuery(criteria));
}
use of fi.otavanopisto.muikku.model.plugins.PluginUserSettingKey in project muikku by otavanopisto.
the class PluginSettingsController method setPluginUserSetting.
public void setPluginUserSetting(String plugin, String name, String value, UserEntity user) {
PluginUserSettingKey key = findPluginUserSettingKey(plugin, name);
if (key == null) {
key = pluginUserSettingKeyDAO.create(plugin, name);
}
updatePluginUserSetting(key, value, user);
}
Aggregations