restructured code
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
package de.muehlencord.shared.account.business.account;
|
||||
package de.muehlencord.shared.account.business.account.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.business.ConfigService;
|
||||
import de.muehlencord.shared.account.business.mail.MailException;
|
||||
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.business.account.entity.AccountException;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountStatus;
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.mail.entity.MailException;
|
||||
import de.muehlencord.shared.account.business.mail.boundary.MailService;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.util.SecurityUtil;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@ -1,6 +1,7 @@
|
||||
package de.muehlencord.shared.account.business.account;
|
||||
package de.muehlencord.shared.account.business.account.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountException;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationPermissionEntity;
|
||||
import java.io.Serializable;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.persistence.EntityManager;
|
||||
@ -3,10 +3,11 @@
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.account.business.account;
|
||||
package de.muehlencord.shared.account.business.account.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountException;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.ApplicationRoleEntity;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -3,7 +3,7 @@
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.account.entity;
|
||||
package de.muehlencord.shared.account.business.account.entity;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
package de.muehlencord.shared.account.business.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.business.account;
|
||||
package de.muehlencord.shared.account.business.account.entity;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -23,7 +23,7 @@ public class AccountException extends Exception {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
AccountException(String entity_updated__deleted_please_reload, boolean b) {
|
||||
public AccountException(String entity_updated__deleted_please_reload, boolean b) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
package de.muehlencord.shared.account.business.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.business.account;
|
||||
package de.muehlencord.shared.account.business.account.entity;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
package de.muehlencord.shared.account.business.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
package de.muehlencord.shared.account.business.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@ -3,7 +3,7 @@
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.account.configuration;
|
||||
package de.muehlencord.shared.account.business.accountcounfig.entity;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -3,7 +3,7 @@
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.account.configuration;
|
||||
package de.muehlencord.shared.account.business.accountcounfig.entity;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@ -1,6 +1,6 @@
|
||||
package de.muehlencord.shared.account.business;
|
||||
package de.muehlencord.shared.account.business.config.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.entity.ConfigEntity;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigEntity;
|
||||
import java.io.Serializable;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.Singleton;
|
||||
@ -42,11 +42,23 @@ public class ConfigService implements Serializable {
|
||||
}
|
||||
|
||||
/* *** getter *** */
|
||||
// FIXME remove, this is application specific
|
||||
/**
|
||||
* FIXME remove, this is application specific
|
||||
* @return
|
||||
* @deprecated replace by getConfigValue ("storage.path")
|
||||
*/
|
||||
@Deprecated
|
||||
public String getStoragePath() {
|
||||
return storagePath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* // TODO move to accountControl
|
||||
* @return
|
||||
* @deprecated replace by getConfigValue ("account.maxFailedLogins")
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMaxFailedLogins() {
|
||||
return maxFailedLogins;
|
||||
}
|
||||
@ -1,11 +1,14 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
package de.muehlencord.shared.account.business.config.entity;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.QueryHint;
|
||||
@ -21,25 +24,24 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "config")
|
||||
@XmlRootElement
|
||||
@Cacheable(true)
|
||||
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL, region = "Configuration")
|
||||
@NamedQueries({
|
||||
@Table(name = "config")
|
||||
@XmlRootElement
|
||||
@Cacheable(true)
|
||||
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL, region = "Configuration")
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "ConfigEntity.findAll", query = "SELECT c FROM ConfigEntity c ORDER BY c.configKey",
|
||||
hints = {
|
||||
@QueryHint(name = "org.hibernate.cacheable", value = "true")
|
||||
, @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})
|
||||
, @NamedQuery(name = "ConfigEntity.findByConfigKey", query = "SELECT c FROM ConfigEntity c WHERE c.configKey = :configKey",
|
||||
@QueryHint(name = "org.hibernate.cacheable", value = "true"),
|
||||
@QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
|
||||
@NamedQuery(name = "ConfigEntity.findByConfigKey", query = "SELECT c FROM ConfigEntity c WHERE c.configKey = :configKey",
|
||||
hints = {
|
||||
@QueryHint(name = "org.hibernate.cacheable", value = "true")
|
||||
, @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})
|
||||
|
||||
, @NamedQuery(name = "ConfigEntity.findByConfigValue", query = "SELECT c FROM ConfigEntity c WHERE c.configValue = :configValue",
|
||||
@QueryHint(name = "org.hibernate.cacheable", value = "true"),
|
||||
@QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
|
||||
@NamedQuery(name = "ConfigEntity.findByConfigValue", query = "SELECT c FROM ConfigEntity c WHERE c.configValue = :configValue",
|
||||
hints = {
|
||||
@QueryHint(name = "org.hibernate.cacheable", value = "true")
|
||||
, @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})
|
||||
})
|
||||
@QueryHint(name = "org.hibernate.cacheable", value = "true"),
|
||||
@QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})
|
||||
})
|
||||
|
||||
public class ConfigEntity implements Serializable {
|
||||
|
||||
@ -51,6 +53,14 @@ public class ConfigEntity implements Serializable {
|
||||
@Size(min = 1, max = 100)
|
||||
@Column(name = "config_key")
|
||||
private String configKey;
|
||||
@Basic(optional = true)
|
||||
@Size(min = 1, max = 200)
|
||||
@Column(name = "config_key_group")
|
||||
private String configKeyGroup;
|
||||
@JoinColumn(name = "config_key_account", referencedColumnName = "id")
|
||||
@ManyToOne(optional = true)
|
||||
private AccountEntity configKeyAccount;
|
||||
|
||||
@Size(max = 200)
|
||||
@Column(name = "config_value")
|
||||
private String configValue;
|
||||
@ -75,6 +85,22 @@ public class ConfigEntity implements Serializable {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public String getConfigKeyGroup() {
|
||||
return configKeyGroup;
|
||||
}
|
||||
|
||||
public void setConfigKeyGroup(String configKeyGroup) {
|
||||
this.configKeyGroup = configKeyGroup;
|
||||
}
|
||||
|
||||
public AccountEntity getConfigKeyAccount() {
|
||||
return configKeyAccount;
|
||||
}
|
||||
|
||||
public void setConfigKeyAccount(AccountEntity configKeyAccount) {
|
||||
this.configKeyAccount = configKeyAccount;
|
||||
}
|
||||
|
||||
public String getConfigValue() {
|
||||
return configValue;
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
package de.muehlencord.shared.account.business.mail;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Basic;
|
||||
@ -1,7 +1,10 @@
|
||||
package de.muehlencord.shared.account.business.mail;
|
||||
package de.muehlencord.shared.account.business.mail.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.configuration.AccountConfigurationKey;
|
||||
import de.muehlencord.shared.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.mail.entity.MailTemplateException;
|
||||
import de.muehlencord.shared.account.business.accountcounfig.entity.AccountConfigurationKey;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.mail.entity.MailDatamodel;
|
||||
import de.muehlencord.shared.account.business.mail.entity.MailException;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Resource;
|
||||
@ -19,7 +22,7 @@ import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.internet.MimeMultipart;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import de.muehlencord.shared.account.configuration.AccountConfigurationValue;
|
||||
import de.muehlencord.shared.account.business.accountcounfig.entity.AccountConfigurationValue;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@ -1,6 +1,8 @@
|
||||
package de.muehlencord.shared.account.business.mail;
|
||||
package de.muehlencord.shared.account.business.mail.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.entity.MailTemplateEntity;
|
||||
import de.muehlencord.shared.account.business.mail.entity.MailDatamodel;
|
||||
import de.muehlencord.shared.account.business.mail.entity.MailTemplateException;
|
||||
import de.muehlencord.shared.account.business.mail.MailTemplateEntity;
|
||||
import freemarker.cache.StringTemplateLoader;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
@ -1,6 +1,6 @@
|
||||
package de.muehlencord.shared.account.business.mail;
|
||||
package de.muehlencord.shared.account.business.mail.entity;
|
||||
|
||||
import de.muehlencord.shared.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.business.mail;
|
||||
package de.muehlencord.shared.account.business.mail.entity;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1,4 +1,4 @@
|
||||
package de.muehlencord.shared.account.business.mail;
|
||||
package de.muehlencord.shared.account.business.mail.entity;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1,7 +1,7 @@
|
||||
package de.muehlencord.shared.account.ui;
|
||||
package de.muehlencord.shared.account.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.AccountControl;
|
||||
import de.muehlencord.shared.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.account.boundary.AccountControl;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@ -1,6 +1,6 @@
|
||||
package de.muehlencord.shared.account.ui;
|
||||
package de.muehlencord.shared.account.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.AccountControl;
|
||||
import de.muehlencord.shared.account.business.account.boundary.AccountControl;
|
||||
import de.muehlencord.shared.jeeutil.FacesUtil;
|
||||
import java.io.Serializable;
|
||||
import javax.ejb.EJB;
|
||||
@ -1,7 +1,8 @@
|
||||
|
||||
package de.muehlencord.shared.account.business;
|
||||
package de.muehlencord.shared.account.business.config.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.entity.ConfigEntity;
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigEntity;
|
||||
import javax.persistence.EntityManager;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
Reference in New Issue
Block a user