restructured code
This commit is contained in:
275
account/sql/account.dbm
Normal file
275
account/sql/account.dbm
Normal file
@ -0,0 +1,275 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
CAUTION: Do not modify this file unless you know what you are doing.
|
||||
Unexpected results may occur if the code is changed deliberately.
|
||||
-->
|
||||
<dbmodel pgmodeler-ver="0.9.1" author="Joern Muehlencord" last-position="773,0" last-zoom="0.85"
|
||||
default-schema="public" default-owner="postgres">
|
||||
<database name="account_test" encoding="UTF8" lc-collate="German_Germany.1252" lc-ctype="German_Germany.1252" is-template="false" allow-conns="true" sql-disabled="true">
|
||||
</database>
|
||||
|
||||
<schema name="public" fill-color="#e1e1e1" sql-disabled="true">
|
||||
</schema>
|
||||
|
||||
<table name="config">
|
||||
<schema name="public"/>
|
||||
<position x="1912" y="120.235"/>
|
||||
<column name="config_key" not-null="true">
|
||||
<type name="varchar" length="100"/>
|
||||
</column>
|
||||
<column name="config_key_group">
|
||||
<type name="varchar" length="200"/>
|
||||
</column>
|
||||
<column name="config_key_account">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<column name="config_value">
|
||||
<type name="varchar" length="200"/>
|
||||
</column>
|
||||
<constraint name="config_pk" type="pk-constr" table="public.config">
|
||||
<columns names="config_key" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
</table>
|
||||
|
||||
<table name="application_role">
|
||||
<schema name="public"/>
|
||||
<position x="186.257" y="310"/>
|
||||
<column name="id" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<column name="role_name" not-null="true">
|
||||
<type name="character varying" length="80"/>
|
||||
</column>
|
||||
<column name="role_description" not-null="true">
|
||||
<type name="character varying" length="200"/>
|
||||
</column>
|
||||
<constraint name="pk_application_role_pk" type="pk-constr" table="public.application_role">
|
||||
<columns names="id" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
</table>
|
||||
|
||||
<table name="account">
|
||||
<schema name="public"/>
|
||||
<position x="1323.59" y="185.294"/>
|
||||
<column name="id" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<column name="username" not-null="true">
|
||||
<type name="character varying" length="32"/>
|
||||
</column>
|
||||
<column name="emailaddress" not-null="true">
|
||||
<type name="character varying" length="200"/>
|
||||
</column>
|
||||
<column name="firstname" not-null="true">
|
||||
<type name="character varying" length="100"/>
|
||||
</column>
|
||||
<column name="lastname" not-null="true">
|
||||
<type name="character varying" length="100"/>
|
||||
</column>
|
||||
<column name="account_password" not-null="true">
|
||||
<type name="character" length="200"/>
|
||||
</column>
|
||||
<column name="last_login">
|
||||
<type name="timestamp with time zone" length="0" with-timezone="true"/>
|
||||
</column>
|
||||
<column name="last_failed_login">
|
||||
<type name="timestamp with time zone" length="0" with-timezone="true"/>
|
||||
</column>
|
||||
<column name="failure_count" not-null="true" default-value="0">
|
||||
<type name="integer" length="0"/>
|
||||
</column>
|
||||
<column name="status" not-null="true" default-value="'NEW'">
|
||||
<type name="character varying" length="10"/>
|
||||
</column>
|
||||
<column name="password_reset_ongoing" not-null="true" default-value="false">
|
||||
<type name="boolean" length="0"/>
|
||||
</column>
|
||||
<column name="password_reset_valid_to">
|
||||
<type name="timestamp with time zone" length="0" with-timezone="true"/>
|
||||
</column>
|
||||
<column name="password_reset_hash">
|
||||
<type name="character" length="200"/>
|
||||
</column>
|
||||
<column name="created_on" not-null="true" default-value="timezone('utc'::text, now())">
|
||||
<type name="timestamp with time zone" length="0" with-timezone="true"/>
|
||||
</column>
|
||||
<column name="created_by" not-null="true">
|
||||
<type name="character varying" length="32"/>
|
||||
</column>
|
||||
<column name="last_updated_on" not-null="true" default-value="timezone('utc'::text, now())">
|
||||
<type name="timestamp with time zone" length="0" with-timezone="true"/>
|
||||
</column>
|
||||
<column name="last_updated_by" not-null="true">
|
||||
<type name="character varying" length="32"/>
|
||||
</column>
|
||||
<constraint name="pk_account" type="pk-constr" table="public.account">
|
||||
<columns names="id" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
<constraint name="uidx_username" type="uq-constr" table="public.account">
|
||||
<columns names="username" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
</table>
|
||||
|
||||
<table name="account_history">
|
||||
<schema name="public"/>
|
||||
<position x="725.984" y="294.706"/>
|
||||
<column name="id" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<column name="account_id" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<column name="message">
|
||||
<type name="character varying" length="200"/>
|
||||
</column>
|
||||
<column name="failure_count" not-null="true" default-value="0">
|
||||
<type name="integer" length="0"/>
|
||||
</column>
|
||||
<column name="status" not-null="true">
|
||||
<type name="character varying" length="20"/>
|
||||
</column>
|
||||
<column name="last_updated_on" not-null="true" default-value="timezone('utc'::text, now())">
|
||||
<type name="timestamp with time zone" length="0" with-timezone="true"/>
|
||||
</column>
|
||||
<column name="last_updated_by" not-null="true">
|
||||
<type name="character varying" length="32"/>
|
||||
</column>
|
||||
<constraint name="pk_account_history" type="pk-constr" table="public.account_history">
|
||||
<columns names="id" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
</table>
|
||||
|
||||
<table name="account_role">
|
||||
<schema name="public"/>
|
||||
<position x="738.806" y="90"/>
|
||||
<column name="account" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<column name="account_role" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<constraint name="pk_account_role" type="pk-constr" table="public.account_role">
|
||||
<columns names="account,account_role" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
</table>
|
||||
|
||||
<table name="application_permission">
|
||||
<schema name="public"/>
|
||||
<position x="1571.12" y="573.662"/>
|
||||
<column name="id" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<column name="permission_name" not-null="true">
|
||||
<type name="character varying" length="80"/>
|
||||
</column>
|
||||
<column name="permission_description" not-null="true">
|
||||
<type name="character varying" length="200"/>
|
||||
</column>
|
||||
<constraint name="pk_application_permission" type="pk-constr" table="public.application_permission">
|
||||
<columns names="id" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
<constraint name="uidx_application_permission_name" type="uq-constr" table="public.application_permission">
|
||||
<columns names="permission_name" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
</table>
|
||||
|
||||
<table name="role_permission">
|
||||
<schema name="public"/>
|
||||
<position x="617.922" y="582.191"/>
|
||||
<column name="application_role" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<column name="role_permission" not-null="true">
|
||||
<type name="uuid" length="0"/>
|
||||
</column>
|
||||
<constraint name="pk_role_permission_role_permission_name" type="pk-constr" table="public.role_permission">
|
||||
<columns names="application_role,role_permission" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
</table>
|
||||
|
||||
<table name="mail_template">
|
||||
<schema name="public"/>
|
||||
<position x="684.593" y="789.132"/>
|
||||
<column name="template_name" not-null="true">
|
||||
<type name="character varying" length="40"/>
|
||||
</column>
|
||||
<column name="template_value" not-null="true">
|
||||
<type name="text" length="0"/>
|
||||
</column>
|
||||
<constraint name="mail_template_pk" type="pk-constr" table="public.mail_template">
|
||||
<columns names="template_name" ref-type="src-columns"/>
|
||||
</constraint>
|
||||
</table>
|
||||
|
||||
<constraint name="config_key_account_fk" type="fk-constr" comparison-type="MATCH FULL"
|
||||
upd-action="NO ACTION" del-action="NO ACTION" ref-table="public.account" table="public.config">
|
||||
<columns names="config_key_account" ref-type="src-columns"/>
|
||||
<columns names="id" ref-type="dst-columns"/>
|
||||
</constraint>
|
||||
|
||||
<constraint name="fk_account_history_username_fk" type="fk-constr" comparison-type="MATCH SIMPLE"
|
||||
upd-action="NO ACTION" del-action="NO ACTION" ref-table="public.account" table="public.account_history">
|
||||
<columns names="account_id" ref-type="src-columns"/>
|
||||
<columns names="id" ref-type="dst-columns"/>
|
||||
</constraint>
|
||||
|
||||
<constraint name="fk_account_role_account" type="fk-constr" comparison-type="MATCH SIMPLE"
|
||||
upd-action="NO ACTION" del-action="NO ACTION" ref-table="public.account" table="public.account_role">
|
||||
<columns names="account" ref-type="src-columns"/>
|
||||
<columns names="id" ref-type="dst-columns"/>
|
||||
</constraint>
|
||||
|
||||
<constraint name="fk_account_role_role_name" type="fk-constr" comparison-type="MATCH SIMPLE"
|
||||
upd-action="NO ACTION" del-action="NO ACTION" ref-table="public.application_role" table="public.account_role">
|
||||
<columns names="account_role" ref-type="src-columns"/>
|
||||
<columns names="id" ref-type="dst-columns"/>
|
||||
</constraint>
|
||||
|
||||
<constraint name="fk_role_permission_application_role" type="fk-constr" comparison-type="MATCH SIMPLE"
|
||||
upd-action="NO ACTION" del-action="NO ACTION" ref-table="public.application_role" table="public.role_permission">
|
||||
<columns names="application_role" ref-type="src-columns"/>
|
||||
<columns names="id" ref-type="dst-columns"/>
|
||||
</constraint>
|
||||
|
||||
<constraint name="fk_role_permission_role_permission" type="fk-constr" comparison-type="MATCH SIMPLE"
|
||||
upd-action="NO ACTION" del-action="NO ACTION" ref-table="public.application_permission" table="public.role_permission">
|
||||
<columns names="role_permission" ref-type="src-columns"/>
|
||||
<columns names="id" ref-type="dst-columns"/>
|
||||
</constraint>
|
||||
|
||||
<relationship name="rel_account_history_account" type="relfk"
|
||||
custom-color="#83af1f"
|
||||
src-table="public.account_history"
|
||||
dst-table="public.account" reference-fk="fk_account_history_username_fk"
|
||||
src-required="false" dst-required="false"/>
|
||||
|
||||
<relationship name="rel_account_role_account" type="relfk"
|
||||
custom-color="#5aa578"
|
||||
src-table="public.account_role"
|
||||
dst-table="public.account" reference-fk="fk_account_role_account"
|
||||
src-required="false" dst-required="false"/>
|
||||
|
||||
<relationship name="rel_account_role_application_role" type="relfk"
|
||||
custom-color="#4b3e56"
|
||||
src-table="public.account_role"
|
||||
dst-table="public.application_role" reference-fk="fk_account_role_role_name"
|
||||
src-required="false" dst-required="false"/>
|
||||
|
||||
<relationship name="rel_role_permission_application_role" type="relfk"
|
||||
custom-color="#9ac721"
|
||||
src-table="public.role_permission"
|
||||
dst-table="public.application_role" reference-fk="fk_role_permission_application_role"
|
||||
src-required="false" dst-required="false"/>
|
||||
|
||||
<relationship name="rel_role_permission_application_permission" type="relfk"
|
||||
custom-color="#249b49"
|
||||
src-table="public.role_permission"
|
||||
dst-table="public.application_permission" reference-fk="fk_role_permission_role_permission"
|
||||
src-required="false" dst-required="false"/>
|
||||
|
||||
<relationship name="rel_config_account" type="relfk"
|
||||
src-table="public.config"
|
||||
dst-table="public.account" reference-fk="config_key_account_fk"
|
||||
src-required="false" dst-required="false"/>
|
||||
|
||||
</dbmodel>
|
||||
167
account/sql/account.sql
Normal file
167
account/sql/account.sql
Normal file
@ -0,0 +1,167 @@
|
||||
-- Database generated with pgModeler (PostgreSQL Database Modeler).
|
||||
-- pgModeler version: 0.9.1
|
||||
-- PostgreSQL version: 10.0
|
||||
-- Project Site: pgmodeler.io
|
||||
-- Model Author: Joern Muehlencord
|
||||
|
||||
|
||||
-- Database creation must be done outside a multicommand file.
|
||||
-- These commands were put in this file only as a convenience.
|
||||
-- -- object: account_test | type: DATABASE --
|
||||
-- -- DROP DATABASE IF EXISTS account_test;
|
||||
-- CREATE DATABASE account_test
|
||||
-- ENCODING = 'UTF8'
|
||||
-- LC_COLLATE = 'German_Germany.1252'
|
||||
-- LC_CTYPE = 'German_Germany.1252';
|
||||
-- -- ddl-end --
|
||||
--
|
||||
|
||||
-- object: public.config | type: TABLE --
|
||||
-- DROP TABLE IF EXISTS public.config CASCADE;
|
||||
CREATE TABLE public.config(
|
||||
config_key varchar(100) NOT NULL,
|
||||
config_key_group varchar(200),
|
||||
config_key_account uuid,
|
||||
config_value varchar(200),
|
||||
CONSTRAINT config_pk PRIMARY KEY (config_key)
|
||||
|
||||
);
|
||||
-- ddl-end --
|
||||
|
||||
-- object: public.application_role | type: TABLE --
|
||||
-- DROP TABLE IF EXISTS public.application_role CASCADE;
|
||||
CREATE TABLE public.application_role(
|
||||
id uuid NOT NULL,
|
||||
role_name character varying(80) NOT NULL,
|
||||
role_description character varying(200) NOT NULL,
|
||||
CONSTRAINT pk_application_role_pk PRIMARY KEY (id)
|
||||
|
||||
);
|
||||
-- ddl-end --
|
||||
|
||||
-- object: public.account | type: TABLE --
|
||||
-- DROP TABLE IF EXISTS public.account CASCADE;
|
||||
CREATE TABLE public.account(
|
||||
id uuid NOT NULL,
|
||||
username character varying(32) NOT NULL,
|
||||
emailaddress character varying(200) NOT NULL,
|
||||
firstname character varying(100) NOT NULL,
|
||||
lastname character varying(100) NOT NULL,
|
||||
account_password character(200) NOT NULL,
|
||||
last_login timestamp with time zone,
|
||||
last_failed_login timestamp with time zone,
|
||||
failure_count integer NOT NULL DEFAULT 0,
|
||||
status character varying(10) NOT NULL DEFAULT 'NEW',
|
||||
password_reset_ongoing boolean NOT NULL DEFAULT false,
|
||||
password_reset_valid_to timestamp with time zone,
|
||||
password_reset_hash character(200),
|
||||
created_on timestamp with time zone NOT NULL DEFAULT timezone('utc'::text, now()),
|
||||
created_by character varying(32) NOT NULL,
|
||||
last_updated_on timestamp with time zone NOT NULL DEFAULT timezone('utc'::text, now()),
|
||||
last_updated_by character varying(32) NOT NULL,
|
||||
CONSTRAINT pk_account PRIMARY KEY (id),
|
||||
CONSTRAINT uidx_username UNIQUE (username)
|
||||
|
||||
);
|
||||
-- ddl-end --
|
||||
|
||||
-- object: public.account_history | type: TABLE --
|
||||
-- DROP TABLE IF EXISTS public.account_history CASCADE;
|
||||
CREATE TABLE public.account_history(
|
||||
id uuid NOT NULL,
|
||||
account_id uuid NOT NULL,
|
||||
message character varying(200),
|
||||
failure_count integer NOT NULL DEFAULT 0,
|
||||
status character varying(20) NOT NULL,
|
||||
last_updated_on timestamp with time zone NOT NULL DEFAULT timezone('utc'::text, now()),
|
||||
last_updated_by character varying(32) NOT NULL,
|
||||
CONSTRAINT pk_account_history PRIMARY KEY (id)
|
||||
|
||||
);
|
||||
-- ddl-end --
|
||||
|
||||
-- object: public.account_role | type: TABLE --
|
||||
-- DROP TABLE IF EXISTS public.account_role CASCADE;
|
||||
CREATE TABLE public.account_role(
|
||||
account uuid NOT NULL,
|
||||
account_role uuid NOT NULL,
|
||||
CONSTRAINT pk_account_role PRIMARY KEY (account,account_role)
|
||||
|
||||
);
|
||||
-- ddl-end --
|
||||
|
||||
-- object: public.application_permission | type: TABLE --
|
||||
-- DROP TABLE IF EXISTS public.application_permission CASCADE;
|
||||
CREATE TABLE public.application_permission(
|
||||
id uuid NOT NULL,
|
||||
permission_name character varying(80) NOT NULL,
|
||||
permission_description character varying(200) NOT NULL,
|
||||
CONSTRAINT pk_application_permission PRIMARY KEY (id),
|
||||
CONSTRAINT uidx_application_permission_name UNIQUE (permission_name)
|
||||
|
||||
);
|
||||
-- ddl-end --
|
||||
|
||||
-- object: public.role_permission | type: TABLE --
|
||||
-- DROP TABLE IF EXISTS public.role_permission CASCADE;
|
||||
CREATE TABLE public.role_permission(
|
||||
application_role uuid NOT NULL,
|
||||
role_permission uuid NOT NULL,
|
||||
CONSTRAINT pk_role_permission_role_permission_name PRIMARY KEY (application_role,role_permission)
|
||||
|
||||
);
|
||||
-- ddl-end --
|
||||
|
||||
-- object: public.mail_template | type: TABLE --
|
||||
-- DROP TABLE IF EXISTS public.mail_template CASCADE;
|
||||
CREATE TABLE public.mail_template(
|
||||
template_name character varying(40) NOT NULL,
|
||||
template_value text NOT NULL,
|
||||
CONSTRAINT mail_template_pk PRIMARY KEY (template_name)
|
||||
|
||||
);
|
||||
-- ddl-end --
|
||||
|
||||
-- object: config_key_account_fk | type: CONSTRAINT --
|
||||
-- ALTER TABLE public.config DROP CONSTRAINT IF EXISTS config_key_account_fk CASCADE;
|
||||
ALTER TABLE public.config ADD CONSTRAINT config_key_account_fk FOREIGN KEY (config_key_account)
|
||||
REFERENCES public.account (id) MATCH FULL
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
-- ddl-end --
|
||||
|
||||
-- object: fk_account_history_username_fk | type: CONSTRAINT --
|
||||
-- ALTER TABLE public.account_history DROP CONSTRAINT IF EXISTS fk_account_history_username_fk CASCADE;
|
||||
ALTER TABLE public.account_history ADD CONSTRAINT fk_account_history_username_fk FOREIGN KEY (account_id)
|
||||
REFERENCES public.account (id) MATCH SIMPLE
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
-- ddl-end --
|
||||
|
||||
-- object: fk_account_role_account | type: CONSTRAINT --
|
||||
-- ALTER TABLE public.account_role DROP CONSTRAINT IF EXISTS fk_account_role_account CASCADE;
|
||||
ALTER TABLE public.account_role ADD CONSTRAINT fk_account_role_account FOREIGN KEY (account)
|
||||
REFERENCES public.account (id) MATCH SIMPLE
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
-- ddl-end --
|
||||
|
||||
-- object: fk_account_role_role_name | type: CONSTRAINT --
|
||||
-- ALTER TABLE public.account_role DROP CONSTRAINT IF EXISTS fk_account_role_role_name CASCADE;
|
||||
ALTER TABLE public.account_role ADD CONSTRAINT fk_account_role_role_name FOREIGN KEY (account_role)
|
||||
REFERENCES public.application_role (id) MATCH SIMPLE
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
-- ddl-end --
|
||||
|
||||
-- object: fk_role_permission_application_role | type: CONSTRAINT --
|
||||
-- ALTER TABLE public.role_permission DROP CONSTRAINT IF EXISTS fk_role_permission_application_role CASCADE;
|
||||
ALTER TABLE public.role_permission ADD CONSTRAINT fk_role_permission_application_role FOREIGN KEY (application_role)
|
||||
REFERENCES public.application_role (id) MATCH SIMPLE
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
-- ddl-end --
|
||||
|
||||
-- object: fk_role_permission_role_permission | type: CONSTRAINT --
|
||||
-- ALTER TABLE public.role_permission DROP CONSTRAINT IF EXISTS fk_role_permission_role_permission CASCADE;
|
||||
ALTER TABLE public.role_permission ADD CONSTRAINT fk_role_permission_role_permission FOREIGN KEY (role_permission)
|
||||
REFERENCES public.application_permission (id) MATCH SIMPLE
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
-- ddl-end --
|
||||
|
||||
|
||||
11
account/sql/account_prefill.sql
Normal file
11
account/sql/account_prefill.sql
Normal file
@ -0,0 +1,11 @@
|
||||
-- config
|
||||
INSERT INTO config (config_key, config_value) VALUES ('account.maxFailedLogins', '5');
|
||||
|
||||
-- application configuration
|
||||
INSERT INTO application_permission (id, permission_name, permission_description) values ('dfd0f8f1-4a51-4fdc-9a1c-a942bee9b649', 'test:view', 'Display test view');
|
||||
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');
|
||||
|
||||
-- account
|
||||
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');
|
||||
9
account/sql/createDatabaseFileFromDBM.bat
Normal file
9
account/sql/createDatabaseFileFromDBM.bat
Normal file
@ -0,0 +1,9 @@
|
||||
@ECHO OFF
|
||||
set BASEDIR=%~dp0%
|
||||
set PGMODELER_DIR=c:\app\pgmodeler
|
||||
|
||||
setlocal
|
||||
cd %PGMODELER_DIR%
|
||||
pgmodeler-cli -if %BASEDIR%/account.dbm -ef -do -of %BASEDIR%/account.sql
|
||||
|
||||
pause
|
||||
@ -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;
|
||||
@ -28,17 +31,16 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
@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