org.giavacms.scenario.repository.ScenarioConfigurationRepository Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scenario Show documentation
Show all versions of scenario Show documentation
GiavaCMS Content Management System: Scenario Module
The newest version!
package org.giavacms.scenario.repository;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.giavacms.common.repository.AbstractRepository;
import org.giavacms.scenario.model.ScenarioConfiguration;
@Named
@Stateless
@LocalBean
public class ScenarioConfigurationRepository extends
AbstractRepository {
private static final long serialVersionUID = 1L;
@PersistenceContext
EntityManager em;
@Override
protected EntityManager getEm() {
return em;
}
@Override
public void setEm(EntityManager em) {
this.em = em;
}
@Override
protected String getDefaultOrderBy() {
// TODO Auto-generated method stub
return "id asc";
}
public ScenarioConfiguration load() {
ScenarioConfiguration c = null;
try {
c = find(1L);
} catch (Exception e) {
}
if (c == null) {
c = new ScenarioConfiguration();
c.setResize(false);
c.setMaxWidthOrHeight(0);
persist(c);
}
return c;
}
}