updated datamodel, introduced UUID as primary key
This commit is contained in:
@ -55,6 +55,11 @@
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -66,9 +71,11 @@
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<ejbVersion>3.1</ejbVersion>
|
||||
<excludes>
|
||||
<exclude>**/persistence.xml</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@ -12,12 +12,15 @@ DROP TABLE application_permission;
|
||||
|
||||
|
||||
CREATE TABLE application_role (
|
||||
id UUID NOT NULL,
|
||||
role_name varchar(80) NOT NULL,
|
||||
role_description varchar(200) NOT NULL,
|
||||
CONSTRAINT pk_application_role_pk PRIMARY KEY (role_name)
|
||||
CONSTRAINT pk_application_role_pk PRIMARY KEY (id),
|
||||
CONSTRAINT uidx_application_id UNIQUE (id)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE account (
|
||||
id UUID NOT NULL,
|
||||
username varchar(32) NOT NULL,
|
||||
emailaddress varchar(200) NOT NULL,
|
||||
firstname varchar(100) NOT NULL,
|
||||
@ -34,50 +37,55 @@ CREATE TABLE account (
|
||||
created_by varchar(32) NOT NULL,
|
||||
last_updated_on timestamp with time zone NOT NULL DEFAULT (now() at time zone 'utc'),
|
||||
last_updated_by varchar(32) NOT NULL,
|
||||
CONSTRAINT pk_account PRIMARY KEY (username)
|
||||
CONSTRAINT pk_account PRIMARY KEY (id),
|
||||
CONSTRAINT uidx_username UNIQUE (username)
|
||||
);
|
||||
|
||||
CREATE TABLE account_history (
|
||||
id SERIAL NOT NULL,
|
||||
username varchar(32) NOT NULL,
|
||||
id UUID NOT NULL,
|
||||
account_id UUID NOT NULL,
|
||||
message varchar(200),
|
||||
failure_count int NOT NULL DEFAULT 0,
|
||||
status varchar(20) NOT NULL, -- constants needed, after action - new, init, active, blocked, inactive, marked for deletion
|
||||
last_updated_on timestamp with time zone NOT NULL DEFAULT (now() at time zone 'utc'),
|
||||
last_updated_by varchar(32) NOT NULL,
|
||||
CONSTRAINT pk_account_history PRIMARY KEY (id),
|
||||
CONSTRAINT fk_account_history_username_fk FOREIGN KEY (username) REFERENCES account (username)
|
||||
CONSTRAINT fk_account_history_username_fk FOREIGN KEY (account_id) REFERENCES account (id)
|
||||
);
|
||||
|
||||
CREATE TABLE account_role (
|
||||
username varchar(32) NOT NULL,
|
||||
role_name varchar(80) NOT NULL,
|
||||
CONSTRAINT pk_account_role PRIMARY KEY (username, role_name),
|
||||
CONSTRAINT fk_account_role_account FOREIGN KEY (username) REFERENCES account(username),
|
||||
CONSTRAINT fk_account_role_role_name FOREIGN KEY (role_name) REFERENCES application_role(role_name)
|
||||
account UUID NOT NULL,
|
||||
account_role UUID NOT NULL,
|
||||
CONSTRAINT pk_account_role PRIMARY KEY (account, account_role),
|
||||
CONSTRAINT fk_account_role_account FOREIGN KEY (account) REFERENCES account(id),
|
||||
CONSTRAINT fk_account_role_role_name FOREIGN KEY (account_role) REFERENCES application_role(id)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE application_permission (
|
||||
id UUID NOT NULL,
|
||||
permission_name varchar(80) NOT NULL,
|
||||
permission_description varchar(200) NOT NULL,
|
||||
CONSTRAINT application_permission_pk PRIMARY KEY (permission_name)
|
||||
CONSTRAINT pk_application_permission PRIMARY KEY (id),
|
||||
CONSTRAINT uidx_application_permission_name UNIQUE (permission_name)
|
||||
);
|
||||
|
||||
CREATE TABLE role_permission (
|
||||
role_name varchar(80) NOT NULL,
|
||||
permission_name varchar(80) NOT NULL,
|
||||
CONSTRAINT pk_role_permission_role_permission_name PRIMARY KEY (role_name, permission_name),
|
||||
CONSTRAINT fk_role_permission_role_name FOREIGN KEY (role_name) REFERENCES application_role(role_name),
|
||||
CONSTRAINT fk_role_permission_permission_name FOREIGN KEY (permission_name) REFERENCES application_permission(permission_name)
|
||||
application_role UUID NOT NULL,
|
||||
role_permission UUID NOT NULL,
|
||||
CONSTRAINT pk_role_permission_role_permission_name PRIMARY KEY (application_role, role_permission),
|
||||
CONSTRAINT fk_role_permission_application_role FOREIGN KEY (application_role) REFERENCES application_role(id),
|
||||
CONSTRAINT fk_role_permission_role_permission FOREIGN KEY (role_permission) REFERENCES application_permission(id)
|
||||
);
|
||||
|
||||
INSERT INTO application_permission (permission_name, permission_description) values ('test:view', 'Display test view');
|
||||
INSERT INTO application_permission (id, permission_name, permission_description) values ('dfd0f8f1-4a51-4fdc-9a1c-a942bee9b649', 'test:view', 'Display test view');
|
||||
|
||||
INSERT INTO application_role (role_name, role_description) values ('Admin', 'Admin role');
|
||||
INSERT INTO application_role (role_name, role_description) values ('User', 'Standard user role');
|
||||
INSERT INTO application_role (id, role_name, role_description) values ('5cd0aca0-5466-483d-8f3e-c369f8061131','Admin', 'Admin role');
|
||||
INSERT INTO application_role (id, role_name, role_description) values ('da30060e-fd23-4016-a506-4e12e9322148', 'User', 'Standard user role');
|
||||
|
||||
-- INSERT INTO role_permission (role_name, permission_name) values ('Admin','test:view');
|
||||
|
||||
INSERT INTO account (username, emailaddress, firstname, lastname, account_password, created_by, last_updated_by) values('admin', 'joern@muehlencord.de', 'Joern', 'Muehlencord','$shiro1$SHA-256$500000$4bHPNH9k539UjdFLgm/HOA==$T/n8skgoGSOtNw/c9ScDlXCiGrx2cZF0Esrvf6WPq6g=', 'admin','admin'); --admin/secret
|
||||
INSERT INTO account_role (username, role_name) values ('admin', 'Admin');
|
||||
INSERT INTO account (id, username, emailaddress, firstname, lastname, account_password, created_by, last_updated_by) values('ab5c8337-6872-4aea-a9b9-78ea63706b8f','admin', 'joern@muehlencord.de', 'Joern', 'Muehlencord','$shiro1$SHA-256$500000$4bHPNH9k539UjdFLgm/HOA==$T/n8skgoGSOtNw/c9ScDlXCiGrx2cZF0Esrvf6WPq6g=', 'admin','admin'); --admin/secret
|
||||
INSERT INTO account_role (account, account_role) values ('ab5c8337-6872-4aea-a9b9-78ea63706b8f', '5cd0aca0-5466-483d-8f3e-c369f8061131');
|
||||
|
||||
--select uuid_generate_v4();
|
||||
@ -4,7 +4,7 @@ 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.RoleEntity;
|
||||
import de.muehlencord.shared.account.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.util.SecurityUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@ -50,7 +50,7 @@ public class AccountControl {
|
||||
StringBuilder queryBuilder = new StringBuilder();
|
||||
queryBuilder.append("SELECT a FROM AccountEntity a ");
|
||||
if (loadRoles) {
|
||||
queryBuilder.append("JOIN FETCH a.roleEntityList ");
|
||||
queryBuilder.append("JOIN FETCH a.applicationRoleList ");
|
||||
}
|
||||
queryBuilder.append("WHERE a.username = :username");
|
||||
Query query = em.createQuery(queryBuilder.toString());
|
||||
@ -93,21 +93,21 @@ public class AccountControl {
|
||||
|
||||
// load Admin or User role from database
|
||||
String roleName = (isAdmin ? "Admin" : "User");
|
||||
Query roleQuery = em.createNamedQuery("RoleEntity.findByRoleName");
|
||||
Query roleQuery = em.createNamedQuery("ApplicationRole.findByRoleName");
|
||||
roleQuery.setParameter("roleName", roleName);
|
||||
RoleEntity role = (RoleEntity) roleQuery.getSingleResult();
|
||||
ApplicationRoleEntity role = (ApplicationRoleEntity) roleQuery.getSingleResult();
|
||||
|
||||
if (role != null) {
|
||||
// add new user add required role
|
||||
// do not request based on newUser variable; this way existing users with missing role (for whatever reason)
|
||||
// will be fixed automatically
|
||||
if (account.getRoleEntityList() == null || account.getRoleEntityList().isEmpty()) {
|
||||
account.setRoleEntityList(new ArrayList<>());
|
||||
account.getRoleEntityList().add(role);
|
||||
if (account.getApplicationRoleList() == null || account.getApplicationRoleList().isEmpty()) {
|
||||
account.setApplicationRoleList(new ArrayList<>());
|
||||
account.getApplicationRoleList().add(role);
|
||||
em.merge(account);
|
||||
LOGGER.info("Added role " + roleName + " to user " + account.getUsername());
|
||||
|
||||
} else if (!account.getRoleEntityList().get(0).equals(role)) {
|
||||
} else if (!account.getApplicationRoleList().get(0).equals(role)) {
|
||||
// change role from User to Admin and vice versa
|
||||
// user already exists, has existing role
|
||||
// check if existing role is different from current role and change it
|
||||
@ -115,8 +115,8 @@ public class AccountControl {
|
||||
// he is either User or Admin
|
||||
// TODO add "UserRole" to every user, make this default Role configurable
|
||||
// TODO add AdminRole in addtion if needed
|
||||
account.getRoleEntityList().remove(0);
|
||||
account.getRoleEntityList().add(role);
|
||||
account.getApplicationRoleList().remove(0);
|
||||
account.getApplicationRoleList().add(role);
|
||||
em.merge(account);
|
||||
LOGGER.info("Switched role of user " + account.getUsername() + " to " + roleName);
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import de.muehlencord.shared.account.entity.AccountEntity;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Resource;
|
||||
import javax.ejb.EJB;
|
||||
import javax.ejb.Stateless;
|
||||
@ -38,8 +39,8 @@ public class MailService {
|
||||
}
|
||||
|
||||
public void sendTestHtmlEmail(String recipient) throws MailException {
|
||||
Date now = new Date();
|
||||
AccountEntity account = new AccountEntity("joern.muehlencord", "joern@muehlencord.de", "Jörn", "Mühlencord", "secret", 0, "NEW", now, "admin", now, "admin");
|
||||
Date now = new Date();
|
||||
AccountEntity account = new AccountEntity(UUID.randomUUID(), "joern.muehlencord", "joern@muehlencord.de", "Jörn", "Mühlencord", "secret", 0, "NEW", false, now, "admin", now, "admin");
|
||||
MailDatamodel dataModel = new MailDatamodel(account);
|
||||
dataModel.addParameter("url", "http://url.de");
|
||||
dataModel.addParameter("resetUrl", "http://reseturl.de");
|
||||
|
||||
@ -3,10 +3,12 @@ package de.muehlencord.shared.account.entity;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
@ -21,6 +23,8 @@ import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -40,6 +44,9 @@ import javax.xml.bind.annotation.XmlTransient;
|
||||
@NamedQuery(name = "AccountEntity.findByLastFailedLogin", query = "SELECT a FROM AccountEntity a WHERE a.lastFailedLogin = :lastFailedLogin"),
|
||||
@NamedQuery(name = "AccountEntity.findByFailureCount", query = "SELECT a FROM AccountEntity a WHERE a.failureCount = :failureCount"),
|
||||
@NamedQuery(name = "AccountEntity.findByStatus", query = "SELECT a FROM AccountEntity a WHERE a.status = :status"),
|
||||
@NamedQuery(name = "AccountEntity.findByPasswordResetOngoing", query = "SELECT a FROM AccountEntity a WHERE a.passwordResetOngoing = :passwordResetOngoing"),
|
||||
@NamedQuery(name = "AccountEntity.findByPasswordResetValidTo", query = "SELECT a FROM AccountEntity a WHERE a.passwordResetValidTo = :passwordResetValidTo"),
|
||||
@NamedQuery(name = "AccountEntity.findByPasswordResetHash", query = "SELECT a FROM AccountEntity a WHERE a.passwordResetHash = :passwordResetHash"),
|
||||
@NamedQuery(name = "AccountEntity.findByCreatedOn", query = "SELECT a FROM AccountEntity a WHERE a.createdOn = :createdOn"),
|
||||
@NamedQuery(name = "AccountEntity.findByCreatedBy", query = "SELECT a FROM AccountEntity a WHERE a.createdBy = :createdBy"),
|
||||
@NamedQuery(name = "AccountEntity.findByLastUpdatedOn", query = "SELECT a FROM AccountEntity a WHERE a.lastUpdatedOn = :lastUpdatedOn"),
|
||||
@ -50,6 +57,13 @@ public class AccountEntity implements Serializable {
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "uuid2")
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Type(type = "pg-uuid")
|
||||
private UUID id;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 32)
|
||||
@Column(name = "username")
|
||||
private String username;
|
||||
@ -119,22 +133,22 @@ public class AccountEntity implements Serializable {
|
||||
@Column(name = "last_updated_by")
|
||||
private String lastUpdatedBy;
|
||||
@JoinTable(name = "account_role", joinColumns = {
|
||||
@JoinColumn(name = "username", referencedColumnName = "username")}, inverseJoinColumns = {
|
||||
@JoinColumn(name = "role_name", referencedColumnName = "role_name")})
|
||||
@JoinColumn(name = "account", referencedColumnName = "id")}, inverseJoinColumns = {
|
||||
@JoinColumn(name = "account_role", referencedColumnName = "id")})
|
||||
@ManyToMany
|
||||
private List<RoleEntity> roleEntityList;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "username")
|
||||
private List<AccountHistoryEntity> accountHistoryEntityList;
|
||||
private List<ApplicationRoleEntity> applicationRoleList;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "accountId")
|
||||
private List<AccountHistoryEntity> accountHistoryList;
|
||||
|
||||
public AccountEntity() {
|
||||
// empty constructor needed for JPA handling, do not remove
|
||||
}
|
||||
|
||||
public AccountEntity(String username) {
|
||||
this.username = username;
|
||||
public AccountEntity(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public AccountEntity(String username, String emailaddress, String firstname, String lastname, String accountPassword, int failureCount, String status, Date createdOn, String createdBy, Date lastUpdatedOn, String lastUpdatedBy) {
|
||||
public AccountEntity(UUID id, String username, String emailaddress, String firstname, String lastname, String accountPassword, int failureCount, String status, boolean passwordResetOngoing, Date createdOn, String createdBy, Date lastUpdatedOn, String lastUpdatedBy) {
|
||||
this.id = id;
|
||||
this.username = username;
|
||||
this.emailaddress = emailaddress;
|
||||
this.firstname = firstname;
|
||||
@ -142,12 +156,21 @@ public class AccountEntity implements Serializable {
|
||||
this.accountPassword = accountPassword;
|
||||
this.failureCount = failureCount;
|
||||
this.status = status;
|
||||
this.passwordResetOngoing = passwordResetOngoing;
|
||||
this.createdOn = createdOn;
|
||||
this.createdBy = createdBy;
|
||||
this.lastUpdatedOn = lastUpdatedOn;
|
||||
this.lastUpdatedBy = lastUpdatedBy;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
@ -277,27 +300,27 @@ public class AccountEntity implements Serializable {
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<RoleEntity> getRoleEntityList() {
|
||||
return roleEntityList;
|
||||
public List<ApplicationRoleEntity> getApplicationRoleList() {
|
||||
return applicationRoleList;
|
||||
}
|
||||
|
||||
public void setRoleEntityList(List<RoleEntity> roleEntityList) {
|
||||
this.roleEntityList = roleEntityList;
|
||||
public void setApplicationRoleList(List<ApplicationRoleEntity> applicationRoleList) {
|
||||
this.applicationRoleList = applicationRoleList;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<AccountHistoryEntity> getAccountHistoryEntityList() {
|
||||
return accountHistoryEntityList;
|
||||
public List<AccountHistoryEntity> getAccountHistoryList() {
|
||||
return accountHistoryList;
|
||||
}
|
||||
|
||||
public void setAccountHistoryEntityList(List<AccountHistoryEntity> accountHistoryEntityList) {
|
||||
this.accountHistoryEntityList = accountHistoryEntityList;
|
||||
public void setAccountHistoryList(List<AccountHistoryEntity> accountHistoryList) {
|
||||
this.accountHistoryList = accountHistoryList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (username != null ? username.hashCode() : 0);
|
||||
hash += (id != null ? id.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@ -308,7 +331,7 @@ public class AccountEntity implements Serializable {
|
||||
return false;
|
||||
}
|
||||
AccountEntity other = (AccountEntity) object;
|
||||
if ((this.username == null && other.username != null) || (this.username != null && !this.username.equals(other.username))) {
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -316,7 +339,7 @@ public class AccountEntity implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.ssg.entity.AccountEntity[ username=" + username + " ]";
|
||||
return "de.muehlencord.shared.account.entity.Account[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package de.muehlencord.shared.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@ -18,6 +19,8 @@ import javax.persistence.TemporalType;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -38,10 +41,13 @@ public class AccountHistoryEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@GeneratedValue(generator = "uuid2")
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Type(type = "pg-uuid")
|
||||
private UUID id;
|
||||
@Size(max = 200)
|
||||
@Column(name = "message")
|
||||
private String message;
|
||||
@ -64,18 +70,18 @@ public class AccountHistoryEntity implements Serializable {
|
||||
@Size(min = 1, max = 32)
|
||||
@Column(name = "last_updated_by")
|
||||
private String lastUpdatedBy;
|
||||
@JoinColumn(name = "username", referencedColumnName = "username")
|
||||
@JoinColumn(name = "account_id", referencedColumnName = "id")
|
||||
@ManyToOne(optional = false)
|
||||
private AccountEntity username;
|
||||
private AccountEntity accountId;
|
||||
|
||||
public AccountHistoryEntity() {
|
||||
}
|
||||
|
||||
public AccountHistoryEntity(Integer id) {
|
||||
public AccountHistoryEntity(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public AccountHistoryEntity(Integer id, int failureCount, String status, Date lastUpdatedOn, String lastUpdatedBy) {
|
||||
public AccountHistoryEntity(UUID id, int failureCount, String status, Date lastUpdatedOn, String lastUpdatedBy) {
|
||||
this.id = id;
|
||||
this.failureCount = failureCount;
|
||||
this.status = status;
|
||||
@ -83,11 +89,11 @@ public class AccountHistoryEntity implements Serializable {
|
||||
this.lastUpdatedBy = lastUpdatedBy;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -131,12 +137,12 @@ public class AccountHistoryEntity implements Serializable {
|
||||
this.lastUpdatedBy = lastUpdatedBy;
|
||||
}
|
||||
|
||||
public AccountEntity getUsername() {
|
||||
return username;
|
||||
public AccountEntity getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setUsername(AccountEntity username) {
|
||||
this.username = username;
|
||||
public void setAccountId(AccountEntity accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,7 +167,7 @@ public class AccountHistoryEntity implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.ssg.entity.AccountHistoryEntity[ id=" + id + " ]";
|
||||
return "de.muehlencord.shared.account.entity.AccountHistory[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "application_permission")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "ApplicationPermissionEntity.findAll", query = "SELECT a FROM ApplicationPermissionEntity a"),
|
||||
@NamedQuery(name = "ApplicationPermissionEntity.findByPermissionName", query = "SELECT a FROM ApplicationPermissionEntity a WHERE a.permissionName = :permissionName"),
|
||||
@NamedQuery(name = "ApplicationPermissionEntity.findByPermissionDescription", query = "SELECT a FROM ApplicationPermissionEntity a WHERE a.permissionDescription = :permissionDescription")})
|
||||
public class ApplicationPermissionEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8985982754544829534L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "uuid2")
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Type(type = "pg-uuid")
|
||||
private UUID id;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 80)
|
||||
@Column(name = "permission_name")
|
||||
private String permissionName;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 200)
|
||||
@Column(name = "permission_description")
|
||||
private String permissionDescription;
|
||||
@ManyToMany(mappedBy = "applicationPermissionList")
|
||||
private List<ApplicationRoleEntity> applicationRoleList;
|
||||
|
||||
public ApplicationPermissionEntity() {
|
||||
}
|
||||
|
||||
public ApplicationPermissionEntity(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ApplicationPermissionEntity(UUID id, String permissionName, String permissionDescription) {
|
||||
this.id = id;
|
||||
this.permissionName = permissionName;
|
||||
this.permissionDescription = permissionDescription;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPermissionName() {
|
||||
return permissionName;
|
||||
}
|
||||
|
||||
public void setPermissionName(String permissionName) {
|
||||
this.permissionName = permissionName;
|
||||
}
|
||||
|
||||
public String getPermissionDescription() {
|
||||
return permissionDescription;
|
||||
}
|
||||
|
||||
public void setPermissionDescription(String permissionDescription) {
|
||||
this.permissionDescription = permissionDescription;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<ApplicationRoleEntity> getApplicationRoleList() {
|
||||
return applicationRoleList;
|
||||
}
|
||||
|
||||
public void setApplicationRoleList(List<ApplicationRoleEntity> applicationRoleList) {
|
||||
this.applicationRoleList = applicationRoleList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (id != null ? id.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||
if (!(object instanceof ApplicationPermissionEntity)) {
|
||||
return false;
|
||||
}
|
||||
ApplicationPermissionEntity other = (ApplicationPermissionEntity) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.shared.account.entity.ApplicationPermission[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,147 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "application_role")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "ApplicationRoleEntity.findAll", query = "SELECT a FROM ApplicationRoleEntity a"),
|
||||
@NamedQuery(name = "ApplicationRoleEntity.findByRoleName", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.roleName = :roleName"),
|
||||
@NamedQuery(name = "ApplicationRoleEntity.findByRoleDescription", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.roleDescription = :roleDescription")})
|
||||
public class ApplicationRoleEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8324054525780893823L;
|
||||
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "uuid2")
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Type(type = "pg-uuid")
|
||||
private UUID id;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 80)
|
||||
@Column(name = "role_name")
|
||||
private String roleName;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 200)
|
||||
@Column(name = "role_description")
|
||||
private String roleDescription;
|
||||
@ManyToMany(mappedBy = "applicationRoleList")
|
||||
private List<AccountEntity> accountList;
|
||||
@JoinTable(name = "role_permission", joinColumns = {
|
||||
@JoinColumn(name = "application_role", referencedColumnName = "id")}, inverseJoinColumns = {
|
||||
@JoinColumn(name = "role_permission", referencedColumnName = "id")})
|
||||
@ManyToMany
|
||||
private List<ApplicationPermissionEntity> applicationPermissionList;
|
||||
|
||||
public ApplicationRoleEntity() {
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ApplicationRoleEntity(UUID id, String roleName, String roleDescription) {
|
||||
this.id = id;
|
||||
this.roleName = roleName;
|
||||
this.roleDescription = roleDescription;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRoleName() {
|
||||
return roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
public String getRoleDescription() {
|
||||
return roleDescription;
|
||||
}
|
||||
|
||||
public void setRoleDescription(String roleDescription) {
|
||||
this.roleDescription = roleDescription;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<AccountEntity> getAccountList() {
|
||||
return accountList;
|
||||
}
|
||||
|
||||
public void setAccountList(List<AccountEntity> accountList) {
|
||||
this.accountList = accountList;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<ApplicationPermissionEntity> getApplicationPermissionList() {
|
||||
return applicationPermissionList;
|
||||
}
|
||||
|
||||
public void setApplicationPermissionList(List<ApplicationPermissionEntity> applicationPermissionList) {
|
||||
this.applicationPermissionList = applicationPermissionList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (id != null ? id.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||
if (!(object instanceof ApplicationRoleEntity)) {
|
||||
return false;
|
||||
}
|
||||
ApplicationRoleEntity other = (ApplicationRoleEntity) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.shared.account.entity.ApplicationRole[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,92 +1,87 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jomu
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "config")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "ConfigEntity.findAll", query = "SELECT c FROM ConfigEntity c"),
|
||||
@NamedQuery(name = "ConfigEntity.findByConfigKey", query = "SELECT c FROM ConfigEntity c WHERE c.configKey = :configKey"),
|
||||
@NamedQuery(name = "ConfigEntity.findByConfigValue", query = "SELECT c FROM ConfigEntity c WHERE c.configValue = :configValue")})
|
||||
public class ConfigEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 100)
|
||||
@Column(name = "config_key")
|
||||
private String configKey;
|
||||
@Size(max = 200)
|
||||
@Column(name = "config_value")
|
||||
private String configValue;
|
||||
|
||||
public ConfigEntity() {
|
||||
}
|
||||
|
||||
public ConfigEntity(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public String getConfigKey() {
|
||||
return configKey;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public String getConfigValue() {
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public void setConfigValue(String configValue) {
|
||||
this.configValue = configValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (configKey != null ? configKey.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||
if (!(object instanceof ConfigEntity)) {
|
||||
return false;
|
||||
}
|
||||
ConfigEntity other = (ConfigEntity) object;
|
||||
if ((this.configKey == null && other.configKey != null) || (this.configKey != null && !this.configKey.equals(other.configKey))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.ssg.entity.ConfigEntity[ configKey=" + configKey + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
package de.muehlencord.shared.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "config")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "ConfigEntity.findAll", query = "SELECT c FROM ConfigEntity c"),
|
||||
@NamedQuery(name = "ConfigEntity.findByConfigKey", query = "SELECT c FROM ConfigEntity c WHERE c.configKey = :configKey"),
|
||||
@NamedQuery(name = "ConfigEntity.findByConfigValue", query = "SELECT c FROM ConfigEntity c WHERE c.configValue = :configValue")})
|
||||
public class ConfigEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 100)
|
||||
@Column(name = "config_key")
|
||||
private String configKey;
|
||||
@Size(max = 200)
|
||||
@Column(name = "config_value")
|
||||
private String configValue;
|
||||
|
||||
public ConfigEntity() {
|
||||
}
|
||||
|
||||
public ConfigEntity(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public String getConfigKey() {
|
||||
return configKey;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public String getConfigValue() {
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public void setConfigValue(String configValue) {
|
||||
this.configValue = configValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (configKey != null ? configKey.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||
if (!(object instanceof ConfigEntity)) {
|
||||
return false;
|
||||
}
|
||||
ConfigEntity other = (ConfigEntity) object;
|
||||
if ((this.configKey == null && other.configKey != null) || (this.configKey != null && !this.configKey.equals(other.configKey))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.shared.account.entity.Config[ configKey=" + configKey + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jomu
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "mail_template")
|
||||
@ -88,7 +88,7 @@ public class MailTemplateEntity implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.ssg.entity.MailTemplateEntity[ templateName=" + templateName + " ]";
|
||||
return "de.muehlencord.shared.account.entity.MailTemplate[ templateName=" + templateName + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "application_permission")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "PermissionEntity.findAll", query = "SELECT p FROM PermissionEntity p"),
|
||||
@NamedQuery(name = "PermissionEntity.findByPermissionName", query = "SELECT p FROM PermissionEntity p WHERE p.permissionName = :permissionName"),
|
||||
@NamedQuery(name = "PermissionEntity.findByPermissionDescription", query = "SELECT p FROM PermissionEntity p WHERE p.permissionDescription = :permissionDescription")})
|
||||
public class PermissionEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 80)
|
||||
@Column(name = "permission_name")
|
||||
private String permissionName;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 200)
|
||||
@Column(name = "permission_description")
|
||||
private String permissionDescription;
|
||||
@JoinTable(name = "role_permission", joinColumns = {
|
||||
@JoinColumn(name = "permission_name", referencedColumnName = "permission_name")}, inverseJoinColumns = {
|
||||
@JoinColumn(name = "role_name", referencedColumnName = "role_name")})
|
||||
@ManyToMany
|
||||
private List<RoleEntity> roleEntityList;
|
||||
|
||||
public PermissionEntity() {
|
||||
}
|
||||
|
||||
public PermissionEntity(String permissionName) {
|
||||
this.permissionName = permissionName;
|
||||
}
|
||||
|
||||
public PermissionEntity(String permissionName, String permissionDescription) {
|
||||
this.permissionName = permissionName;
|
||||
this.permissionDescription = permissionDescription;
|
||||
}
|
||||
|
||||
public String getPermissionName() {
|
||||
return permissionName;
|
||||
}
|
||||
|
||||
public void setPermissionName(String permissionName) {
|
||||
this.permissionName = permissionName;
|
||||
}
|
||||
|
||||
public String getPermissionDescription() {
|
||||
return permissionDescription;
|
||||
}
|
||||
|
||||
public void setPermissionDescription(String permissionDescription) {
|
||||
this.permissionDescription = permissionDescription;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<RoleEntity> getRoleEntityList() {
|
||||
return roleEntityList;
|
||||
}
|
||||
|
||||
public void setRoleEntityList(List<RoleEntity> roleEntityList) {
|
||||
this.roleEntityList = roleEntityList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (permissionName != null ? permissionName.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||
if (!(object instanceof PermissionEntity)) {
|
||||
return false;
|
||||
}
|
||||
PermissionEntity other = (PermissionEntity) object;
|
||||
if ((this.permissionName == null && other.permissionName != null) || (this.permissionName != null && !this.permissionName.equals(other.permissionName))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.ssg.entity.PermissionEntity[ permissionName=" + permissionName + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,119 +0,0 @@
|
||||
package de.muehlencord.shared.account.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "application_role")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "RoleEntity.findAll", query = "SELECT r FROM RoleEntity r"),
|
||||
@NamedQuery(name = "RoleEntity.findByRoleName", query = "SELECT r FROM RoleEntity r WHERE r.roleName = :roleName"),
|
||||
@NamedQuery(name = "RoleEntity.findByRoleDescription", query = "SELECT r FROM RoleEntity r WHERE r.roleDescription = :roleDescription")})
|
||||
public class RoleEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 80)
|
||||
@Column(name = "role_name")
|
||||
private String roleName;
|
||||
@Basic(optional = false)
|
||||
@NotNull
|
||||
@Size(min = 1, max = 200)
|
||||
@Column(name = "role_description")
|
||||
private String roleDescription;
|
||||
@ManyToMany(mappedBy = "roleEntityList")
|
||||
private List<AccountEntity> accountEntityList;
|
||||
@ManyToMany(mappedBy = "roleEntityList")
|
||||
private List<PermissionEntity> permissionEntityList;
|
||||
|
||||
public RoleEntity() {
|
||||
}
|
||||
|
||||
public RoleEntity(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
public RoleEntity(String roleName, String roleDescription) {
|
||||
this.roleName = roleName;
|
||||
this.roleDescription = roleDescription;
|
||||
}
|
||||
|
||||
public String getRoleName() {
|
||||
return roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
public String getRoleDescription() {
|
||||
return roleDescription;
|
||||
}
|
||||
|
||||
public void setRoleDescription(String roleDescription) {
|
||||
this.roleDescription = roleDescription;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<AccountEntity> getAccountEntityList() {
|
||||
return accountEntityList;
|
||||
}
|
||||
|
||||
public void setAccountEntityList(List<AccountEntity> accountEntityList) {
|
||||
this.accountEntityList = accountEntityList;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<PermissionEntity> getPermissionEntityList() {
|
||||
return permissionEntityList;
|
||||
}
|
||||
|
||||
public void setPermissionEntityList(List<PermissionEntity> permissionEntityList) {
|
||||
this.permissionEntityList = permissionEntityList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (roleName != null ? roleName.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||
if (!(object instanceof RoleEntity)) {
|
||||
return false;
|
||||
}
|
||||
RoleEntity other = (RoleEntity) object;
|
||||
if ((this.roleName == null && other.roleName != null) || (this.roleName != null && !this.roleName.equals(other.roleName))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "de.muehlencord.ssg.entity.RoleEntity[ roleName=" + roleName + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
2
account/src/main/resources/META-INF/jboss.xml
Normal file
2
account/src/main/resources/META-INF/jboss.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jboss/>
|
||||
13
account/src/main/resources/META-INF/persistence.xml
Normal file
13
account/src/main/resources/META-INF/persistence.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
|
||||
<persistence-unit name="de.muehlencord.shared_shared-account_ejb_1.0-SNAPSHOTPU" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
|
||||
<exclude-unlisted-classes>false</exclude-unlisted-classes>
|
||||
<properties>
|
||||
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/radius"/>
|
||||
<property name="javax.persistence.jdbc.user" value="jomu"/>
|
||||
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
|
||||
<property name="javax.persistence.jdbc.password" value="jomu"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
Reference in New Issue
Block a user