migrated persisteance context to CDI injections
This commit is contained in:
@ -5,8 +5,8 @@ import java.io.Serializable;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.Singleton;
|
||||
import javax.ejb.Startup;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -18,7 +18,7 @@ public class ConfigService implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3195224653632853003L;
|
||||
|
||||
@PersistenceContext
|
||||
@Inject
|
||||
EntityManager em;
|
||||
|
||||
private String storagePath = null;
|
||||
|
||||
@ -6,14 +6,15 @@ import de.muehlencord.shared.account.business.mail.MailService;
|
||||
import de.muehlencord.shared.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.util.SecurityUtil;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.ejb.EJB;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import javax.transaction.Transactional;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
@ -27,9 +28,10 @@ import org.apache.shiro.subject.Subject;
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Stateless
|
||||
public class AccountControl {
|
||||
public class AccountControl implements Serializable {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AccountControl.class.getName());
|
||||
private static final long serialVersionUID = 3424816272598108101L;
|
||||
|
||||
@EJB
|
||||
private ConfigService configService;
|
||||
@ -37,7 +39,7 @@ public class AccountControl {
|
||||
@EJB
|
||||
private MailService mailService;
|
||||
|
||||
@PersistenceContext
|
||||
@Inject
|
||||
EntityManager em;
|
||||
|
||||
public List<AccountEntity> getAccounts() {
|
||||
|
||||
@ -20,13 +20,16 @@ import javax.mail.internet.MimeMultipart;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import de.muehlencord.shared.account.configuration.AccountConfigurationValue;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Stateless
|
||||
public class MailService {
|
||||
public class MailService implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1937218474908356747L;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MailService.class);
|
||||
|
||||
|
||||
@ -5,11 +5,12 @@ import freemarker.cache.StringTemplateLoader;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateExceptionHandler;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -19,11 +20,13 @@ import org.slf4j.LoggerFactory;
|
||||
* @author jomu
|
||||
*/
|
||||
@Stateless
|
||||
public class MailTemplateService {
|
||||
public class MailTemplateService implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -136113381443058697L;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MailTemplateService.class.getName());
|
||||
|
||||
@PersistenceContext
|
||||
@Inject
|
||||
EntityManager em;
|
||||
|
||||
public String getStringFromTemplate(String templateName, MailDatamodel dataModel) throws MailTemplateException {
|
||||
|
||||
Reference in New Issue
Block a user