BTB-10 Als Benutzer möchte ich Indikatoren per Mausklick setzen können, damit die Meldungen im BTB sichtbar priorisiert werden können.
diff --git a/db/oracle/01a_drop_DB_1.0.0.sql b/db/oracle/01a_drop_DB_1.0.0.sql
index 231d287..0101908 100644
--- a/db/oracle/01a_drop_DB_1.0.0.sql
+++ b/db/oracle/01a_drop_DB_1.0.0.sql
@@ -2,14 +2,18 @@
DROP SEQUENCE REF_BRANCH_ID_SEQ;
DROP SEQUENCE REF_GRID_TERRITORY_ID_SEQ;
DROP SEQUENCE REF_NOTIF_STATUS_ID_SEQ;
+DROP SEQUENCE REF_NOTIF_PRIORITY_ID_SEQ;
DROP SEQUENCE TBL_NOTIF_ID_SEQ;
-DROP SEQUENCE TBL_NOTIF_INCIDENT_SEQ;
+DROP SEQUENCE TBL_NOTIF_INCIDENT_ID_SEQ;
DROP SEQUENCE TBL_RESP_ID_SEQ;
+DROP SEQUENCE TBL_USER_SETTINGS_ID_SEQ;
-DROP TABLE TBL_RESPONSIBILITY;
-DROP TABLE HTBL_RESPONSIBILITY;
-DROP TABLE TBL_NOTIFICATION;
DROP TABLE REF_BRANCH;
DROP TABLE REF_GRID_TERRITORY;
DROP TABLE REF_NOTIFICATION_STATUS;
-DROP TABLE REF_VERSION;
\ No newline at end of file
+DROP TABLE REF_NOTIFICATION_PRIORITY;
+DROP TABLE TBL_NOTIFICATION;
+DROP TABLE TBL_RESPONSIBILITY;
+DROP TABLE HTBL_RESPONSIBILITY;
+DROP TABLE REF_VERSION;
+DROP TABLE TBL_USER_SETTINGS;
\ No newline at end of file
diff --git a/db/oracle/02_create_DB_1.0.0.sql b/db/oracle/02_create_DB_1.0.0.sql
index da0a764..6dc73d3 100644
--- a/db/oracle/02_create_DB_1.0.0.sql
+++ b/db/oracle/02_create_DB_1.0.0.sql
@@ -11,6 +11,9 @@
CREATE SEQUENCE REF_NOTIF_STATUS_ID_SEQ
INCREMENT BY 1;
+CREATE SEQUENCE REF_NOTIF_PRIORITY_ID_SEQ
+ INCREMENT BY 1;
+
CREATE SEQUENCE TBL_NOTIF_ID_SEQ
INCREMENT BY 1;
@@ -94,6 +97,27 @@
/
ALTER TRIGGER "REF_NOTIFICATION_STATUS_BIR" ENABLE;
+CREATE TABLE REF_NOTIFICATION_PRIORITY
+(
+ "ID" INTEGER NOT NULL,
+ "NAME" VARCHAR2(50) NOT NULL,
+ "WEIGHTING" INTEGER NOT NULL,
+ "IMAGE_NAME" VARCHAR2(50) NOT NULL,
+ CONSTRAINT REF_NOTIFICATION_PRIORITY_PKEY PRIMARY KEY ("ID")
+);
+
+
+CREATE OR REPLACE TRIGGER "REF_NOTIFICATION_PRIORITY_BIR"
+BEFORE INSERT ON "REF_NOTIFICATION_PRIORITY"
+FOR EACH ROW
+ WHEN (NEW."ID" IS NULL) BEGIN
+ SELECT REF_NOTIF_STATUS_ID_SEQ.NEXTVAL
+ INTO :NEW."ID"
+ FROM DUAL;
+END;
+/
+ALTER TRIGGER "REF_NOTIFICATION_PRIORITY_BIR" ENABLE;
+
-- TABLE: PUBLIC.REF_VERSION
CREATE TABLE REF_VERSION
(
@@ -113,6 +137,7 @@
"INCIDENT_ID" INTEGER,
"VERSION" INTEGER DEFAULT 0 NOT NULL,
"FK_REF_BRANCH" INTEGER,
+ "FK_REF_NOTIFICATION_PRIORITY" INTEGER,
"NOTIFICATION_TEXT" VARCHAR2(200) NOT NULL,
"FREE_TEXT" VARCHAR2(1000),
"FREE_TEXT_EXTENDED" VARCHAR2(1000),
@@ -136,7 +161,9 @@
CONSTRAINT FK_NOTIF_FK_GRID_TERR FOREIGN KEY ("FK_REF_GRID_TERRITORY")
REFERENCES REF_GRID_TERRITORY ("ID"),
CONSTRAINT FK_NOTIF_FK_STATUS FOREIGN KEY ("FK_REF_NOTIFICATION_STATUS")
- REFERENCES REF_NOTIFICATION_STATUS ("ID")
+ REFERENCES REF_NOTIFICATION_STATUS ("ID"),
+ CONSTRAINT FK_NOTIF_FK_PRIORITY FOREIGN KEY ("FK_REF_NOTIFICATION_PRIORITY")
+ REFERENCES REF_NOTIFICATION_PRIORITY ("ID")
);
CREATE OR REPLACE TRIGGER "TBL_NOTIFICATION_BIR"
@@ -183,6 +210,11 @@
ON TBL_NOTIFICATION("FK_REF_NOTIFICATION_STATUS");
+ -- INDEX: PUBLIC.FKI_NOTIFICATION_FK_STATUS
+ CREATE INDEX FKI_NOTIFICATION_FK_PRIORITY
+ ON TBL_NOTIFICATION("FK_REF_NOTIFICATION_PRIORITY");
+
+
-- INDEX: PUBLIC.MOD_DATE_IDX
CREATE INDEX MOD_DATE_IDX
ON TBL_NOTIFICATION ("MOD_DATE");
@@ -274,6 +306,7 @@
S."INCIDENT_ID",
S."VERSION",
S."FK_REF_BRANCH",
+ S."FK_REF_NOTIFICATION_PRIORITY",
S."NOTIFICATION_TEXT",
S."FREE_TEXT",
S."FREE_TEXT_EXTENDED",
@@ -294,6 +327,7 @@
TBL_NOTIFICATION."INCIDENT_ID",
TBL_NOTIFICATION."VERSION",
TBL_NOTIFICATION."FK_REF_BRANCH",
+ TBL_NOTIFICATION."FK_REF_NOTIFICATION_PRIORITY",
TBL_NOTIFICATION."NOTIFICATION_TEXT",
TBL_NOTIFICATION."FREE_TEXT",
TBL_NOTIFICATION."FREE_TEXT_EXTENDED",
diff --git a/db/oracle/03_config.DB_1.0.0.sql b/db/oracle/03_config.DB_1.0.0.sql
index 525f9b5..f70f4ec 100644
--- a/db/oracle/03_config.DB_1.0.0.sql
+++ b/db/oracle/03_config.DB_1.0.0.sql
@@ -7,16 +7,29 @@
INSERT INTO "REF_BRANCH" ("ID", "NAME", "DESCRIPTION" ) VALUES ( 2, 'G', 'Gas' );
INSERT INTO "REF_BRANCH" ("ID", "NAME", "DESCRIPTION" ) VALUES ( 3, 'F', 'Fernwärme' );
INSERT INTO "REF_BRANCH" ("ID", "NAME", "DESCRIPTION" ) VALUES ( 4, 'W', 'Wasser' );
+INSERT INTO "REF_BRANCH" ("ID", "NAME", "DESCRIPTION" ) VALUES ( 5, 'Z', 'ZSM' );
INSERT INTO "REF_GRID_TERRITORY" ("ID", "NAME", "DESCRIPTION", "FK_REF_MASTER") VALUES ( 1, 'MA', 'Mannheim', 1);
INSERT INTO "REF_GRID_TERRITORY" ("ID", "NAME", "DESCRIPTION", "FK_REF_MASTER") VALUES ( 2, 'OF', 'Offenbach', 2);
+INSERT INTO "REF_GRID_TERRITORY" ("ID", "NAME", "DESCRIPTION", "FK_REF_MASTER") VALUES ( 3, 'DR', 'Dreieich', 3);
INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (1, 1, 'Admin','Admin', CURRENT_TIMESTAMP);
INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (1, 2, 'Admin','Admin', CURRENT_TIMESTAMP);
INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (1, 3, 'Admin','Admin', CURRENT_TIMESTAMP);
INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (1, 4, 'Admin','Admin', CURRENT_TIMESTAMP);
+INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (1, 5, 'Admin','Admin', CURRENT_TIMESTAMP);
INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (2, 1, 'Admin','Admin', CURRENT_TIMESTAMP);
INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (2, 2, 'Admin','Admin', CURRENT_TIMESTAMP);
INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (2, 3, 'Admin','Admin', CURRENT_TIMESTAMP);
INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (2, 4, 'Admin','Admin', CURRENT_TIMESTAMP);
+INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (2, 5, 'Admin','Admin', CURRENT_TIMESTAMP);
+INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (3, 1, 'Admin','Admin', CURRENT_TIMESTAMP);
+INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (3, 2, 'Admin','Admin', CURRENT_TIMESTAMP);
+INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (3, 3, 'Admin','Admin', CURRENT_TIMESTAMP);
+INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (3, 4, 'Admin','Admin', CURRENT_TIMESTAMP);
+INSERT INTO "TBL_RESPONSIBILITY" ("FK_REF_GRID_TERRITORY", "FK_REF_BRANCH", "RESPONSIBLE_USER", "CREATE_USER", "CREATE_DATE") VALUES (3, 5, 'Admin','Admin', CURRENT_TIMESTAMP);
+
+INSERT INTO "REF_NOTIFICATION_PRIORITY" ("ID", "NAME", "WEIGHTING", "IMAGE_NAME") VALUES ( 1, 'Wichtig', 30, "prio-important-icon-web.svg");
+INSERT INTO "REF_NOTIFICATION_PRIORITY" ("ID", "NAME", "WEIGHTING", "IMAGE_NAME") VALUES ( 2, 'Information', 20, "prio-info-icon-web.svg");
+INSERT INTO "REF_NOTIFICATION_PRIORITY" ("ID", "NAME", "WEIGHTING", "IMAGE_NAME") VALUES ( 3, 'Normal', 10, "prio-normal-icon-web.svg");
diff --git a/db/postgreSQL/01a_drop_DB_1.0.0.sql b/db/postgreSQL/01a_drop_DB_1.0.0.sql
index 3e3ba05..0a3ddd1 100644
--- a/db/postgreSQL/01a_drop_DB_1.0.0.sql
+++ b/db/postgreSQL/01a_drop_DB_1.0.0.sql
@@ -1,19 +1,21 @@
-drop table public.REF_BRANCH cascade;
-drop table public.REF_GRID_TERRITORY cascade;
-drop table public.REF_NOTIFICATION_STATUS cascade;
-drop table public.TBL_NOTIFICATION cascade;
-drop FUNCTION public.TBL_NOTIFICATION_INCIDENT_TRG();
-drop table public.TBL_RESPONSIBILITY cascade;
-drop table public.HTBL_RESPONSIBILITY cascade;
-drop view public.VIEW_ACTIVE_NOTIFICATION cascade;
-drop table public.REF_VERSION cascade;
-drop table public.TBL_USER_SETTINGS cascade;
-
DROP SEQUENCE public.HTBL_RESP_ID_SEQ;
DROP SEQUENCE public.REF_BRANCH_ID_SEQ;
DROP SEQUENCE public.REF_GRID_TERRITORY_ID_SEQ;
DROP SEQUENCE public.REF_NOTIF_STATUS_ID_SEQ;
+DROP SEQUENCE public.REF_NOTIF_PRIORITY_ID_SEQ;
DROP SEQUENCE public.TBL_NOTIF_ID_SEQ;
DROP SEQUENCE public.TBL_NOTIF_INCIDENT_ID_SEQ;
DROP SEQUENCE public.TBL_RESP_ID_SEQ;
DROP SEQUENCE public.TBL_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE public.REF_BRANCH cascade;
+DROP TABLE public.REF_GRID_TERRITORY cascade;
+DROP TABLE public.REF_NOTIFICATION_STATUS cascade;
+DROP TABLE public.REF_NOTIFICATION_PRIORITY cascade;
+DROP TABLE public.TBL_NOTIFICATION cascade;
+DROP FUNCTION public.TBL_NOTIFICATION_INCIDENT_TRG();
+DROP TABLE public.TBL_RESPONSIBILITY cascade;
+DROP TABLE public.HTBL_RESPONSIBILITY cascade;
+DROP VIEW public.VIEW_ACTIVE_NOTIFICATION cascade;
+DROP TABLE public.REF_VERSION cascade;
+DROP TABLE public.TBL_USER_SETTINGS cascade;
\ No newline at end of file
diff --git a/db/postgreSQL/02_create_DB_1.0.0.sql b/db/postgreSQL/02_create_DB_1.0.0.sql
index aff20b7..1f66224 100644
--- a/db/postgreSQL/02_create_DB_1.0.0.sql
+++ b/db/postgreSQL/02_create_DB_1.0.0.sql
@@ -40,6 +40,15 @@
ALTER TABLE public.REF_NOTIF_STATUS_ID_SEQ
OWNER TO btbservice;
+CREATE SEQUENCE public.REF_NOTIF_PRIORITY_ID_SEQ
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 3
+ CACHE 1;
+ALTER TABLE public.REF_NOTIF_PRIORITY_ID_SEQ
+ OWNER TO btbservice;
+
CREATE SEQUENCE public.TBL_NOTIF_ID_SEQ
INCREMENT 1
MINVALUE 1
@@ -120,6 +129,21 @@
(description COLLATE pg_catalog."default");
+CREATE TABLE public.REF_NOTIFICATION_PRIORITY
+(
+ id integer NOT NULL DEFAULT nextval('ref_notif_priority_id_seq'::regclass),
+ name character varying(50) NOT NULL,
+ weighting integer NOT NULL,
+ image_name character varying(50) NOT NULL,
+ CONSTRAINT REF_NOTIFICATION_PRIORITY_PKEY PRIMARY KEY (id)
+)
+WITH (
+ OIDS=FALSE
+);
+ALTER TABLE public.REF_NOTIFICATION_PRIORITY
+ OWNER TO btbservice;
+GRANT ALL ON TABLE public.REF_NOTIFICATION_PRIORITY TO btbservice;
+
CREATE TABLE public.REF_NOTIFICATION_STATUS
(
id integer NOT NULL DEFAULT nextval('ref_notif_status_id_seq'::regclass),
@@ -154,6 +178,7 @@
incident_id integer DEFAULT nextval('tbl_notif_incident_id_seq'::regclass),
version integer NOT NULL DEFAULT 0,
fk_ref_branch integer,
+ fk_ref_notification_priority integer
notification_text character varying(200) NOT NULL,
free_text character varying(1000),
free_text_extended character varying(1000),
@@ -179,7 +204,10 @@
ON UPDATE NO ACTION ON DELETE CASCADE,
CONSTRAINT FK_NOTIFICATION_FK_STATUS FOREIGN KEY (fk_ref_notification_status)
REFERENCES public.REF_NOTIFICATION_STATUS (id) MATCH SIMPLE
- ON UPDATE NO ACTION ON DELETE NO ACTION
+ ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT FK_NOTIFICATION_FK_PRIORITY FOREIGN KEY (fk_ref_notification_priority)
+ REFERENCES public.REF_NOTIFICATION_PRIORITY (id) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
@@ -224,6 +252,15 @@
USING btree
(fk_ref_notification_status);
+-- Index: public.fki_notification_fk_priority
+
+-- DROP INDEX public.fki_notification_fk_priority;
+
+CREATE INDEX FKI_NOTIFICATION_FK_PRIORITY
+ ON public.TBL_NOTIFICATION
+ USING btree
+ (fk_ref_notification_priority);
+
-- Index: public.mod_date_idx
-- DROP INDEX public.mod_date_idx;
@@ -359,6 +396,7 @@
s.incident_id,
s.version,
s.fk_ref_branch,
+ s.fk_ref_notification_priority,
s.notification_text,
s.free_text,
s.free_text_extended,
@@ -379,6 +417,7 @@
tbl_notification.incident_id,
tbl_notification.version,
tbl_notification.fk_ref_branch,
+ tbl_notification.fk_ref_notification_priority,
tbl_notification.notification_text,
tbl_notification.free_text,
tbl_notification.free_text_extended,
diff --git a/db/postgreSQL/03_config_DB_1.0.0.sql b/db/postgreSQL/03_config_DB_1.0.0.sql
index 49f4433..5669561 100644
--- a/db/postgreSQL/03_config_DB_1.0.0.sql
+++ b/db/postgreSQL/03_config_DB_1.0.0.sql
@@ -20,9 +20,18 @@
INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (1, 2, 'admin','admin', CURRENT_TIMESTAMP);
INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (1, 3, 'admin','admin', CURRENT_TIMESTAMP);
INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (1, 4, 'admin','admin', CURRENT_TIMESTAMP);
+INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (1, 5, 'admin','admin', CURRENT_TIMESTAMP);
INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (2, 1, 'admin','admin', CURRENT_TIMESTAMP);
INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (2, 2, 'admin','admin', CURRENT_TIMESTAMP);
INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (2, 3, 'admin','admin', CURRENT_TIMESTAMP);
INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (2, 4, 'admin','admin', CURRENT_TIMESTAMP);
+INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (2, 5, 'admin','admin', CURRENT_TIMESTAMP);
+INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (3, 1, 'admin','admin', CURRENT_TIMESTAMP);
+INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (3, 2, 'admin','admin', CURRENT_TIMESTAMP);
+INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (3, 3, 'admin','admin', CURRENT_TIMESTAMP);
+INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (3, 4, 'admin','admin', CURRENT_TIMESTAMP);
+INSERT INTO TBL_RESPONSIBILITY ("fk_ref_grid_territory", "fk_ref_branch", "responsible_user", "create_user", "create_date") VALUES (3, 5, 'admin','admin', CURRENT_TIMESTAMP);
-
+INSERT INTO REF_NOTIFICATION_PRIORITY ("id", "name", "weighting", "image_name") VALUES ( 1, 'Wichtig', 30, "prio-important-icon-web.svg");
+INSERT INTO REF_NOTIFICATION_PRIORITY ("id", "name", "weighting", "image_name") VALUES ( 2, 'Information', 20, "prio-info-icon-web.svg");
+INSERT INTO REF_NOTIFICATION_PRIORITY ("id", "name", "weighting", "image_name") VALUES ( 3, 'Normal', 10, "prio-normal-icon-web.svg");
diff --git a/src/main/java/org/eclipse/openk/elogbook/common/mapper/NotificationMapper.java b/src/main/java/org/eclipse/openk/elogbook/common/mapper/NotificationMapper.java
index 1b7bf8a..6d3e3e9 100644
--- a/src/main/java/org/eclipse/openk/elogbook/common/mapper/NotificationMapper.java
+++ b/src/main/java/org/eclipse/openk/elogbook/common/mapper/NotificationMapper.java
@@ -20,22 +20,25 @@
import org.eclipse.openk.elogbook.persistence.dao.RefBranchDao;
import org.eclipse.openk.elogbook.persistence.dao.RefGridTerritoryDao;
+import org.eclipse.openk.elogbook.persistence.dao.RefNotificationPriorityDao;
import org.eclipse.openk.elogbook.persistence.dao.RefNotificationStatusDao;
import org.eclipse.openk.elogbook.persistence.model.AbstractNotification;
import org.eclipse.openk.elogbook.persistence.model.RefBranch;
import org.eclipse.openk.elogbook.persistence.model.RefGridTerritory;
+import org.eclipse.openk.elogbook.persistence.model.RefNotificationPriority;
import org.eclipse.openk.elogbook.persistence.model.RefNotificationStatus;
import org.eclipse.openk.elogbook.persistence.model.TblNotification;
import org.eclipse.openk.elogbook.viewmodel.Notification;
public class NotificationMapper {
private Map<Integer, RefNotificationStatus> refStatusMap;
+ private Map<Integer, RefNotificationPriority> refPriorityMap;
private Map<Integer, RefBranch> refBranchMap;
private Map<Integer, RefGridTerritory> refGridTerritoryMap;
public NotificationMapper(RefNotificationStatusDao rnsDao, RefBranchDao rbDao,
- RefGridTerritoryDao refGridTerritoryDao) {
- createRelationsMaps(rnsDao, rbDao, refGridTerritoryDao);
+ RefGridTerritoryDao refGridTerritoryDao, RefNotificationPriorityDao rnpDao) {
+ createRelationsMaps(rnsDao, rbDao, refGridTerritoryDao, rnpDao);
}
public TblNotification mapFromVModel(Notification vmNot) {
@@ -70,6 +73,7 @@
trg.setResponsibilityForwarding(vmNot.getResponsibilityForwarding());
trg.setRefBranch(refBranchMap.get(vmNot.getFkRefBranch()));
trg.setRefNotificationStatus(refStatusMap.get(vmNot.getFkRefNotificationStatus()));
+ trg.setRefNotificationPriority(refPriorityMap.get(vmNot.getFkRefNotificationPriority()));
trg.setRefGridTerritory(refGridTerritoryMap.get(vmNot.getFkRefGridTerritory()));
trg.setAdminFlag(vmNot.isAdminFlag());
return trg;
@@ -116,6 +120,9 @@
if (tblNot.getRefGridTerritory() != null) {
not.setFkRefGridTerritory(tblNot.getRefGridTerritory().getId());
}
+ if (tblNot.getRefNotificationPriority() != null) {
+ not.setFkRefNotificationPriority(tblNot.getRefNotificationPriority().getId());
+ }
not.getAdminFlag(tblNot.isAdminFlag());
return not;
}
@@ -136,12 +143,17 @@
* @param refGridTerritoryDao the dao for the grid territories
*/
private void createRelationsMaps(RefNotificationStatusDao rnsDao, RefBranchDao rbDao,
- RefGridTerritoryDao refGridTerritoryDao) {
+ RefGridTerritoryDao refGridTerritoryDao, RefNotificationPriorityDao rnpDao) {
List<RefNotificationStatus> rnsList = rnsDao.findInTx(true, -1, 0);
refStatusMap = new HashMap<>(rnsList.size());
for (RefNotificationStatus item : rnsList) {
refStatusMap.put(item.getId(), item);
}
+ List<RefNotificationPriority> rnpList = rnpDao.findInTx(true, -1, 0);
+ refPriorityMap = new HashMap<>(rnpList.size());
+ for (RefNotificationPriority item : rnpList) {
+ refPriorityMap.put(item.getId(), item);
+ }
List<RefBranch> rbList = rbDao.findInTx(true, -1, 0);
refBranchMap = new HashMap<>(rbList.size());
for (RefBranch item : rbList) {
diff --git a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerNotification.java b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerNotification.java
index 6dd6866..d16c1f8 100644
--- a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerNotification.java
+++ b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerNotification.java
@@ -29,6 +29,7 @@
import org.eclipse.openk.elogbook.persistence.dao.HTblResponsibilityDao;
import org.eclipse.openk.elogbook.persistence.dao.RefBranchDao;
import org.eclipse.openk.elogbook.persistence.dao.RefGridTerritoryDao;
+import org.eclipse.openk.elogbook.persistence.dao.RefNotificationPriorityDao;
import org.eclipse.openk.elogbook.persistence.dao.RefNotificationStatusDao;
import org.eclipse.openk.elogbook.persistence.dao.TblNotificationDao;
import org.eclipse.openk.elogbook.persistence.dao.TblResponsibilityDao;
@@ -61,10 +62,10 @@
*/
public List<Notification> getNotifications(Notification.ListType listType, NotificationSearchFilter nsf)
throws BtbException {
- LOGGER.info("getNotifications(listType) is called");
- LOGGER.info("-> Type=" + listType.toString());
- LOGGER.info("-> NotificationSearchFilter=" + JsonGeneratorBase.getGson().toJson(nsf));
- LOGGER.info("-> Request for Historical Notifications = " + (nsf != null && nsf.isHistoricalFlag()));
+ LOGGER.debug("getNotifications(listType) is called");
+ LOGGER.debug("-> Type=" + listType.toString());
+ LOGGER.debug("-> NotificationSearchFilter=" + JsonGeneratorBase.getGson().toJson(nsf));
+ LOGGER.debug("-> Request for Historical Notifications = " + (nsf != null && nsf.isHistoricalFlag()));
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -80,7 +81,7 @@
}
return getNotificationMapper(em).mapListToVModel(notList);
} finally {
- LOGGER.info("getNotifications() is finished");
+ LOGGER.debug("getNotifications() is finished");
}
}
@@ -92,7 +93,7 @@
* Exception of Type BtbException
*/
public List<Notification> getActiveNotifications() throws BtbException {
- LOGGER.info("getActiveNotifications() is called");
+ LOGGER.debug("getActiveNotifications() is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -105,7 +106,7 @@
}
return retList;
} finally {
- LOGGER.info("getActiveNotifications() is finished");
+ LOGGER.debug("getActiveNotifications() is finished");
}
}
@@ -129,7 +130,7 @@
}
public Notification createNotification(Notification newNotification, String modUser) throws BtbException {
- LOGGER.info("createNotification is called");
+ LOGGER.debug("createNotification is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -144,7 +145,7 @@
em.getTransaction().commit();
return ret;
} finally {
- LOGGER.info("createNotification is finished");
+ LOGGER.debug("createNotification is finished");
}
}
@@ -156,26 +157,26 @@
* @return Notification with the given Id
*/
public Notification getNotificationById(Integer id) {
- LOGGER.info("getNotificationById is called");
+ LOGGER.debug("getNotificationById is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
TblNotificationDao dao = new TblNotificationDao(em);
return getNotificationMapper(em).mapToVModel(dao.findById(TblNotification.class, id));
} finally {
- LOGGER.info("getNotificationById is finished");
+ LOGGER.debug("getNotificationById is finished");
}
}
public List<Notification> getNotificationByIncidentId(Integer incidentId) throws BtbInternalServerError {
- LOGGER.info("getNotificationByIncidentId is called");
+ LOGGER.debug("getNotificationByIncidentId is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
TblNotificationDao dao = new TblNotificationDao(em);
return getNotificationMapper(em).mapListToVModel(dao.getByIncidentId(incidentId));
} finally {
- LOGGER.info("getNotificationByIncidentId is finished");
+ LOGGER.debug("getNotificationByIncidentId is finished");
}
}
@@ -190,9 +191,9 @@
* if an error occurs.
*/
public List<Notification> getSearchResults(GlobalSearchFilter gsf) throws BtbException {
- LOGGER.info("getSearchResults(globalSearchFilter) is called");
- LOGGER.info("-> GlobalSearchFilter=" + JsonGeneratorBase.getGson().toJson(gsf));
- LOGGER.info("-> Request for Global Search in all available notifications");
+ LOGGER.debug("getSearchResults(globalSearchFilter) is called");
+ LOGGER.debug("-> GlobalSearchFilter=" + JsonGeneratorBase.getGson().toJson(gsf));
+ LOGGER.debug("-> Request for Global Search in all available notifications");
if (gsf == null || (!isSearchStringAvailable(gsf) && !isResponsibilityForwardingAvailable(gsf))) {
return new ArrayList<>();
@@ -203,7 +204,7 @@
return getNotificationMapper(em)
.mapListToVModel(new TblNotificationDao().findNotificationsMatchingSearchCriteria(gsf));
} finally {
- LOGGER.info("getSearchResults() is finished");
+ LOGGER.debug("getSearchResults() is finished");
}
}
@@ -220,7 +221,7 @@
if (notificationMapper == null) {
LOGGER.debug("Notificationmapper initializing");
notificationMapper = new NotificationMapper(new RefNotificationStatusDao(em), new RefBranchDao(em),
- new RefGridTerritoryDao(em));
+ new RefGridTerritoryDao(em), new RefNotificationPriorityDao(em));
}
return notificationMapper;
}
diff --git a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerNotificationFile.java b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerNotificationFile.java
index 5fe2120..00f2a35 100644
--- a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerNotificationFile.java
+++ b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerNotificationFile.java
@@ -14,6 +14,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -54,7 +55,7 @@
processFileListForImportFile(notificationFiles, listOfFiles);
}
else {
- LOGGER.info("False parameter");
+ LOGGER.debug("False parameter");
}
return notificationFiles;
@@ -96,7 +97,7 @@
notificationFiles.add(notificationFile);
- LOGGER.debug(
+ LOGGER.info(
"File " + fileName + " Date: " + fileCreationDate + " Creator: " + fileCreator
+ " Type: " + fileType + " Size: " + fileSize);
@@ -123,12 +124,12 @@
NotificationFile notificationFile = new NotificationFile();
String fileName = file.getName();
- List<String> lines = Files.readAllLines(filePath, Charset.forName("ISO-8859-1"));
+ List<String> lines = Files.readAllLines(filePath, StandardCharsets.ISO_8859_1);
extractFileData(notificationFile, lines);
notificationFiles.add(notificationFile);
- LOGGER.debug("File " + fileName + " loaded");
+ LOGGER.info("File " + fileName + " loaded");
} else if (file.isDirectory()) {
LOGGER.info("Directory " + file.getName());
diff --git a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerRefInfo.java b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerRefInfo.java
index 3a74d41..12e8489 100644
--- a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerRefInfo.java
+++ b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerRefInfo.java
@@ -21,17 +21,32 @@
import org.eclipse.openk.elogbook.persistence.dao.EntityHelper;
import org.eclipse.openk.elogbook.persistence.dao.RefBranchDao;
import org.eclipse.openk.elogbook.persistence.dao.RefGridTerritoryDao;
+import org.eclipse.openk.elogbook.persistence.dao.RefNotificationPriorityDao;
import org.eclipse.openk.elogbook.persistence.dao.RefNotificationStatusDao;
import org.eclipse.openk.elogbook.persistence.model.RefBranch;
import org.eclipse.openk.elogbook.persistence.model.RefGridTerritory;
+import org.eclipse.openk.elogbook.persistence.model.RefNotificationPriority;
import org.eclipse.openk.elogbook.persistence.model.RefNotificationStatus;
public class BackendControllerRefInfo {
private static final Logger LOGGER = Logger.getLogger(BackendControllerRefInfo.class.getName());
+ public List<RefNotificationPriority> getNotificationPriorities() {
+ LOGGER.debug("getNotificationPriorities is called");
+
+ EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
+ try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
+ RefNotificationPriorityDao dao = new RefNotificationPriorityDao(em);
+ return dao.findInTx(true, -1, 0);
+
+ } finally {
+ LOGGER.debug("getNotificationPriorities is finished");
+ }
+ }
+
public List<RefNotificationStatus> getNotificationStatuses() {
- LOGGER.info("getNotificationStatuses is called");
+ LOGGER.debug("getNotificationStatuses is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -39,12 +54,12 @@
return dao.findInTx(true, -1, 0);
} finally {
- LOGGER.info("getNotificationStatuses is finished");
+ LOGGER.debug("getNotificationStatuses is finished");
}
}
public List<RefBranch> getBranches() {
- LOGGER.info("getBranches is called");
+ LOGGER.debug("getBranches is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -52,12 +67,12 @@
return dao.findInTx(true, -1, 0);
} finally {
- LOGGER.info("getBranches is finished");
+ LOGGER.debug("getBranches is finished");
}
}
public List<RefGridTerritory> getGridTerritories() {
- LOGGER.info("getGridTerritories is called");
+ LOGGER.debug("getGridTerritories is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -65,7 +80,7 @@
return dao.findInTx(true, -1, 0);
} finally {
- LOGGER.info("getGridTerritories is finished");
+ LOGGER.debug("getGridTerritories is finished");
}
}
}
diff --git a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerResponsibility.java b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerResponsibility.java
index 522f042..1e7d0f7 100644
--- a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerResponsibility.java
+++ b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerResponsibility.java
@@ -50,7 +50,7 @@
private static HResponsibilityMapper historicalResponsibilityMapper = null;
public List<TerritoryResponsibility> getCurrentResponsibilities(String modUser) {
- LOGGER.info("getCurrentResponsibilities() is called");
+ LOGGER.debug("getCurrentResponsibilities() is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
List<TblResponsibility> tblResponsibilityList;
@@ -61,16 +61,16 @@
territoryResponsibilities = getResponsibilityMapper(em).mapToContainerVModelList(tblResponsibilityList);
} finally {
- LOGGER.info("getCurrentResponsibilities is finished");
+ LOGGER.debug("getCurrentResponsibilities is finished");
}
- LOGGER.info("getCurrentResponsibilities() finished");
+ LOGGER.debug("getCurrentResponsibilities() finished");
return territoryResponsibilities;
}
public List<TerritoryResponsibility> getPlannedResponsibilities(String modUser) {
- LOGGER.info("getPlannedResponsibilities() is called");
+ LOGGER.debug("getPlannedResponsibilities() is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
List<TblResponsibility> tblResponsibilityList;
@@ -81,16 +81,16 @@
territoryResponsibilities = getResponsibilityMapper(em).mapToContainerVModelList(tblResponsibilityList);
} finally {
- LOGGER.info("getPlannedResponsibilities is finished");
+ LOGGER.debug("getPlannedResponsibilities is finished");
}
- LOGGER.info("getPlannedResponsibilities() finished");
+ LOGGER.debug("getPlannedResponsibilities() finished");
return territoryResponsibilities;
}
public List<TerritoryResponsibility> getAllResponsibilities() {
- LOGGER.info("getAllResponsibilities() is called");
+ LOGGER.debug("getAllResponsibilities() is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
List<TblResponsibility> tblResponsibilityList;
@@ -101,16 +101,16 @@
territoryResponsibilities = getResponsibilityMapper(em).mapToContainerVModelList(tblResponsibilityList);
} finally {
- LOGGER.info("getAllResponsibilities is finished");
+ LOGGER.debug("getAllResponsibilities is finished");
}
- LOGGER.info("getAllResponsibilities() finished");
+ LOGGER.debug("getAllResponsibilities() finished");
return territoryResponsibilities;
}
public List<TerritoryResponsibility> getHistoricalResponsibilitiesByTransactionId(Integer transactionId) {
- LOGGER.info("getHistoricalResponsibilitiesByTransactionId is called");
+ LOGGER.debug("getHistoricalResponsibilitiesByTransactionId is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
List<HTblResponsibility> htblResponsibilityList;
@@ -119,13 +119,13 @@
htblResponsibilityList = hdao.getHistoricalResponsibilitiesByTransactionId(transactionId);
return getHistoricalResponsibilityMapper(em).mapToContainerVModelList(htblResponsibilityList);
} finally {
- LOGGER.info("getHistoricalResponsibilitiesByTransactionId is finished");
+ LOGGER.debug("getHistoricalResponsibilitiesByTransactionId is finished");
}
}
public List<TerritoryResponsibility> postResponsibilities(List<TerritoryResponsibility> territoryResponsibilityList,
String modUser, POST_RESPONSIBILITY_MODE mode ) throws BtbException {
- LOGGER.info("postResponsibilities is called");
+ LOGGER.debug("postResponsibilities is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -146,13 +146,13 @@
return territoryResponsibilities;
} finally {
- LOGGER.info("postResponsibilities is finished");
+ LOGGER.debug("postResponsibilities is finished");
}
}
public List<TerritoryResponsibility> confirmResponsibilities(
List<TerritoryResponsibility> territoryResponsibilityList, String modUser) throws BtbException {
- LOGGER.info("confirmResponsibilities is called");
+ LOGGER.debug("confirmResponsibilities is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
em.getTransaction().begin();
@@ -174,7 +174,7 @@
tblResponsibilityDao, htblResponsibilityDao, getResponsibilityMapper(em), modUser,
plannedResponsibilitiesCurrentUser, originalPlannedResponsibilitiesCurrentUser);
} catch (BtbGone btbGone) {
- LOGGER.info(MSG_DATA_OUTDATED_CATCHING_NEW_DATASET, btbGone);
+ LOGGER.debug(MSG_DATA_OUTDATED_CATCHING_NEW_DATASET, btbGone);
em.getTransaction().rollback();
return getResponsibilityMapper(em).mapToContainerVModelList(originalPlannedResponsibilitiesCurrentUser);
}
@@ -183,7 +183,7 @@
return territoryResponsibilities;
} finally {
- LOGGER.info("confirmResponsibilities is finished");
+ LOGGER.debug("confirmResponsibilities is finished");
}
}
@@ -197,8 +197,8 @@
* if an error occurs
*/
public HistoricalShiftChanges getHistoricalShiftChanges(ResponsibilitySearchFilter filter) throws BtbException {
- LOGGER.info("getHistgoricalShiftChanges(responsibilitySearchFilter) is called");
- LOGGER.info("-> ResponsibilitySearchFilter=" + JsonGeneratorBase.getGson().toJson(filter));
+ LOGGER.debug("getHistgoricalShiftChanges(responsibilitySearchFilter) is called");
+ LOGGER.debug("-> ResponsibilitySearchFilter=" + JsonGeneratorBase.getGson().toJson(filter));
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -210,12 +210,12 @@
return getHistoricalResponsibilityMapper(em).mapTblResponsibilitiesInPeriod(hTblResponsibilities,
transferDateFrom, transferDateTo);
} finally {
- LOGGER.info("getHistoricalShiftChanges() is finished");
+ LOGGER.debug("getHistoricalShiftChanges() is finished");
}
}
public Boolean getIsObserver(String modUser) {
- LOGGER.info("getIsObserver() is called");
+ LOGGER.debug("getIsObserver() is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
boolean isObserver = false;
@@ -228,10 +228,10 @@
}
} finally {
- LOGGER.info("getIsObserver is finished");
+ LOGGER.debug("getIsObserver is finished");
}
- LOGGER.info("getIsObserver() finished");
+ LOGGER.debug("getIsObserver() finished");
return isObserver;
}
@@ -290,7 +290,7 @@
tblResponsibilityList = responsibilityMapper.mapFromVModelList(territoryResponsibilityList,
responsibilitiesForCurrentUser, ResponsibilityMapper.PROCESS_MODE.PLAN, modUser);
} catch (BtbGone btbGone) {
- LOGGER.info(MSG_DATA_OUTDATED_CATCHING_NEW_DATASET, btbGone);
+ LOGGER.debug(MSG_DATA_OUTDATED_CATCHING_NEW_DATASET, btbGone);
return responsibilityMapper.mapToContainerVModelList(responsibilitiesForCurrentUser);
}
diff --git a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerUser.java b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerUser.java
index 87e8c49..d16cfe2 100644
--- a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerUser.java
+++ b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerUser.java
@@ -43,7 +43,7 @@
private final InputDataValuator inputDataValuator = new InputDataValuator();
public List<UserAuthentication> getUsers(String accesstoken) throws BtbException {
- LOGGER.info("getUsers() is called");
+ LOGGER.debug("getUsers() is called");
RestServiceWrapper restServiceWrapper = new RestServiceWrapper(BackendConfig.getInstance().getPortalBaseURL(), false);
String url = "usersForRole/"+BackendConfig.getInstance().getApplicationAccessRole();
@@ -51,12 +51,12 @@
List<KeyCloakUser> keyCloakUserList = JwtHelper.getUserListFromJson(keyCloakUserjson);
List<UserAuthentication> userAuthenticationList = KeyCloakUserMapper.mapFromKeyCloakUserList(keyCloakUserList);
- LOGGER.info("getUsers() succeeded.");
+ LOGGER.debug("getUsers() succeeded.");
return userAuthenticationList;
}
public UserAuthentication authenticate(String credentials) throws BtbException {
- LOGGER.info("authenticate() is called");
+ LOGGER.debug("authenticate() is called");
// valuator will throw an exception if not valid
inputDataValuator.checkCredentials(credentials);
@@ -81,25 +81,25 @@
throw new BtbUnauthorized("Unknown User/Password");
}
- LOGGER.info("authenticate() succeeded.");
+ LOGGER.debug("authenticate() succeeded.");
return ret;
}
public List<String> getAssignedUserSuggestions() throws BtbException {
- LOGGER.info("getAssignedUserSuggestions() is called");
+ LOGGER.debug("getAssignedUserSuggestions() is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
TblNotificationDao dao = new TblNotificationDao(em);
return dao.getAssignedUserSuggestions();
} finally {
- LOGGER.info("getAssignedUserSuggestions() is finished");
+ LOGGER.debug("getAssignedUserSuggestions() is finished");
}
}
public String getUserSettings( String modUser ) throws BtbInternalServerError {
- LOGGER.info("getUserSettings() is called");
+ LOGGER.debug("getUserSettings() is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
TblUserSettingsDao dao = new TblUserSettingsDao(em);
@@ -111,12 +111,12 @@
throw( new BtbInternalServerError("Error loading usersettings"));
}
} finally {
- LOGGER.info("getUserSettings() is finished");
+ LOGGER.debug("getUserSettings() is finished");
}
}
public boolean storeUserSettings( String settingsToSave, String modUser ) throws BtbInternalServerError {
- LOGGER.info("storeUserSettings() is called");
+ LOGGER.debug("storeUserSettings() is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
@@ -138,7 +138,7 @@
throw( new BtbInternalServerError("Error storing usersettings"));
}
} finally {
- LOGGER.info("storeUserSettings() is finished");
+ LOGGER.debug("storeUserSettings() is finished");
}
}
diff --git a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerVersionInfo.java b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerVersionInfo.java
index 5e883ae..782b8d9 100644
--- a/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerVersionInfo.java
+++ b/src/main/java/org/eclipse/openk/elogbook/controller/BackendControllerVersionInfo.java
@@ -26,13 +26,13 @@
private static final Logger LOGGER = Logger.getLogger(BackendControllerVersionInfo.class.getName());
public VersionInfo getVersionInfo() {
- LOGGER.info("getVersionInfo is called");
+ LOGGER.debug("getVersionInfo is called");
EntityManager emOrg = EntityHelper.getEMF().createEntityManager();
try (AutoCloseEntityManager em = new AutoCloseEntityManager(emOrg)) {
return getVersionInfoImpl(new RefVersionDao(em), getClass().getPackage().getImplementationVersion());
} finally {
- LOGGER.info("getVersionInfo is finished");
+ LOGGER.debug("getVersionInfo is finished");
}
}
diff --git a/src/main/java/org/eclipse/openk/elogbook/controller/BaseWebService.java b/src/main/java/org/eclipse/openk/elogbook/controller/BaseWebService.java
index 90da289..af13e4d 100644
--- a/src/main/java/org/eclipse/openk/elogbook/controller/BaseWebService.java
+++ b/src/main/java/org/eclipse/openk/elogbook/controller/BaseWebService.java
@@ -72,7 +72,7 @@
return invokable.invoke();
} catch (BtbException bee) {
- logger.info("Caught BackendException: " + bee.getClass().getSimpleName());
+ logger.debug("Caught BackendException: " + bee.getClass().getSimpleName());
return Response.status(bee.getHttpStatus()).entity(BtbExceptionMapper.toJson(bee))
.build();
diff --git a/src/main/java/org/eclipse/openk/elogbook/controller/ControllerImplementations.java b/src/main/java/org/eclipse/openk/elogbook/controller/ControllerImplementations.java
index d546fa2..04251db 100644
--- a/src/main/java/org/eclipse/openk/elogbook/controller/ControllerImplementations.java
+++ b/src/main/java/org/eclipse/openk/elogbook/controller/ControllerImplementations.java
@@ -18,6 +18,7 @@
import org.eclipse.openk.elogbook.exceptions.BtbExceptionMapper;
import org.eclipse.openk.elogbook.persistence.model.RefBranch;
import org.eclipse.openk.elogbook.persistence.model.RefGridTerritory;
+import org.eclipse.openk.elogbook.persistence.model.RefNotificationPriority;
import org.eclipse.openk.elogbook.persistence.model.RefNotificationStatus;
import org.eclipse.openk.elogbook.viewmodel.GlobalSearchFilter;
import org.eclipse.openk.elogbook.viewmodel.HistoricalShiftChanges;
@@ -71,6 +72,21 @@
}
}
+ public static class GetNotificationPriorities extends BackendInvokable {
+
+ private BackendControllerRefInfo backendControllerRefInfo;
+
+ public GetNotificationPriorities(BackendControllerRefInfo backendControllerRefInfo) {
+ this.backendControllerRefInfo = backendControllerRefInfo;
+ }
+
+ @Override
+ public Response invoke() throws BtbException {
+ List<RefNotificationPriority> priorityList = backendControllerRefInfo.getNotificationPriorities();
+ return ResponseBuilderWrapper.INSTANCE.buildOKResponse(JsonGeneratorBase.getGson().toJson(priorityList));
+ }
+ }
+
public static class GetBranches extends BackendInvokable {
private BackendControllerRefInfo backendControllerRefInfo;
diff --git a/src/main/java/org/eclipse/openk/elogbook/persistence/dao/GenericDaoJpa.java b/src/main/java/org/eclipse/openk/elogbook/persistence/dao/GenericDaoJpa.java
index fc07539..cde4361 100644
--- a/src/main/java/org/eclipse/openk/elogbook/persistence/dao/GenericDaoJpa.java
+++ b/src/main/java/org/eclipse/openk/elogbook/persistence/dao/GenericDaoJpa.java
@@ -100,7 +100,7 @@
em.find(entity.getClass(), id);
em.remove(entity);
em.getTransaction().commit();
- LOGGER.info("Entity with Id " + id + " removed!");
+ LOGGER.debug("Entity with Id " + id + " removed!");
} catch (EntityNotFoundException ex) {
String errorText = "Entity " + entity.toString() + " with id " + id + " no longer exists! - " + ex.getMessage(); //NOSONAR
LOGGER.error(errorText);
@@ -111,7 +111,7 @@
LOGGER.error(errorText, ex);
throw new Exception(errorText);
} finally {
- LOGGER.info("GenericDao.remove.finally");
+ LOGGER.debug("GenericDao.remove.finally");
em.close();
}
}
@@ -135,7 +135,7 @@
try {
this.removeInTxInner(entity, id);
em.remove(entity);
- LOGGER.info("Entity with Id " + id + " removed!");
+ LOGGER.debug("Entity with Id " + id + " removed!");
} catch (Exception ex) {
String errorText = "Error removing " + entity + "; " + ex.getMessage();
LOGGER.error(errorText, ex);
@@ -161,7 +161,7 @@
q.setFirstResult(firstResult);
}
entityList = (List<T>) q.getResultList();
- LOGGER.info("EntityList with " + entityList.size() + " entries found!");
+ LOGGER.debug("EntityList with " + entityList.size() + " entries found!");
em.close();
return entityList;
}
@@ -184,7 +184,7 @@
q.setFirstResult(firstResult);
}
entityList = (List<T>) q.getResultList();
- LOGGER.info("EntityList with " + entityList.size() + " entries found!");
+ LOGGER.debug("EntityList with " + entityList.size() + " entries found!");
return entityList;
}
@@ -231,14 +231,14 @@
em.flush();
em.refresh(entity);
em.getTransaction().commit();
- LOGGER.info("Entity " + entity + " persisted!");
+ LOGGER.debug("Entity " + entity + " persisted!");
} catch (Exception ex) {
em.getTransaction().rollback();
String errorText = "Error persisting " + entity + ": " + ex.getMessage();
LOGGER.error(errorText, ex);
throw new Exception(errorText);
} finally {
- LOGGER.info("GenericDao.persist.finally");
+ LOGGER.debug("GenericDao.persist.finally");
em.close();
}
@@ -254,7 +254,7 @@
em.persist(entity);
em.flush();
em.refresh(entity);
- LOGGER.info("Entity " + entity + " persisted!");
+ LOGGER.debug("Entity " + entity + " persisted!");
} catch (Exception ex) {
String errorText = "Error persisting in Transaction " + entity + ": " + ex.getMessage();
LOGGER.error(errorText, ex);
@@ -273,14 +273,14 @@
em.getTransaction().begin();
entityMerged = em.merge(entity);
em.getTransaction().commit();
- LOGGER.info("Entity " + entity + " merged!");
+ LOGGER.debug("Entity " + entity + " merged!");
} catch (Exception ex) {
em.getTransaction().rollback();
String errorText = "Error merging " + entity + ": " + ex.getMessage();
LOGGER.error(errorText, ex);
throw new Exception(errorText);
} finally {
- LOGGER.info("GenericDao.merge.finally");
+ LOGGER.debug("GenericDao.merge.finally");
em.close();
}
@@ -296,7 +296,7 @@
T entityMerged;
try {
entityMerged = em.merge(entity);
- LOGGER.info("Entity " + entity + " merged!");
+ LOGGER.debug("Entity " + entity + " merged!");
} catch (Exception ex) {
String errorText = "Error merging in Transaction " + entity + ": " + ex.getMessage();
LOGGER.error(errorText, ex);
diff --git a/src/main/java/org/eclipse/openk/elogbook/persistence/dao/HTblResponsibilityDao.java b/src/main/java/org/eclipse/openk/elogbook/persistence/dao/HTblResponsibilityDao.java
index cf0030c..1606db1 100644
--- a/src/main/java/org/eclipse/openk/elogbook/persistence/dao/HTblResponsibilityDao.java
+++ b/src/main/java/org/eclipse/openk/elogbook/persistence/dao/HTblResponsibilityDao.java
@@ -143,9 +143,9 @@
List<HTblResponsibility> hTblResponsibilities = (List<HTblResponsibility>) query.getResultList();
refreshModelCollection(hTblResponsibilities);
- LOGGER.info("Results for shift changes with transaction id " + shiftTransactionId);
+ LOGGER.debug("Results for shift changes with transaction id " + shiftTransactionId);
for (HTblResponsibility hTblResponsibility : hTblResponsibilities) {
- LOGGER.info("id: " + hTblResponsibility.getId() + ", foreign key Branch: "
+ LOGGER.debug("id: " + hTblResponsibility.getId() + ", foreign key Branch: "
+ hTblResponsibility.getRefBranch().getId() + ", foreign key grid territory: "
+ hTblResponsibility.getRefGridTerritory().getId());
}
diff --git a/src/main/java/org/eclipse/openk/elogbook/persistence/dao/RefNotificationPriorityDao.java b/src/main/java/org/eclipse/openk/elogbook/persistence/dao/RefNotificationPriorityDao.java
new file mode 100644
index 0000000..b0e992e
--- /dev/null
+++ b/src/main/java/org/eclipse/openk/elogbook/persistence/dao/RefNotificationPriorityDao.java
@@ -0,0 +1,28 @@
+/**
+******************************************************************************
+* Copyright © 2017-2018 PTA GmbH.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+*
+* http://www.eclipse.org/legal/epl-v10.html
+*
+******************************************************************************
+*/
+package org.eclipse.openk.elogbook.persistence.dao;
+
+import org.eclipse.openk.elogbook.persistence.model.RefNotificationPriority;
+
+import javax.persistence.EntityManager;
+
+
+public class RefNotificationPriorityDao extends GenericDaoJpa<RefNotificationPriority, Long> {
+ public RefNotificationPriorityDao() {
+ super();
+ }
+
+ public RefNotificationPriorityDao(EntityManager em) {
+ super(em);
+ }
+
+}
diff --git a/src/main/java/org/eclipse/openk/elogbook/persistence/model/AbstractNotification.java b/src/main/java/org/eclipse/openk/elogbook/persistence/model/AbstractNotification.java
index cae21a0..b9b22e3 100644
--- a/src/main/java/org/eclipse/openk/elogbook/persistence/model/AbstractNotification.java
+++ b/src/main/java/org/eclipse/openk/elogbook/persistence/model/AbstractNotification.java
@@ -92,6 +92,11 @@
@JoinColumn(name="fk_ref_grid_territory")
private RefGridTerritory refGridTerritory;
+ //bi-directional many-to-one association to RefNotificationStatus
+ @ManyToOne
+ @JoinColumn(name="fk_ref_notification_priority")
+ private RefNotificationPriority refNotificationPriority;
+
public AbstractNotification() {
// empty Standard constructor
}
@@ -256,4 +261,11 @@
this.adminFlag = adminFlag;
}
+ public RefNotificationPriority getRefNotificationPriority() {
+ return refNotificationPriority;
+ }
+
+ public void setRefNotificationPriority(RefNotificationPriority refNotificationPriority) {
+ this.refNotificationPriority = refNotificationPriority;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/eclipse/openk/elogbook/persistence/model/RefNotificationPriority.java b/src/main/java/org/eclipse/openk/elogbook/persistence/model/RefNotificationPriority.java
new file mode 100644
index 0000000..f0baed3
--- /dev/null
+++ b/src/main/java/org/eclipse/openk/elogbook/persistence/model/RefNotificationPriority.java
@@ -0,0 +1,83 @@
+/**
+******************************************************************************
+* Copyright © 2017-2018 PTA GmbH.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+*
+* http://www.eclipse.org/legal/epl-v10.html
+*
+******************************************************************************
+*/
+package org.eclipse.openk.elogbook.persistence.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+
+/**
+ * The persistent class for the ref_notification_status database table.
+ *
+ */
+@Entity
+@Table(name="REF_NOTIFICATION_PRIORITY")
+@NamedQuery(name="RefNotificationPriority.findAll", query="SELECT r FROM RefNotificationPriority r")
+public class RefNotificationPriority implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "id")
+ private Integer id;
+
+ @Column(name = "name")
+ private String name;
+
+ @Column(name = "weighting")
+ private Integer weighting;
+
+ @Column(name = "image_name")
+ private String imageName;
+
+ public RefNotificationPriority() {
+ // default constructor
+ }
+
+ public Integer getId() {
+ return this.id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getWeighting() {
+ return weighting;
+ }
+
+ public void setWeighting(Integer weighting) {
+ this.weighting = weighting;
+ }
+
+ public String getImageName() {
+ return imageName;
+ }
+
+ public void setImageName(String imageName) {
+ this.imageName = imageName;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/eclipse/openk/elogbook/persistence/util/NotificationQueryCreator.java b/src/main/java/org/eclipse/openk/elogbook/persistence/util/NotificationQueryCreator.java
index 2f01f00..5c508b3 100644
--- a/src/main/java/org/eclipse/openk/elogbook/persistence/util/NotificationQueryCreator.java
+++ b/src/main/java/org/eclipse/openk/elogbook/persistence/util/NotificationQueryCreator.java
@@ -206,6 +206,9 @@
if (gsf.isGridTerritorySelected()) {
sqlSB.append(" AND t.refGridTerritory.id = :refGridTerritory ");
}
+ if (gsf.isPrioritySelected()) {
+ sqlSB.append(" AND t.refNotificationPriority.id = :refNotificationPriority ");
+ }
List<Integer> statusIds = gsf.getSelectedStatusMappedToIds();
if (!statusIds.isEmpty()) {
sqlSB.append(" AND t.refNotificationStatus.id IN ( ");
@@ -242,6 +245,9 @@
if (gsf.isGridTerritorySelected()) {
query.setParameter("refGridTerritory", gsf.getFkRefGridTerritory());
}
+ if (gsf.isPrioritySelected()) {
+ query.setParameter("refNotificationPriority", gsf.getFkRefNotificationPriority());
+ }
}
/**
diff --git a/src/main/java/org/eclipse/openk/elogbook/rest/BackendRestService.java b/src/main/java/org/eclipse/openk/elogbook/rest/BackendRestService.java
index 0be952a..78958b0 100644
--- a/src/main/java/org/eclipse/openk/elogbook/rest/BackendRestService.java
+++ b/src/main/java/org/eclipse/openk/elogbook/rest/BackendRestService.java
@@ -91,6 +91,14 @@
}
@GET
+ @Path("/notificationPriorities/")
+ @Produces("application/json")
+ public Response getNotificationPriorities() {
+ return invoke(null, SecureType.NONE,
+ new ControllerImplementations.GetNotificationPriorities(new BackendControllerRefInfo()));
+ }
+
+ @GET
@Path("/branches/")
@Produces("application/json")
public Response getBranches() {
diff --git a/src/main/java/org/eclipse/openk/elogbook/viewmodel/GlobalSearchFilter.java b/src/main/java/org/eclipse/openk/elogbook/viewmodel/GlobalSearchFilter.java
index bd3cb37..29f7176 100644
--- a/src/main/java/org/eclipse/openk/elogbook/viewmodel/GlobalSearchFilter.java
+++ b/src/main/java/org/eclipse/openk/elogbook/viewmodel/GlobalSearchFilter.java
@@ -45,6 +45,9 @@
/** key referring grid territory */
private Integer fkRefGridTerritory;
+ /** key referring priority */
+ private Integer fkRefNotificationPriority;
+
/** indicating if fast/classic search */
private Boolean fastSearchSelected;
@@ -82,6 +85,10 @@
return fkRefGridTerritory != null && fkRefGridTerritory > 0;
}
+ public boolean isPrioritySelected() {
+ return fkRefNotificationPriority != null && fkRefNotificationPriority > 0;
+ }
+
/**************************************************************************
* Getters/Setters
**************************************************************************/
@@ -169,6 +176,14 @@
return fastSearchSelected;
}
+ public Integer getFkRefNotificationPriority() {
+ return fkRefNotificationPriority;
+ }
+
+ public void setFkRefNotificationPriority(Integer fkRefNotificationPriority) {
+ this.fkRefNotificationPriority = fkRefNotificationPriority;
+ }
+
public void setFastSearchSelected(Boolean fastSearchSelected) {
this.fastSearchSelected = fastSearchSelected;
}
diff --git a/src/main/java/org/eclipse/openk/elogbook/viewmodel/Notification.java b/src/main/java/org/eclipse/openk/elogbook/viewmodel/Notification.java
index 8c12af2..808931f 100644
--- a/src/main/java/org/eclipse/openk/elogbook/viewmodel/Notification.java
+++ b/src/main/java/org/eclipse/openk/elogbook/viewmodel/Notification.java
@@ -40,8 +40,9 @@
private Integer fkRefBranch;
private Integer fkRefNotificationStatus;
+ private Integer fkRefNotificationPriority;
private Integer fkRefGridTerritory;
-
+
private Boolean adminFlag;
private List<Notification> notificationList;
@@ -237,4 +238,12 @@
public void setNotificationList(List<Notification> notificationList) {
this.notificationList = notificationList;
}
+
+ public Integer getFkRefNotificationPriority() {
+ return fkRefNotificationPriority;
+ }
+
+ public void setFkRefNotificationPriority(Integer fkRefNotificationPriority) {
+ this.fkRefNotificationPriority = fkRefNotificationPriority;
+ }
}
diff --git a/src/test/java/org/eclipse/openk/elogbook/controller/NotificationTestHelper.java b/src/test/java/org/eclipse/openk/elogbook/controller/NotificationTestHelper.java
index 427d605..4a6a96d 100644
--- a/src/test/java/org/eclipse/openk/elogbook/controller/NotificationTestHelper.java
+++ b/src/test/java/org/eclipse/openk/elogbook/controller/NotificationTestHelper.java
@@ -20,9 +20,11 @@
import org.eclipse.openk.elogbook.common.mapper.NotificationMapper;
import org.eclipse.openk.elogbook.persistence.dao.RefBranchDao;
import org.eclipse.openk.elogbook.persistence.dao.RefGridTerritoryDao;
+import org.eclipse.openk.elogbook.persistence.dao.RefNotificationPriorityDao;
import org.eclipse.openk.elogbook.persistence.dao.RefNotificationStatusDao;
import org.eclipse.openk.elogbook.persistence.model.RefBranch;
import org.eclipse.openk.elogbook.persistence.model.RefGridTerritory;
+import org.eclipse.openk.elogbook.persistence.model.RefNotificationPriority;
import org.eclipse.openk.elogbook.persistence.model.RefNotificationStatus;
import org.powermock.api.easymock.PowerMock;
@@ -34,6 +36,14 @@
return ret;
}
+ private static RefNotificationPriority newPriorityItem(int id, String name, int weighting) {
+ RefNotificationPriority ret = new RefNotificationPriority();
+ ret.setId(id);
+ ret.setName(name);
+ ret.setWeighting(weighting);
+ return ret;
+ }
+
private static RefBranch newBranch(int id, String name, String description) {
RefBranch ret = new RefBranch();
ret.setId(id);
@@ -59,6 +69,13 @@
return rnsdaoMock;
}
+ private static RefNotificationPriorityDao createPriorityDaoMock(List<RefNotificationPriority> rnpList) {
+ RefNotificationPriorityDao rnsdaoMock = PowerMock.createNiceMock(RefNotificationPriorityDao.class);
+ expect(rnsdaoMock.findInTx(true, -1, 0)).andReturn(rnpList);
+ replay(rnsdaoMock);
+ return rnsdaoMock;
+ }
+
private static RefBranchDao createBranchDaoMock(List<RefBranch> rbList) {
RefBranchDao rbdaoMock = PowerMock.createNiceMock(RefBranchDao.class);
expect(rbdaoMock.findInTx(true, -1, 0)).andReturn(rbList);
@@ -89,6 +106,11 @@
refGridTerritories.add(newRefGridTerritory(2, "OF", "Offenbach", 1));
RefGridTerritoryDao refGridTerritoryDao = createRefGridTerritoryDaoMock(refGridTerritories);
- return new NotificationMapper(rnsDao, rbDao, refGridTerritoryDao);
+ List<RefNotificationPriority> priorityList = new LinkedList<>();
+ priorityList.add(newPriorityItem(1,"Wichtig", 1));
+ priorityList.add(newPriorityItem(2,"Information", 2));
+ RefNotificationPriorityDao priorityDaoMock = createPriorityDaoMock(priorityList);
+
+ return new NotificationMapper(rnsDao, rbDao, refGridTerritoryDao, priorityDaoMock);
}
}