
com.formkiq.server.dao.SystemDaoImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of formkiq-server Show documentation
Show all versions of formkiq-server Show documentation
Server-side integration for the FormKiQ ios application
package com.formkiq.server.dao;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.transform.AliasToBeanResultTransformer;
import org.springframework.stereotype.Repository;
import com.formkiq.server.domain.SystemProperty;
import com.formkiq.server.domain.type.SystemPropertyDTO;
/**
* SystemDao implementation.
*
*/
@Repository
public class SystemDaoImpl extends AbstractDaoImpl implements SystemDao {
@Override
public void delete(final String key) {
SystemProperty property = getEntityManager().find(SystemProperty.class,
key);
if (property != null) {
getEntityManager().remove(property);
}
}
@SuppressWarnings("unchecked")
@Override
public List getProperties() {
String sql = "select p.key as key, p.value as value "
+ " from system_properties p "
+ " order by p.key ";
Session session = getEntityManager().unwrap(Session.class);
List list = session.createSQLQuery(sql)
.setResultTransformer(new AliasToBeanResultTransformer(
SystemPropertyDTO.class))
.list();
return list;
}
@Override
public String getValue(final String key) {
SystemProperty property = getEntityManager().find(SystemProperty.class,
key);
if (property != null) {
return property.getValue();
}
return null;
}
@Override
public SystemProperty save(final SystemProperty property) {
getEntityManager().merge(property);
return property;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy