All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.giavacms.scenario.repository.ScenarioConfigurationRepository Maven / Gradle / Ivy

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;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy