From a33e1d71d69c63278879d46deeb4be1e2ee57395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Wed, 1 Jul 2020 11:24:22 +0200 Subject: [PATCH 01/10] Update dependencies --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8fa8542..6e213c5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.ontimize.boot ontimize-boot-parent - 1.1.0 + 1.1.1 com.ontimize From e56dfaa8d39f834bb125ed5472b285cf32332e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Mon, 22 Jun 2020 16:38:07 +0200 Subject: [PATCH 02/10] Exercise 1, 2, 3: Prerequisites - Maven - Basic Project, Structure of an Ontimize Boot application, Understanding the application.yml file --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0728b6b..162019c 100644 --- a/.gitignore +++ b/.gitignore @@ -92,7 +92,8 @@ local.properties # Uncomment this line if you wish to ignore the project description file. # Typically, this file would be tracked if it contains build/dependency configurations: -#.project +.project +.classpath ### Eclipse Patch ### # Spring Boot Tooling @@ -220,3 +221,7 @@ buildNumber.properties .history # End of https://www.toptal.com/developers/gitignore/api/maven,eclipse,angular,intellij,visualstudiocode + +model/src/main/db/templateDB.lck +model/src/main/db/templateDB.log +model/src/main/db/templateDB.properties \ No newline at end of file From 821cb566e5d24204041b972380dee87b0edf5c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Mon, 22 Jun 2020 17:18:24 +0200 Subject: [PATCH 03/10] Exercise 4: Creating DAO, Service, Controller --- ...mize Boot Training.postman_collection.json | 271 ++++++++++++++++++ .../api/core/service/ICandidateService.java | 17 ++ model/src/main/db/templateDB.script | 127 ++++++++ model/src/main/db/templateDB.txt | 19 +- .../ontimize/model/core/dao/CandidateDao.java | 33 +++ .../model/core/service/CandidateService.java | 45 +++ model/src/main/resources/dao/CandidateDao.xml | 15 + .../ws/core/rest/CandidateRestController.java | 23 ++ 8 files changed, 549 insertions(+), 1 deletion(-) create mode 100644 Ontimize Boot Training.postman_collection.json create mode 100644 api/src/main/java/com/ontimize/api/core/service/ICandidateService.java create mode 100644 model/src/main/db/templateDB.script create mode 100644 model/src/main/java/com/ontimize/model/core/dao/CandidateDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/service/CandidateService.java create mode 100644 model/src/main/resources/dao/CandidateDao.xml create mode 100644 ws/src/main/java/com/ontimize/ws/core/rest/CandidateRestController.java diff --git a/Ontimize Boot Training.postman_collection.json b/Ontimize Boot Training.postman_collection.json new file mode 100644 index 0000000..07c5a43 --- /dev/null +++ b/Ontimize Boot Training.postman_collection.json @@ -0,0 +1,271 @@ +{ + "info": { + "_postman_id": "66b8d05b-4d9c-4acc-81bf-82fd5c095ce1", + "name": "Ontimize Boot Training", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Candidates", + "item": [ + { + "name": "candidate -C", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "demouser", + "type": "string" + }, + { + "key": "username", + "value": "demo", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"PHONE\": \"555-444-8888\",\n \"BIRTHDAY\": 788224700000,\n \"SURNAME\": \"Wilson\",\n \"EMAIL\": \"wwiilsoon@example.org\",\n \"SPECIALTIES\": \"C#\",\n \"NAME\": \"William\",\n \"DNI\": \"88643946Z\"\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EXPERIENCE_LEVEL\": 4,\n \"STATUS\": 4,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"ORIGIN\": 4,\n \"EDUCATION\": 4,\n \"COMMENT\": 12,\n \"PROFILE\": 4,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/candidates/candidate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "candidates", + "candidate" + ] + } + }, + "response": [] + }, + { + "name": "candidate -R", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "demouser", + "type": "string" + }, + { + "key": "username", + "value": "demo", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:33333/candidates/candidate?columns=ID,NAME,SURNAME,BIRTHDAY,DNI,PHONE,EMAIL,EDUCATION,SPECIALTIES,STATUS,ORIGIN,WAGE_LEVEL,EXPERIENCE_LEVEL,PROFILE,COMMENT,LINKEDIN", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "candidates", + "candidate" + ], + "query": [ + { + "key": "columns", + "value": "ID,NAME,SURNAME,BIRTHDAY,DNI,PHONE,EMAIL,EDUCATION,SPECIALTIES,STATUS,ORIGIN,WAGE_LEVEL,EXPERIENCE_LEVEL,PROFILE,COMMENT,LINKEDIN" + } + ] + } + }, + "response": [] + }, + { + "name": "candidate -R (complex)", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "demouser", + "type": "string" + }, + { + "key": "username", + "value": "demo", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \t\"ID\": 0\n },\n \"columns\": [\n \"ID\",\n \"NAME\",\n \"SURNAME\",\n \"BIRTHDAY\",\n \"DNI\",\n \"PHONE\",\n \"EMAIL\",\n \"EDUCATION\",\n \"SPECIALTIES\",\n \"STATUS\",\n \"ORIGIN\",\n \"WAGE_LEVEL\",\n \"EXPERIENCE_LEVEL\",\n \"PROFILE\",\n \"COMMENT\",\n \"LINKEDIN\"\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/candidates/candidate/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "candidates", + "candidate", + "search" + ] + } + }, + "response": [] + }, + { + "name": "candidate -U", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "demouser", + "type": "string" + }, + { + "key": "username", + "value": "demo", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\" :{\n\t\t\"ID\" :15\n\t},\n \"data\": {\n \"EMAIL\": \"wwilson@example.org\"\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EXPERIENCE_LEVEL\": 4,\n \"STATUS\": 4,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"ORIGIN\": 4,\n \"EDUCATION\": 4,\n \"COMMENT\": 12,\n \"PROFILE\": 4,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/candidates/candidate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "candidates", + "candidate" + ] + } + }, + "response": [] + }, + { + "name": "candidate -D", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "demouser", + "type": "string" + }, + { + "key": "username", + "value": "demo", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\" :{\n\t\t\"ID\" :15\n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/candidates/candidate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "candidates", + "candidate" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + } + ], + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "demouser", + "type": "string" + }, + { + "key": "username", + "value": "demo", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "id": "da23bd76-51cd-4551-be67-de10f86ae2cd", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "e3e834ee-d7cc-4c03-bdf7-c38cabd4982b", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {} +} \ No newline at end of file diff --git a/api/src/main/java/com/ontimize/api/core/service/ICandidateService.java b/api/src/main/java/com/ontimize/api/core/service/ICandidateService.java new file mode 100644 index 0000000..228a4f6 --- /dev/null +++ b/api/src/main/java/com/ontimize/api/core/service/ICandidateService.java @@ -0,0 +1,17 @@ +package com.ontimize.api.core.service; + +import java.util.List; +import java.util.Map; + +import com.ontimize.db.EntityResult; +import com.ontimize.jee.common.exceptions.OntimizeJEERuntimeException; + +public interface ICandidateService { + + // CANDIDATE + public EntityResult candidateQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult candidateInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult candidateUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult candidateDelete(Map keyMap) throws OntimizeJEERuntimeException; + +} \ No newline at end of file diff --git a/model/src/main/db/templateDB.script b/model/src/main/db/templateDB.script new file mode 100644 index 0000000..b280789 --- /dev/null +++ b/model/src/main/db/templateDB.script @@ -0,0 +1,127 @@ +SET DATABASE UNIQUE NAME HSQLDB687727E49B +SET DATABASE GC 0 +SET DATABASE DEFAULT RESULT MEMORY ROWS 0 +SET DATABASE EVENT LOG LEVEL 0 +SET DATABASE TRANSACTION CONTROL LOCKS +SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED +SET DATABASE TRANSACTION ROLLBACK ON CONFLICT TRUE +SET DATABASE TEXT TABLE DEFAULTS '' +SET DATABASE SQL NAMES FALSE +SET DATABASE SQL REFERENCES FALSE +SET DATABASE SQL SIZE TRUE +SET DATABASE SQL TYPES FALSE +SET DATABASE SQL TDC DELETE TRUE +SET DATABASE SQL TDC UPDATE TRUE +SET DATABASE SQL TRANSLATE TTI TYPES TRUE +SET DATABASE SQL TRANSLATE TTI TYPES TRUE +SET DATABASE SQL CONCAT NULLS TRUE +SET DATABASE SQL UNIQUE NULLS TRUE +SET DATABASE SQL CONVERT TRUNCATE TRUE +SET DATABASE SQL AVG SCALE 0 +SET DATABASE SQL DOUBLE NAN TRUE +SET FILES WRITE DELAY 500 MILLIS +SET FILES BACKUP INCREMENT TRUE +SET FILES CACHE SIZE 10000 +SET FILES CACHE ROWS 50000 +SET FILES SCALE 32 +SET FILES LOB SCALE 32 +SET FILES DEFRAG 0 +SET FILES NIO TRUE +SET FILES NIO SIZE 256 +SET FILES LOG TRUE +SET FILES LOG SIZE 50 +CREATE USER SA PASSWORD DIGEST 'd41d8cd98f00b204e9800998ecf8427e' +ALTER USER SA SET LOCAL TRUE +CREATE SCHEMA PUBLIC AUTHORIZATION DBA +SET SCHEMA PUBLIC +CREATE MEMORY TABLE PUBLIC.TUSER(USER_ VARCHAR(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR(50),NAME VARCHAR(50),SURNAME VARCHAR(50),EMAIL VARCHAR(50),NIF VARCHAR(50),USERBLOCKED TIMESTAMP,LASTPASSWORDUPDATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,FIRSTLOGIN BOOLEAN DEFAULT TRUE) +CREATE MEMORY TABLE PUBLIC.TROLE(ID_ROLENAME INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ROLENAME VARCHAR(255),XMLCLIENTPERMISSION VARCHAR(16777216)) +ALTER TABLE PUBLIC.TROLE ALTER COLUMN ID_ROLENAME RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.TUSER_ROLE(ID_USER_ROLE INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_ROLENAME INTEGER,USER_ VARCHAR(50),CONSTRAINT FK_TUSER FOREIGN KEY(USER_) REFERENCES PUBLIC.TUSER(USER_),CONSTRAINT FK_TROLE FOREIGN KEY(ID_ROLENAME) REFERENCES PUBLIC.TROLE(ID_ROLENAME)) +ALTER TABLE PUBLIC.TUSER_ROLE ALTER COLUMN ID_USER_ROLE RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.TSERVER_PERMISSION(ID_SERVER_PERMISSION INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PERMISSION_NAME VARCHAR(16777216)) +ALTER TABLE PUBLIC.TSERVER_PERMISSION ALTER COLUMN ID_SERVER_PERMISSION RESTART WITH 17 +CREATE MEMORY TABLE PUBLIC.TREQUEST_STATISTICS(ID_REQUEST_STATISTICS INTEGER NOT NULL PRIMARY KEY,SERVICE_NAME VARCHAR(255),METHOD_NAME VARCHAR(50),USER_NAME VARCHAR(50),EXECUTION_DATE DATE,EXECUTION_TIME INTEGER,METHOD_PARAMS VARCHAR(5000),SERVICE_EXCEPTION VARCHAR(5000)) +CREATE MEMORY TABLE PUBLIC.TSETTING(ID_SETTING INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,SETTING_KEY VARCHAR(16777216),SETTING_VALUE VARCHAR(16777216),SETTING_COMMENT VARCHAR(16777216)) +ALTER TABLE PUBLIC.TSETTING ALTER COLUMN ID_SETTING RESTART WITH 8 +CREATE MEMORY TABLE PUBLIC.TUSER_PREFERENCE(ID_USER_PREFERENCE INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PREFERENCE_NAME VARCHAR(150),USER_LOGIN VARCHAR(150),PREFERENCE_VALUE VARCHAR(16777216)) +ALTER TABLE PUBLIC.TUSER_PREFERENCE ALTER COLUMN ID_USER_PREFERENCE RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.TI18N(ID_I18N INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,CLASS_NAME VARCHAR(150),I18N_DESCRIPTION VARCHAR(250)) +ALTER TABLE PUBLIC.TI18N ALTER COLUMN ID_I18N RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.TI18N_VALUE(ID_I18N_VALUE INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_I18N INTEGER NOT NULL,"KEY" VARCHAR(250),ES_ES VARCHAR(16777216),EN_US VARCHAR(16777216),GL_ES VARCHAR(16777216)) +ALTER TABLE PUBLIC.TI18N_VALUE ALTER COLUMN ID_I18N_VALUE RESTART WITH 34 +CREATE MEMORY TABLE PUBLIC.TROLE_SERVER_PERMISSION(ID_ROLE_SERVER_PERMISSION INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_ROLENAME INTEGER,ID_SERVER_PERMISSION INTEGER,CONSTRAINT FK_TROLE_SERVER_PERMISSION FOREIGN KEY(ID_ROLENAME) REFERENCES PUBLIC.TROLE(ID_ROLENAME),CONSTRAINT FK_TSERVER_PERMISSION FOREIGN KEY(ID_SERVER_PERMISSION) REFERENCES PUBLIC.TSERVER_PERMISSION(ID_SERVER_PERMISSION)) +ALTER TABLE PUBLIC.TROLE_SERVER_PERMISSION ALTER COLUMN ID_ROLE_SERVER_PERMISSION RESTART WITH 17 +CREATE MEMORY TABLE PUBLIC.CANDIDATE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PHOTO VARBINARY(16777216),NAME VARCHAR(255),SURNAME VARCHAR(255),BIRTHDAY DATE,DNI VARCHAR(255),PHONE VARCHAR(255),EMAIL VARCHAR(255),EDUCATION INTEGER,SPECIALTIES VARCHAR(255),STATUS INTEGER,ORIGIN INTEGER,WAGE_LEVEL NUMERIC(128),EXPERIENCE_LEVEL INTEGER,PROFILE INTEGER,COMMENT VARCHAR(255),LINKEDIN VARCHAR(255)) +ALTER TABLE PUBLIC.CANDIDATE ALTER COLUMN ID RESTART WITH 15 +ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1 +SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC +GRANT DBA TO SA +SET SCHEMA SYSTEM_LOBS +INSERT INTO BLOCKS VALUES(0,2147483647,0) +SET SCHEMA PUBLIC +INSERT INTO TUSER VALUES('demo','demouser','demo','demo',NULL,'44460713B',NULL,NULL,NULL) +INSERT INTO TROLE VALUES(0,'admin','') +INSERT INTO TUSER_ROLE VALUES(0,0,'demo') +INSERT INTO TSERVER_PERMISSION VALUES(0,'com.ontimize.jee.common.services.user.IUserInformationService/getUserInformation') +INSERT INTO TSERVER_PERMISSION VALUES(1,'com.ontimize.jee.common.services.mail.IMailService/sendMail') +INSERT INTO TSERVER_PERMISSION VALUES(2,'com.ontimize.jee.common.services.mail.IMailService/sendMailWithoutAttach') +INSERT INTO TSERVER_PERMISSION VALUES(3,'com.ontimize.jee.common.services.i18n.II18nService/getAvailableBundles') +INSERT INTO TSERVER_PERMISSION VALUES(4,'com.ontimize.jee.common.services.i18n.II18nService/getBundle') +INSERT INTO TSERVER_PERMISSION VALUES(5,'com.ontimize.jee.common.services.i18n.II18nService/getBundles') +INSERT INTO TSERVER_PERMISSION VALUES(6,'com.ontimize.jee.common.services.i18n.II18nService/getAllResourceBundles') +INSERT INTO TSERVER_PERMISSION VALUES(7,'com.ontimize.jee.common.services.i18n.II18nService/getAvailableLocales') +INSERT INTO TSERVER_PERMISSION VALUES(8,'com.ontimize.jee.common.services.i18n.II18nService/updateBundleValues') +INSERT INTO TSERVER_PERMISSION VALUES(9,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/getPreference') +INSERT INTO TSERVER_PERMISSION VALUES(10,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/getDefaultPreference') +INSERT INTO TSERVER_PERMISSION VALUES(11,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/setPreference') +INSERT INTO TSERVER_PERMISSION VALUES(12,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/setDefaultPreference') +INSERT INTO TSERVER_PERMISSION VALUES(13,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/savePreferences') +INSERT INTO TSERVER_PERMISSION VALUES(14,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/loadPreferences') +INSERT INTO TSERVER_PERMISSION VALUES(15,'com.ontimize.jee.common.services.i18n.II18nService/deleteBundleValues') +INSERT INTO TSETTING VALUES(0,'mail_host','smtp.gmail.com','Host del servidor') +INSERT INTO TSETTING VALUES(1,'mail_port','587','Puerto del servidor de email') +INSERT INTO TSETTING VALUES(2,'mail_protocol','smtp','Protocolo de env\u005cu00edo de mails') +INSERT INTO TSETTING VALUES(3,'mail_user','mi.mail@example.com','Usuario para el env\u005cu00edo de mails') +INSERT INTO TSETTING VALUES(4,'mail_password','mis_credenciales','Password del servidor de mail') +INSERT INTO TSETTING VALUES(5,'mail_encoding','UTF-8','Codificaci\u005cu00f3n de mails') +INSERT INTO TSETTING VALUES(6,'mail_properties','mail.smtp.auth:true;mail.smtp.starttls.enable:true;','Propiedades de mails') +INSERT INTO TSETTING VALUES(7,'report_folder','C:/applications/ontimize-boot-app/reports','Carpeta de las plantillas de report') +INSERT INTO TUSER_PREFERENCE VALUES(0,'user_preference','demo','Iw0KI1R1ZSBNYXkgMTYgMTI6NTc6MDYgQ0VTVCAyMDE3DQpkZW1vX2FwcF9zdGF0dXNfYmFyX3Zpc2libGU9eWVzDQpkZW1vX2FkanVzdF90cmVlX3NwYWNlPXRydWUNCmRlbW9fYXBwX3dpbmRvd19zdGF0ZT0wDQpkZW1vX3RhYmxlX2NvbmZfc29ydF9maWx0ZXJfZm9ybUN1c3RvbWVyLnhtbF9DdXN0b21lclNlcnZpY2UuY3VzdG9tZXJfVEVTVD1udWxsO251bGw7U1VSTkFNRVw9OThcOjF8SURcPTc1XDoyfE5BTUVcPTk5XDozfENVU1RPTUVSVFlQRUlEXD0wXDo0fENVU1RPTUVSSURcPTEyNVw6NXxBRERSRVNTXD0xMjNcOjZ8UEhPTkVcPTEyMVw6N3xTVEFSVERBVEVcPTEzNlw6OHxMT05HSVRVREVcPTExNlw6OXxMQVRJVFVERVw9MTEzXDoxMHxFTUFJTFw9MTcwXDoxMnw7QkFTRTY0ck8wQUJYTnlBQk5xWVhaaExuVjBhV3d1U0dGemFIUmhZbXhsRTdzUEpTRks1TGdEQUFKR0FBcHNiMkZrUm1GamRHOXlTUUFKZEdoeVpYTm9iMnhrZUhBL1FBQUFBQUFBQ0hjSUFBQUFDd0FBQUFCNA0KZGVtb190YWJsZV9jb25mX3NvcnRfZmlsdGVyX2NvbmZpZ3VyYXRpb25zX2Zvcm1DdXN0b21lci54bWxfQ3VzdG9tZXJTZXJ2aWNlLmN1c3RvbWVyPVRFU1QNCmRlbW9fdGFibGVfY29udHJvbF9wYW5lbF9mb3JtQWNjb3VudHMtZGV0YWlsLnhtbF9Nb3ZlbWVudFNlcnZpY2UubW92ZW1lbnQ9Z3JvdXB0YWJsZWtleTtkZWZhdWx0Y2hhcnRidXR0b247ZXhjZWxleHBvcnRidXR0b247c3Vtcm93YnV0dG9uO2NhbGN1bGVkY29sc2J1dHRvbjtwcmludGluZ2J1dHRvbjtmaWx0ZXJzYXZlYnV0dG9uO3Zpc2libGVjb2xzYnV0dG9uO2h0bWxleHBvcnRidXR0b247Y29weWJ1dHRvbjtncm91cHRhYmxla2V5O2luc2VydGJ1dHRvbjtyZWZyZXNoYnV0dG9uDQpkZW1vX2Zvcm1CcmFuY2hlcy1kZXRhaWwueG1sPTg4MDs1MDU7LTExNTA7MzY5DQpkZW1vX2RldGFpbF9kaWFsb2dfc2l6ZV9wb3NpdGlvbl9mb3JtQ3VzdG9tZXIueG1sX0N1c3RvbWVyU2VydmljZS5jdXN0b21lcj03NDk7MzUwOy0xOTA1OzM5MQ0KZGVtb19hcHBfdG9vbGJhcl9sb2NhdGlvbj1Ob3J0aA0KZGVtb19hcHBfd2luZG93X3Bvc2l0aW9uPS0xNTgwOzExDQpkZW1vX2FwcF93aW5kb3dfc2l6ZT0xNTg0OzEwNDQNCmRlbW9fZm9ybUVtcGxveWVlcy1kZXRhaWwueG1sPTExMTY7NzM5OzYxMDsxOTUNCmRlbW9fZm9ybUFjY291bnRzLWRldGFpbC54bWw9OTE1OzUwMDstMTE1MDszNjkNCg==') +INSERT INTO TI18N VALUES(0,'i18n.bundle','Resource bundle in database') +INSERT INTO TROLE_SERVER_PERMISSION VALUES(0,0,0) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(1,0,1) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(2,0,2) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(3,0,3) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(4,0,4) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(5,0,5) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(6,0,6) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(7,0,7) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(8,0,8) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(9,0,9) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(10,0,10) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(11,0,11) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(12,0,12) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(13,0,13) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(14,0,14) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(15,0,15) +INSERT INTO CANDIDATE VALUES(0,NULL,'Nonnah','Baden','1994-12-24','71958681F','591-646-5605','nbaden0@plala.or.jp',NULL,'Erlang',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(1,NULL,'Claiborn','Shawell','1989-08-01','28224678K','909-780-3858','cshawell1@chron.com',NULL,'JavaFX',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(2,NULL,'Anne-marie','Frampton','1985-12-17','48230973L','466-225-8193','aframpton2@addtoany.com',NULL,'Matlab',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(3,NULL,'Aron','Wiseman','1981-09-08','75760366E','969-405-2922','awiseman3@google.com.br',NULL,'Compliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(4,NULL,'Hyatt','Faircley','1977-05-25','14709704P','375-972-2164','hfaircley4@sbwire.com',NULL,'Haskell',NULL,NULL,45000,NULL,NULL,'nulla pede ullamcorper augue a suscipit nulla elit ac nulla',NULL) +INSERT INTO CANDIDATE VALUES(5,NULL,'Daune','Woolham','1978-06-21','50472212T','675-891-2878','dwoolham5@stanford.edu',NULL,'React',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(6,NULL,'Kaila','Earwicker','1988-04-26','90445706T','642-759-7346','kearwicker6@sogou.com',NULL,'HTML5',NULL,NULL,23000,NULL,NULL,'ut ultrices vel augue vestibulum ante ipsum primis in faucibus',NULL) +INSERT INTO CANDIDATE VALUES(7,NULL,'Felisha','Rahl','1990-05-28','76140170G','712-914-9094','frahl7@ox.ac.uk',NULL,'Docker',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(8,NULL,'Charla','Note','1981-11-27','41685146S','284-789-0755','cnote8@cafepress.com',NULL,'MS Office',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(9,NULL,'Candie','Ibert','1978-09-24','00273718H','299-578-6249','cibert9@apple.com',NULL,'Taxation',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(10,NULL,'Kelcy','Lathleiffure','1991-04-19','73696168M','890-133-5541','klathleiffurea@miibeian.gov.cn',NULL,'Ruby',NULL,NULL,33500,NULL,NULL,'nulla sed accumsan felis ut at dolor quis odio consequat',NULL) +INSERT INTO CANDIDATE VALUES(11,NULL,'Kaleena','Jonk','1994-09-28','76619635B','956-957-8235','kjonkb@e-recht24.de',NULL,'Design',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(12,NULL,'Tami','Scorton','1977-09-25','12571372D','599-466-8570','tscortonc@photobucket.com',NULL,'Compliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(13,NULL,'Davin','Frowde','1984-03-06','96529753H','396-303-0612','dfrowded@webs.com',NULL,'React',NULL,NULL,22000,NULL,NULL,'porta volutpat erat quisque erat eros viverra eget congue eget semper',NULL) +INSERT INTO CANDIDATE VALUES(14,NULL,'Kial','Titlow','1980-05-06','27680562Q','591-499-8814','ktitlowe@telegraph.co.uk',NULL,'HTML5',NULL,NULL,NULL,NULL,NULL,NULL,NULL) diff --git a/model/src/main/db/templateDB.txt b/model/src/main/db/templateDB.txt index a75d61e..b280789 100644 --- a/model/src/main/db/templateDB.txt +++ b/model/src/main/db/templateDB.txt @@ -52,6 +52,8 @@ CREATE MEMORY TABLE PUBLIC.TI18N_VALUE(ID_I18N_VALUE INTEGER GENERATED BY DEFAUL ALTER TABLE PUBLIC.TI18N_VALUE ALTER COLUMN ID_I18N_VALUE RESTART WITH 34 CREATE MEMORY TABLE PUBLIC.TROLE_SERVER_PERMISSION(ID_ROLE_SERVER_PERMISSION INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_ROLENAME INTEGER,ID_SERVER_PERMISSION INTEGER,CONSTRAINT FK_TROLE_SERVER_PERMISSION FOREIGN KEY(ID_ROLENAME) REFERENCES PUBLIC.TROLE(ID_ROLENAME),CONSTRAINT FK_TSERVER_PERMISSION FOREIGN KEY(ID_SERVER_PERMISSION) REFERENCES PUBLIC.TSERVER_PERMISSION(ID_SERVER_PERMISSION)) ALTER TABLE PUBLIC.TROLE_SERVER_PERMISSION ALTER COLUMN ID_ROLE_SERVER_PERMISSION RESTART WITH 17 +CREATE MEMORY TABLE PUBLIC.CANDIDATE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PHOTO VARBINARY(16777216),NAME VARCHAR(255),SURNAME VARCHAR(255),BIRTHDAY DATE,DNI VARCHAR(255),PHONE VARCHAR(255),EMAIL VARCHAR(255),EDUCATION INTEGER,SPECIALTIES VARCHAR(255),STATUS INTEGER,ORIGIN INTEGER,WAGE_LEVEL NUMERIC(128),EXPERIENCE_LEVEL INTEGER,PROFILE INTEGER,COMMENT VARCHAR(255),LINKEDIN VARCHAR(255)) +ALTER TABLE PUBLIC.CANDIDATE ALTER COLUMN ID RESTART WITH 15 ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1 SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC @@ -107,4 +109,19 @@ INSERT INTO TROLE_SERVER_PERMISSION VALUES(11,0,11) INSERT INTO TROLE_SERVER_PERMISSION VALUES(12,0,12) INSERT INTO TROLE_SERVER_PERMISSION VALUES(13,0,13) INSERT INTO TROLE_SERVER_PERMISSION VALUES(14,0,14) -INSERT INTO TROLE_SERVER_PERMISSION VALUES(15,0,15) \ No newline at end of file +INSERT INTO TROLE_SERVER_PERMISSION VALUES(15,0,15) +INSERT INTO CANDIDATE VALUES(0,NULL,'Nonnah','Baden','1994-12-24','71958681F','591-646-5605','nbaden0@plala.or.jp',NULL,'Erlang',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(1,NULL,'Claiborn','Shawell','1989-08-01','28224678K','909-780-3858','cshawell1@chron.com',NULL,'JavaFX',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(2,NULL,'Anne-marie','Frampton','1985-12-17','48230973L','466-225-8193','aframpton2@addtoany.com',NULL,'Matlab',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(3,NULL,'Aron','Wiseman','1981-09-08','75760366E','969-405-2922','awiseman3@google.com.br',NULL,'Compliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(4,NULL,'Hyatt','Faircley','1977-05-25','14709704P','375-972-2164','hfaircley4@sbwire.com',NULL,'Haskell',NULL,NULL,45000,NULL,NULL,'nulla pede ullamcorper augue a suscipit nulla elit ac nulla',NULL) +INSERT INTO CANDIDATE VALUES(5,NULL,'Daune','Woolham','1978-06-21','50472212T','675-891-2878','dwoolham5@stanford.edu',NULL,'React',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(6,NULL,'Kaila','Earwicker','1988-04-26','90445706T','642-759-7346','kearwicker6@sogou.com',NULL,'HTML5',NULL,NULL,23000,NULL,NULL,'ut ultrices vel augue vestibulum ante ipsum primis in faucibus',NULL) +INSERT INTO CANDIDATE VALUES(7,NULL,'Felisha','Rahl','1990-05-28','76140170G','712-914-9094','frahl7@ox.ac.uk',NULL,'Docker',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(8,NULL,'Charla','Note','1981-11-27','41685146S','284-789-0755','cnote8@cafepress.com',NULL,'MS Office',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(9,NULL,'Candie','Ibert','1978-09-24','00273718H','299-578-6249','cibert9@apple.com',NULL,'Taxation',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(10,NULL,'Kelcy','Lathleiffure','1991-04-19','73696168M','890-133-5541','klathleiffurea@miibeian.gov.cn',NULL,'Ruby',NULL,NULL,33500,NULL,NULL,'nulla sed accumsan felis ut at dolor quis odio consequat',NULL) +INSERT INTO CANDIDATE VALUES(11,NULL,'Kaleena','Jonk','1994-09-28','76619635B','956-957-8235','kjonkb@e-recht24.de',NULL,'Design',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(12,NULL,'Tami','Scorton','1977-09-25','12571372D','599-466-8570','tscortonc@photobucket.com',NULL,'Compliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO CANDIDATE VALUES(13,NULL,'Davin','Frowde','1984-03-06','96529753H','396-303-0612','dfrowded@webs.com',NULL,'React',NULL,NULL,22000,NULL,NULL,'porta volutpat erat quisque erat eros viverra eget congue eget semper',NULL) +INSERT INTO CANDIDATE VALUES(14,NULL,'Kial','Titlow','1980-05-06','27680562Q','591-499-8814','ktitlowe@telegraph.co.uk',NULL,'HTML5',NULL,NULL,NULL,NULL,NULL,NULL,NULL) diff --git a/model/src/main/java/com/ontimize/model/core/dao/CandidateDao.java b/model/src/main/java/com/ontimize/model/core/dao/CandidateDao.java new file mode 100644 index 0000000..08cd374 --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/CandidateDao.java @@ -0,0 +1,33 @@ +package com.ontimize.model.core.dao; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("CandidateDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/CandidateDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class CandidateDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID = "ID"; + public static final String ATTR_PHOTO = "PHOTO"; + public static final String ATTR_NAME = "NAME"; + public static final String ATTR_SURNAME = "SURNAME"; + public static final String ATTR_BIRTHDAY = "BIRTHDAY"; + public static final String ATTR_DNI = "DNI"; + public static final String ATTR_PHONE = "PHONE"; + public static final String ATTR_EMAIL = "EMAIL"; + public static final String ATTR_EDUCATION = "EDUCATION"; + public static final String ATTR_SPECIALTIES = "SPECIALTIES"; + public static final String ATTR_STATUS = "STATUS"; + public static final String ATTR_ORIGIN = "ORIGIN"; + public static final String ATTR_WAGE_LEVEL = "WAGE_LEVEL"; + public static final String ATTR_EXPERIENCE_LEVEL = "EXPERIENCE_LEVEL"; + public static final String ATTR_PROFILE = "PROFILE"; + public static final String ATTR_COMMENT = "COMMENT"; + public static final String ATTR_LINKEDIN = "LINKEDIN"; + + +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/service/CandidateService.java b/model/src/main/java/com/ontimize/model/core/service/CandidateService.java new file mode 100644 index 0000000..f5332e7 --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/service/CandidateService.java @@ -0,0 +1,45 @@ +package com.ontimize.model.core.service; + +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import com.ontimize.api.core.service.ICandidateService; +import com.ontimize.db.EntityResult; +import com.ontimize.jee.common.exceptions.OntimizeJEERuntimeException; +import com.ontimize.jee.server.dao.DefaultOntimizeDaoHelper; +import com.ontimize.model.core.dao.CandidateDao; + +@Service("CandidateService") +@Lazy +public class CandidateService implements ICandidateService{ + + @Autowired private CandidateDao candidateDao; + @Autowired private DefaultOntimizeDaoHelper daoHelper; + + @Override + public EntityResult candidateQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.candidateDao, keyMap, attrList); + } + + @Override + public EntityResult candidateInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.candidateDao, attrMap); + } + + @Override + public EntityResult candidateUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.candidateDao, attrMap, keyMap); + } + + @Override + public EntityResult candidateDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.candidateDao, keyMap); + } + +} \ No newline at end of file diff --git a/model/src/main/resources/dao/CandidateDao.xml b/model/src/main/resources/dao/CandidateDao.xml new file mode 100644 index 0000000..d36917f --- /dev/null +++ b/model/src/main/resources/dao/CandidateDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/ws/src/main/java/com/ontimize/ws/core/rest/CandidateRestController.java b/ws/src/main/java/com/ontimize/ws/core/rest/CandidateRestController.java new file mode 100644 index 0000000..f377c0e --- /dev/null +++ b/ws/src/main/java/com/ontimize/ws/core/rest/CandidateRestController.java @@ -0,0 +1,23 @@ +package com.ontimize.ws.core.rest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ontimize.api.core.service.ICandidateService; +import com.ontimize.jee.server.rest.ORestController; + +@RestController +@RequestMapping("/candidates") +@ComponentScan(basePackageClasses = { com.ontimize.api.core.service.ICandidateService.class }) +public class CandidateRestController extends ORestController { + + @Autowired + private ICandidateService candidateService; + + @Override + public ICandidateService getService() { + return this.candidateService; + } +} \ No newline at end of file From 7d8c30e1259ebaf5ce368de463c06b5ac840303d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Tue, 23 Jun 2020 09:27:10 +0200 Subject: [PATCH 04/10] Exercise 5, 6: Service master, Understanding the EntityResult --- ...mize Boot Training.postman_collection.json | 756 ++++++++++++++++++ .../api/core/service/IMasterService.java | 40 + model/src/main/db/templateDB.script | 20 + model/src/main/db/templateDB.txt | 20 + .../ontimize/model/core/dao/CandidateDao.java | 35 +- .../ontimize/model/core/dao/EducationDao.java | 16 + .../model/core/dao/ExperienceLevelDao.java | 16 + .../ontimize/model/core/dao/OriginDao.java | 16 + .../ontimize/model/core/dao/ProfileDao.java | 16 + .../ontimize/model/core/dao/StatusDao.java | 16 + .../model/core/service/MasterService.java | 141 ++++ model/src/main/resources/dao/EducationDao.xml | 15 + .../main/resources/dao/ExperienceLevelDao.xml | 15 + model/src/main/resources/dao/OriginDao.xml | 15 + model/src/main/resources/dao/ProfileDao.xml | 15 + model/src/main/resources/dao/StatusDao.xml | 15 + .../ws/core/rest/MasterRestController.java | 24 + 17 files changed, 1173 insertions(+), 18 deletions(-) create mode 100644 api/src/main/java/com/ontimize/api/core/service/IMasterService.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/EducationDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/ExperienceLevelDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/OriginDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/ProfileDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/StatusDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/service/MasterService.java create mode 100644 model/src/main/resources/dao/EducationDao.xml create mode 100644 model/src/main/resources/dao/ExperienceLevelDao.xml create mode 100644 model/src/main/resources/dao/OriginDao.xml create mode 100644 model/src/main/resources/dao/ProfileDao.xml create mode 100644 model/src/main/resources/dao/StatusDao.xml create mode 100644 ws/src/main/java/com/ontimize/ws/core/rest/MasterRestController.java diff --git a/Ontimize Boot Training.postman_collection.json b/Ontimize Boot Training.postman_collection.json index 07c5a43..84fee9e 100644 --- a/Ontimize Boot Training.postman_collection.json +++ b/Ontimize Boot Training.postman_collection.json @@ -228,6 +228,762 @@ } ], "protocolProfileBehavior": {} + }, + { + "name": "Masters", + "item": [ + { + "name": "Education", + "item": [ + { + "name": "education -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"DESCRIPTION\": \"Degree in TSE\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/education", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "education" + ] + } + }, + "response": [] + }, + { + "name": "education -R", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:33333/master/education?columns=ID,DESCRIPTION", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "education" + ], + "query": [ + { + "key": "columns", + "value": "ID,DESCRIPTION" + } + ] + } + }, + "response": [] + }, + { + "name": "education -R (complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n\t\t\"ID\": 0\n\t},\n\t\"columns\": [\"DESCRIPTION\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/education/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "education", + "search" + ] + } + }, + "response": [] + }, + { + "name": "education -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\":{\n \t\"ID\":\t1\n },\n \"data\": {\n \"DESCRIPTION\": \"Degree in Telecommunications Systems Engineering\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/education", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "education" + ] + } + }, + "response": [] + }, + { + "name": "education -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\":{\n \t\"ID\":\t1\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/education", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "education" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Experience Level", + "item": [ + { + "name": "experienceLevel -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"DESCRIPTION\": \"Experienced\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/experienceLevel", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "experienceLevel" + ] + } + }, + "response": [] + }, + { + "name": "experienceLevel -R", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:33333/master/experienceLevel?columns=ID,DESCRIPTION", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "experienceLevel" + ], + "query": [ + { + "key": "columns", + "value": "ID,DESCRIPTION" + } + ] + } + }, + "response": [] + }, + { + "name": "experienceLevel -R (complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n\t\t\"ID\": 0\n\t},\n\t\"columns\": [\"DESCRIPTION\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/experienceLevel/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "experienceLevel", + "search" + ] + } + }, + "response": [] + }, + { + "name": "experienceLevel -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \"ID\": 1\n },\n \"data\": {\n \"DESCRIPTION\": \"Senior\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/experienceLevel", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "experienceLevel" + ] + } + }, + "response": [] + }, + { + "name": "experienceLevel -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\":{\n \t\"ID\":\t1\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/experienceLevel", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "experienceLevel" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Origin", + "item": [ + { + "name": "origin -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"DESCRIPTION\": \"Web\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/origin", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "origin" + ] + } + }, + "response": [] + }, + { + "name": "origin -R", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:33333/master/origin?columns=ID,DESCRIPTION", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "origin" + ], + "query": [ + { + "key": "columns", + "value": "ID,DESCRIPTION" + } + ] + } + }, + "response": [] + }, + { + "name": "origin -R (complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n\t\t\"ID\": 0\n\t},\n\t\"columns\": [\"DESCRIPTION\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/origin/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "origin", + "search" + ] + } + }, + "response": [] + }, + { + "name": "origin -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \"ID\": 1\n },\n \"data\": {\n \"DESCRIPTION\": \"LinkedIn\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/origin", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "origin" + ] + } + }, + "response": [] + }, + { + "name": "origin -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\":{\n \t\"ID\":\t1\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/origin", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "origin" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Profile", + "item": [ + { + "name": "profile -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"DESCRIPTION\": \"HR\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/profile", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "profile" + ] + } + }, + "response": [] + }, + { + "name": "profile -R", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:33333/master/profile?columns=ID,DESCRIPTION", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "profile" + ], + "query": [ + { + "key": "columns", + "value": "ID,DESCRIPTION" + } + ] + } + }, + "response": [] + }, + { + "name": "profile -R (complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n\t\t\"ID\": 0\n\t},\n\t\"columns\": [\"DESCRIPTION\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/profile/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "profile", + "search" + ] + } + }, + "response": [] + }, + { + "name": "profile -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \"ID\": 1\n },\n \"data\": {\n \"DESCRIPTION\": \"Human Resources\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/profile", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "profile" + ] + } + }, + "response": [] + }, + { + "name": "profile -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\":{\n \t\"ID\":\t1\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/profile", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "profile" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Status", + "item": [ + { + "name": "status -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"DESCRIPTION\": \"No Available\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/status", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "status" + ] + } + }, + "response": [] + }, + { + "name": "status -R", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:33333/master/status?columns=ID,DESCRIPTION", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "status" + ], + "query": [ + { + "key": "columns", + "value": "ID,DESCRIPTION" + } + ] + } + }, + "response": [] + }, + { + "name": "status -R (complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n\t\t\"ID\": 0\n\t},\n\t\"columns\": [\"DESCRIPTION\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/status/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "status", + "search" + ] + } + }, + "response": [] + }, + { + "name": "status -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \"ID\": 1\n },\n \"data\": {\n \"DESCRIPTION\": \"Unavailable\"\n },\n \"sqltypes\": {\n \"DESCRIPTION\": 12\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/status", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "status" + ] + } + }, + "response": [] + }, + { + "name": "status -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\":{\n \t\"ID\":\t1\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/master/status", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "master", + "status" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + } + ], + "protocolProfileBehavior": {} } ], "auth": { diff --git a/api/src/main/java/com/ontimize/api/core/service/IMasterService.java b/api/src/main/java/com/ontimize/api/core/service/IMasterService.java new file mode 100644 index 0000000..5c99414 --- /dev/null +++ b/api/src/main/java/com/ontimize/api/core/service/IMasterService.java @@ -0,0 +1,40 @@ +package com.ontimize.api.core.service; + +import java.util.List; +import java.util.Map; + +import com.ontimize.db.EntityResult; +import com.ontimize.jee.common.exceptions.OntimizeJEERuntimeException; + +public interface IMasterService { + + // EDUCATION + public EntityResult educationQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult educationInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult educationUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult educationDelete(Map keyMap) throws OntimizeJEERuntimeException; + + // EXPERIENCE_LEVEL + public EntityResult experienceLevelQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult experienceLevelInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult experienceLevelUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult experienceLevelDelete(Map keyMap) throws OntimizeJEERuntimeException; + + // ORIGIN + public EntityResult originQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult originInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult originUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult originDelete(Map keyMap) throws OntimizeJEERuntimeException; + + // PROFILE + public EntityResult profileQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult profileInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult profileUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult profileDelete(Map keyMap) throws OntimizeJEERuntimeException; + + // STATUS + public EntityResult statusQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult statusInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult statusUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult statusDelete(Map keyMap) throws OntimizeJEERuntimeException; +} \ No newline at end of file diff --git a/model/src/main/db/templateDB.script b/model/src/main/db/templateDB.script index b280789..cf626b5 100644 --- a/model/src/main/db/templateDB.script +++ b/model/src/main/db/templateDB.script @@ -54,6 +54,21 @@ CREATE MEMORY TABLE PUBLIC.TROLE_SERVER_PERMISSION(ID_ROLE_SERVER_PERMISSION INT ALTER TABLE PUBLIC.TROLE_SERVER_PERMISSION ALTER COLUMN ID_ROLE_SERVER_PERMISSION RESTART WITH 17 CREATE MEMORY TABLE PUBLIC.CANDIDATE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PHOTO VARBINARY(16777216),NAME VARCHAR(255),SURNAME VARCHAR(255),BIRTHDAY DATE,DNI VARCHAR(255),PHONE VARCHAR(255),EMAIL VARCHAR(255),EDUCATION INTEGER,SPECIALTIES VARCHAR(255),STATUS INTEGER,ORIGIN INTEGER,WAGE_LEVEL NUMERIC(128),EXPERIENCE_LEVEL INTEGER,PROFILE INTEGER,COMMENT VARCHAR(255),LINKEDIN VARCHAR(255)) ALTER TABLE PUBLIC.CANDIDATE ALTER COLUMN ID RESTART WITH 15 +CREATE MEMORY TABLE PUBLIC.PROFILE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.PROFILE ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.EDUCATION(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.EDUCATION ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.STATUS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.STATUS ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.ORIGIN(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.ORIGIN ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.EXPERIENCE_LEVEL(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.EXPERIENCE_LEVEL ALTER COLUMN ID RESTART WITH 1 +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_EDUCATION FOREIGN KEY(EDUCATION) REFERENCES PUBLIC.EDUCATION(ID) +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_STATUS FOREIGN KEY(STATUS) REFERENCES PUBLIC.STATUS(ID) +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_ORIGIN FOREIGN KEY(ORIGIN) REFERENCES PUBLIC.ORIGIN(ID) +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_EXPERIENCE_LEVEL FOREIGN KEY(EXPERIENCE_LEVEL) REFERENCES PUBLIC.EXPERIENCE_LEVEL(ID) +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_PROFILE FOREIGN KEY(PROFILE) REFERENCES PUBLIC.PROFILE(ID) ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1 SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC @@ -125,3 +140,8 @@ INSERT INTO CANDIDATE VALUES(11,NULL,'Kaleena','Jonk','1994-09-28','76619635B',' INSERT INTO CANDIDATE VALUES(12,NULL,'Tami','Scorton','1977-09-25','12571372D','599-466-8570','tscortonc@photobucket.com',NULL,'Compliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL) INSERT INTO CANDIDATE VALUES(13,NULL,'Davin','Frowde','1984-03-06','96529753H','396-303-0612','dfrowded@webs.com',NULL,'React',NULL,NULL,22000,NULL,NULL,'porta volutpat erat quisque erat eros viverra eget congue eget semper',NULL) INSERT INTO CANDIDATE VALUES(14,NULL,'Kial','Titlow','1980-05-06','27680562Q','591-499-8814','ktitlowe@telegraph.co.uk',NULL,'HTML5',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO PROFILE VALUES(0,'Technician') +INSERT INTO EDUCATION VALUES(0,'Degree in Computer Science') +INSERT INTO STATUS VALUES(0,'Available') +INSERT INTO ORIGIN VALUES(0,'Recruiter') +INSERT INTO EXPERIENCE_LEVEL VALUES(0,'Junior') diff --git a/model/src/main/db/templateDB.txt b/model/src/main/db/templateDB.txt index b280789..cf626b5 100644 --- a/model/src/main/db/templateDB.txt +++ b/model/src/main/db/templateDB.txt @@ -54,6 +54,21 @@ CREATE MEMORY TABLE PUBLIC.TROLE_SERVER_PERMISSION(ID_ROLE_SERVER_PERMISSION INT ALTER TABLE PUBLIC.TROLE_SERVER_PERMISSION ALTER COLUMN ID_ROLE_SERVER_PERMISSION RESTART WITH 17 CREATE MEMORY TABLE PUBLIC.CANDIDATE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PHOTO VARBINARY(16777216),NAME VARCHAR(255),SURNAME VARCHAR(255),BIRTHDAY DATE,DNI VARCHAR(255),PHONE VARCHAR(255),EMAIL VARCHAR(255),EDUCATION INTEGER,SPECIALTIES VARCHAR(255),STATUS INTEGER,ORIGIN INTEGER,WAGE_LEVEL NUMERIC(128),EXPERIENCE_LEVEL INTEGER,PROFILE INTEGER,COMMENT VARCHAR(255),LINKEDIN VARCHAR(255)) ALTER TABLE PUBLIC.CANDIDATE ALTER COLUMN ID RESTART WITH 15 +CREATE MEMORY TABLE PUBLIC.PROFILE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.PROFILE ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.EDUCATION(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.EDUCATION ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.STATUS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.STATUS ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.ORIGIN(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.ORIGIN ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.EXPERIENCE_LEVEL(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.EXPERIENCE_LEVEL ALTER COLUMN ID RESTART WITH 1 +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_EDUCATION FOREIGN KEY(EDUCATION) REFERENCES PUBLIC.EDUCATION(ID) +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_STATUS FOREIGN KEY(STATUS) REFERENCES PUBLIC.STATUS(ID) +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_ORIGIN FOREIGN KEY(ORIGIN) REFERENCES PUBLIC.ORIGIN(ID) +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_EXPERIENCE_LEVEL FOREIGN KEY(EXPERIENCE_LEVEL) REFERENCES PUBLIC.EXPERIENCE_LEVEL(ID) +ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_PROFILE FOREIGN KEY(PROFILE) REFERENCES PUBLIC.PROFILE(ID) ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1 SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC @@ -125,3 +140,8 @@ INSERT INTO CANDIDATE VALUES(11,NULL,'Kaleena','Jonk','1994-09-28','76619635B',' INSERT INTO CANDIDATE VALUES(12,NULL,'Tami','Scorton','1977-09-25','12571372D','599-466-8570','tscortonc@photobucket.com',NULL,'Compliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL) INSERT INTO CANDIDATE VALUES(13,NULL,'Davin','Frowde','1984-03-06','96529753H','396-303-0612','dfrowded@webs.com',NULL,'React',NULL,NULL,22000,NULL,NULL,'porta volutpat erat quisque erat eros viverra eget congue eget semper',NULL) INSERT INTO CANDIDATE VALUES(14,NULL,'Kial','Titlow','1980-05-06','27680562Q','591-499-8814','ktitlowe@telegraph.co.uk',NULL,'HTML5',NULL,NULL,NULL,NULL,NULL,NULL,NULL) +INSERT INTO PROFILE VALUES(0,'Technician') +INSERT INTO EDUCATION VALUES(0,'Degree in Computer Science') +INSERT INTO STATUS VALUES(0,'Available') +INSERT INTO ORIGIN VALUES(0,'Recruiter') +INSERT INTO EXPERIENCE_LEVEL VALUES(0,'Junior') diff --git a/model/src/main/java/com/ontimize/model/core/dao/CandidateDao.java b/model/src/main/java/com/ontimize/model/core/dao/CandidateDao.java index 08cd374..cebb4cb 100644 --- a/model/src/main/java/com/ontimize/model/core/dao/CandidateDao.java +++ b/model/src/main/java/com/ontimize/model/core/dao/CandidateDao.java @@ -11,23 +11,22 @@ @ConfigurationFile(configurationFile = "dao/CandidateDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") public class CandidateDao extends OntimizeJdbcDaoSupport { - public static final String ATTR_ID = "ID"; - public static final String ATTR_PHOTO = "PHOTO"; - public static final String ATTR_NAME = "NAME"; - public static final String ATTR_SURNAME = "SURNAME"; - public static final String ATTR_BIRTHDAY = "BIRTHDAY"; - public static final String ATTR_DNI = "DNI"; - public static final String ATTR_PHONE = "PHONE"; - public static final String ATTR_EMAIL = "EMAIL"; - public static final String ATTR_EDUCATION = "EDUCATION"; - public static final String ATTR_SPECIALTIES = "SPECIALTIES"; - public static final String ATTR_STATUS = "STATUS"; - public static final String ATTR_ORIGIN = "ORIGIN"; - public static final String ATTR_WAGE_LEVEL = "WAGE_LEVEL"; - public static final String ATTR_EXPERIENCE_LEVEL = "EXPERIENCE_LEVEL"; - public static final String ATTR_PROFILE = "PROFILE"; - public static final String ATTR_COMMENT = "COMMENT"; - public static final String ATTR_LINKEDIN = "LINKEDIN"; - + public static final String ATTR_ID = "ID"; + public static final String ATTR_PHOTO = "PHOTO"; + public static final String ATTR_NAME = "NAME"; + public static final String ATTR_SURNAME = "SURNAME"; + public static final String ATTR_BIRTHDAY = "BIRTHDAY"; + public static final String ATTR_DNI = "DNI"; + public static final String ATTR_PHONE = "PHONE"; + public static final String ATTR_EMAIL = "EMAIL"; + public static final String ATTR_EDUCATION = "EDUCATION"; + public static final String ATTR_SPECIALTIES = "SPECIALTIES"; + public static final String ATTR_STATUS = "STATUS"; + public static final String ATTR_ORIGIN = "ORIGIN"; + public static final String ATTR_WAGE_LEVEL = "WAGE_LEVEL"; + public static final String ATTR_EXPERIENCE_LEVEL = "EXPERIENCE_LEVEL"; + public static final String ATTR_PROFILE = "PROFILE"; + public static final String ATTR_COMMENT = "COMMENT"; + public static final String ATTR_LINKEDIN = "LINKEDIN"; } \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/dao/EducationDao.java b/model/src/main/java/com/ontimize/model/core/dao/EducationDao.java new file mode 100644 index 0000000..07fb9c7 --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/EducationDao.java @@ -0,0 +1,16 @@ +package com.ontimize.model.core.dao; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("EducationDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/EducationDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class EducationDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID = "ID"; + public static final String ATTR_DESCRIPTION = "DESCRIPTION"; +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/dao/ExperienceLevelDao.java b/model/src/main/java/com/ontimize/model/core/dao/ExperienceLevelDao.java new file mode 100644 index 0000000..bab72ec --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/ExperienceLevelDao.java @@ -0,0 +1,16 @@ +package com.ontimize.model.core.dao; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("ExperienceLevelDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/ExperienceLevelDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class ExperienceLevelDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID = "ID"; + public static final String ATTR_DESCRIPTION = "DESCRIPTION"; +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/dao/OriginDao.java b/model/src/main/java/com/ontimize/model/core/dao/OriginDao.java new file mode 100644 index 0000000..a0e8937 --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/OriginDao.java @@ -0,0 +1,16 @@ +package com.ontimize.model.core.dao; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("OriginDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/OriginDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class OriginDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID = "ID"; + public static final String ATTR_DESCRIPTION = "DESCRIPTION"; +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/dao/ProfileDao.java b/model/src/main/java/com/ontimize/model/core/dao/ProfileDao.java new file mode 100644 index 0000000..505d759 --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/ProfileDao.java @@ -0,0 +1,16 @@ +package com.ontimize.model.core.dao; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("ProfileDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/ProfileDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class ProfileDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID = "ID"; + public static final String ATTR_DESCRIPTION = "DESCRIPTION"; +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/dao/StatusDao.java b/model/src/main/java/com/ontimize/model/core/dao/StatusDao.java new file mode 100644 index 0000000..951512e --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/StatusDao.java @@ -0,0 +1,16 @@ +package com.ontimize.model.core.dao; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("StatusDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/StatusDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class StatusDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID = "ID"; + public static final String ATTR_DESCRIPTION = "DESCRIPTION"; +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/service/MasterService.java b/model/src/main/java/com/ontimize/model/core/service/MasterService.java new file mode 100644 index 0000000..4d840ca --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/service/MasterService.java @@ -0,0 +1,141 @@ +package com.ontimize.model.core.service; + +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import com.ontimize.db.EntityResult; +import com.ontimize.api.core.service.IMasterService; +import com.ontimize.model.core.dao.EducationDao; +import com.ontimize.model.core.dao.ExperienceLevelDao; +import com.ontimize.model.core.dao.OriginDao; +import com.ontimize.model.core.dao.ProfileDao; +import com.ontimize.model.core.dao.StatusDao; +import com.ontimize.jee.common.exceptions.OntimizeJEERuntimeException; +import com.ontimize.jee.server.dao.DefaultOntimizeDaoHelper; + +@Service("MasterService") +@Lazy +public class MasterService implements IMasterService { + + @Autowired private EducationDao educationDao; + @Autowired private ExperienceLevelDao experienceLevelDao; + @Autowired private OriginDao originDao; + @Autowired private ProfileDao profileDao; + @Autowired private StatusDao statusDao; + @Autowired private DefaultOntimizeDaoHelper daoHelper; + + @Override + public EntityResult educationQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.educationDao, keyMap, attrList); + } + + @Override + public EntityResult educationInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.educationDao, attrMap); + } + + @Override + public EntityResult educationUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.educationDao, attrMap, keyMap); + } + + @Override + public EntityResult educationDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.educationDao, keyMap); + } + + @Override + public EntityResult experienceLevelQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.experienceLevelDao, keyMap, attrList); + } + + @Override + public EntityResult experienceLevelInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.experienceLevelDao, attrMap); + } + + @Override + public EntityResult experienceLevelUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.experienceLevelDao, attrMap, keyMap); + } + + @Override + public EntityResult experienceLevelDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.experienceLevelDao, keyMap); + } + + @Override + public EntityResult originQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.originDao, keyMap, attrList); + } + + @Override + public EntityResult originInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.originDao, attrMap); + } + + @Override + public EntityResult originUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.originDao, attrMap, keyMap); + } + + @Override + public EntityResult originDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.originDao, keyMap); + } + + @Override + public EntityResult profileQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.profileDao, keyMap, attrList); + } + + @Override + public EntityResult profileInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.profileDao, attrMap); + } + + @Override + public EntityResult profileUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.profileDao, attrMap, keyMap); + } + + @Override + public EntityResult profileDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.profileDao, keyMap); + } + + @Override + public EntityResult statusQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.statusDao, keyMap, attrList); + } + + @Override + public EntityResult statusInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.statusDao, attrMap); + } + + @Override + public EntityResult statusUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.statusDao, attrMap, keyMap); + } + + @Override + public EntityResult statusDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.statusDao, keyMap); + } + +} \ No newline at end of file diff --git a/model/src/main/resources/dao/EducationDao.xml b/model/src/main/resources/dao/EducationDao.xml new file mode 100644 index 0000000..4d030f8 --- /dev/null +++ b/model/src/main/resources/dao/EducationDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/model/src/main/resources/dao/ExperienceLevelDao.xml b/model/src/main/resources/dao/ExperienceLevelDao.xml new file mode 100644 index 0000000..f6b0040 --- /dev/null +++ b/model/src/main/resources/dao/ExperienceLevelDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/model/src/main/resources/dao/OriginDao.xml b/model/src/main/resources/dao/OriginDao.xml new file mode 100644 index 0000000..eec3d4c --- /dev/null +++ b/model/src/main/resources/dao/OriginDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/model/src/main/resources/dao/ProfileDao.xml b/model/src/main/resources/dao/ProfileDao.xml new file mode 100644 index 0000000..cdec5f0 --- /dev/null +++ b/model/src/main/resources/dao/ProfileDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/model/src/main/resources/dao/StatusDao.xml b/model/src/main/resources/dao/StatusDao.xml new file mode 100644 index 0000000..5971a1d --- /dev/null +++ b/model/src/main/resources/dao/StatusDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/ws/src/main/java/com/ontimize/ws/core/rest/MasterRestController.java b/ws/src/main/java/com/ontimize/ws/core/rest/MasterRestController.java new file mode 100644 index 0000000..0fb93b6 --- /dev/null +++ b/ws/src/main/java/com/ontimize/ws/core/rest/MasterRestController.java @@ -0,0 +1,24 @@ +package com.ontimize.ws.core.rest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ontimize.api.core.service.IMasterService; +import com.ontimize.jee.server.rest.ORestController; + +@RestController +@RequestMapping("/master") +@ComponentScan(basePackageClasses = { com.ontimize.api.core.service.IMasterService.class }) +public class MasterRestController extends ORestController { + + @Autowired + private IMasterService masterService; + + @Override + public IMasterService getService() { + return this.masterService; + } + +} \ No newline at end of file From 4550bf4039ee1da2fd1f56e5faa330495c1e8343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Tue, 23 Jun 2020 10:14:23 +0200 Subject: [PATCH 05/10] Exercise 7: Modification of basic CRUD operations, transactions --- .../model/core/service/CandidateService.java | 204 +++++++++++++++--- 1 file changed, 178 insertions(+), 26 deletions(-) diff --git a/model/src/main/java/com/ontimize/model/core/service/CandidateService.java b/model/src/main/java/com/ontimize/model/core/service/CandidateService.java index f5332e7..a9460fa 100644 --- a/model/src/main/java/com/ontimize/model/core/service/CandidateService.java +++ b/model/src/main/java/com/ontimize/model/core/service/CandidateService.java @@ -1,45 +1,197 @@ package com.ontimize.model.core.service; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ontimize.api.core.service.ICandidateService; import com.ontimize.db.EntityResult; import com.ontimize.jee.common.exceptions.OntimizeJEERuntimeException; import com.ontimize.jee.server.dao.DefaultOntimizeDaoHelper; import com.ontimize.model.core.dao.CandidateDao; +import com.ontimize.model.core.dao.EducationDao; +import com.ontimize.model.core.dao.ExperienceLevelDao; +import com.ontimize.model.core.dao.OriginDao; +import com.ontimize.model.core.dao.ProfileDao; +import com.ontimize.model.core.dao.StatusDao; @Service("CandidateService") @Lazy -public class CandidateService implements ICandidateService{ - - @Autowired private CandidateDao candidateDao; - @Autowired private DefaultOntimizeDaoHelper daoHelper; - - @Override - public EntityResult candidateQuery(Map keyMap, List attrList) - throws OntimizeJEERuntimeException { - return this.daoHelper.query(this.candidateDao, keyMap, attrList); - } - - @Override - public EntityResult candidateInsert(Map attrMap) throws OntimizeJEERuntimeException { - return this.daoHelper.insert(this.candidateDao, attrMap); - } - - @Override - public EntityResult candidateUpdate(Map attrMap, Map keyMap) - throws OntimizeJEERuntimeException { - return this.daoHelper.update(this.candidateDao, attrMap, keyMap); - } - - @Override - public EntityResult candidateDelete(Map keyMap) throws OntimizeJEERuntimeException { - return this.daoHelper.delete(this.candidateDao, keyMap); - } +public class CandidateService implements ICandidateService { + @Autowired + private CandidateDao candidateDao; + @Autowired + private DefaultOntimizeDaoHelper daoHelper; + /** + * It stores the master service. When you mark it with the @Autowired notation, + * it links automatically without using any setter + */ + @Autowired + private MasterService masterService; + + @Override + public EntityResult candidateQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.candidateDao, keyMap, attrList); + } + + /** + * This method adds a new candidate. It removes from the parameters those items + * not directly belonging to the table of candidates in case of that are of the + * {@link String} type. Look for the identifier of this data in case that they + * exist or adds them to the corresponding tables, and associates them with the + * correct identifier. Then add these new elements to the list of applicant's + * items and performs the insert of a new candidate + * + * + * @param attrMap A {@link Map} containing the data of the new candidate to be + * inserted. + */ + @Override + @Transactional(rollbackFor = Exception.class) + public EntityResult candidateInsert(Map attrMap) throws OntimizeJEERuntimeException { + Map nonCandidateData = removeNonRelatedData(attrMap, CandidateDao.ATTR_EDUCATION, + CandidateDao.ATTR_EXPERIENCE_LEVEL, CandidateDao.ATTR_ORIGIN, CandidateDao.ATTR_PROFILE, + CandidateDao.ATTR_STATUS); + this.insertNonRelatedData(nonCandidateData); + attrMap.putAll(nonCandidateData); + return this.daoHelper.insert(this.candidateDao, attrMap); + } + + /** + * This method updates a candidate. It removes from the parameters those items + * not directly belonging to the table of candidates in case of that are of the + * {@link String} type. Look for the identifier of this data in case that they + * exist or adds them to the corresponding tables, and associates them with the + * correct identifier. Then add these new elements to the list of applicant's + * items and performs the update of a candidate + * + * + * @param attrMap A {@link Map} containing the data of the candidate to be + * updated. + * @param keyMap A {@link Map} containing the identification of the candidate + * to be updated. + */ + @Override + @Transactional(rollbackFor = Exception.class) + public EntityResult candidateUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + Map nonCandidateData = removeNonRelatedData(attrMap, CandidateDao.ATTR_EDUCATION, + CandidateDao.ATTR_EXPERIENCE_LEVEL, CandidateDao.ATTR_ORIGIN, CandidateDao.ATTR_PROFILE, + CandidateDao.ATTR_STATUS); + this.insertNonRelatedData(nonCandidateData); + attrMap.putAll(nonCandidateData); + return this.daoHelper.update(this.candidateDao, attrMap, keyMap); + } + + @Override + public EntityResult candidateDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.candidateDao, keyMap); + } + + /** + * It removes from a map all the keys and values of the map that match those + * keys in their following parameters and returns a map with the extracted keys + * and values + * + * @param attrMap A {@link Map} with all keys + * @param attrToExclude Multiple {@link String} that can be found as key of + * {@code attrMap} + * @return A {@link Map} with all of the keys and values removed from + * {@code attrMap} + */ + private Map removeNonRelatedData(Map attrMap, String... attrToExclude) { + HashMap data = new HashMap(); + for (String attr : attrToExclude) { + if (attrMap.containsKey(attr) && attrMap.get(attr) instanceof String) { + data.put(attr, attrMap.remove(attr)); + } + } + return data; + } + + /** + * Checks if the data stored in the map passed by parameter exists in the + * database table corresponding to the {@link MasterService} service. If so, it + * replaces the value with the corresponding identifier. In case it does not + * exist, it stores that value and substitutes the element's value in the map + * with its identifier + * + * @param nonCandidateData Values to be inserted in the tables managed by the + * {@link MasterService} + */ + private void insertNonRelatedData(Map nonCandidateData) { + for (Entry entry : nonCandidateData.entrySet()) { + Map data = new HashMap(); + List attr = new ArrayList(); + EntityResult toret, query; + switch (entry.getKey()) { + case CandidateDao.ATTR_EDUCATION: + data.put(EducationDao.ATTR_DESCRIPTION, entry.getValue()); + attr.add(EducationDao.ATTR_ID); + query = this.masterService.educationQuery(data, attr); + if (query.calculateRecordNumber() > 0) { + entry.setValue(query.getRecordValues(0).get(EducationDao.ATTR_ID)); + } else { + toret = this.masterService.educationInsert(data); + entry.setValue(toret.get(EducationDao.ATTR_ID)); + } + break; + case CandidateDao.ATTR_EXPERIENCE_LEVEL: + data.put(ExperienceLevelDao.ATTR_DESCRIPTION, entry.getValue()); + attr.add(ExperienceLevelDao.ATTR_ID); + query = this.masterService.experienceLevelQuery(data, attr); + if (query.calculateRecordNumber() > 0) { + entry.setValue(query.getRecordValues(0).get(ExperienceLevelDao.ATTR_ID)); + } else { + toret = this.masterService.experienceLevelInsert(data); + entry.setValue(toret.get(ExperienceLevelDao.ATTR_ID)); + } + break; + case CandidateDao.ATTR_ORIGIN: + data.put(OriginDao.ATTR_DESCRIPTION, entry.getValue()); + attr.add(OriginDao.ATTR_ID); + query = this.masterService.originQuery(data, attr); + if (query.calculateRecordNumber() > 0) { + entry.setValue(query.getRecordValues(0).get(OriginDao.ATTR_ID)); + } else { + toret = this.masterService.originInsert(data); + entry.setValue(toret.get(OriginDao.ATTR_ID)); + } + break; + case CandidateDao.ATTR_PROFILE: + data.put(ProfileDao.ATTR_DESCRIPTION, entry.getValue()); + attr.add(ProfileDao.ATTR_ID); + query = this.masterService.profileQuery(data, attr); + if (query.calculateRecordNumber() > 0) { + entry.setValue(query.getRecordValues(0).get(ProfileDao.ATTR_ID)); + } else { + toret = this.masterService.profileInsert(data); + entry.setValue(toret.get(ProfileDao.ATTR_ID)); + } + break; + case CandidateDao.ATTR_STATUS: + data.put(StatusDao.ATTR_DESCRIPTION, entry.getValue()); + attr.add(StatusDao.ATTR_ID); + query = this.masterService.statusQuery(data, attr); + if (query.calculateRecordNumber() > 0) { + entry.setValue(query.getRecordValues(0).get(StatusDao.ATTR_ID)); + } else { + toret = this.masterService.statusInsert(data); + entry.setValue(toret.get(StatusDao.ATTR_ID)); + } + break; + default: + break; + } + } + } } \ No newline at end of file From fda2c6921fd1c5136906ab9a777768859f885d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Wed, 22 Jul 2020 09:04:47 +0200 Subject: [PATCH 06/10] Exercise 8: Adding new services --- ...mize Boot Training.postman_collection.json | 802 ++++++++++++++++-- .../api/core/service/IOfferService.java | 34 + model/src/main/db/templateDB.script | 24 + model/src/main/db/templateDB.txt | 24 + .../core/dao/OfferCandidateStatusDao.java | 17 + .../model/core/dao/OfferCandidatesDao.java | 19 + .../com/ontimize/model/core/dao/OfferDao.java | 22 + .../model/core/dao/OfferStatusDao.java | 16 + .../model/core/service/OfferService.java | 116 +++ .../resources/dao/OfferCandidateStatusDao.xml | 15 + .../main/resources/dao/OfferCandidatesDao.xml | 15 + model/src/main/resources/dao/OfferDao.xml | 15 + .../src/main/resources/dao/OfferStatusDao.xml | 15 + .../ws/core/rest/OfferRestController.java | 23 + 14 files changed, 1082 insertions(+), 75 deletions(-) create mode 100644 api/src/main/java/com/ontimize/api/core/service/IOfferService.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/OfferCandidateStatusDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/OfferCandidatesDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/OfferDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/dao/OfferStatusDao.java create mode 100644 model/src/main/java/com/ontimize/model/core/service/OfferService.java create mode 100644 model/src/main/resources/dao/OfferCandidateStatusDao.xml create mode 100644 model/src/main/resources/dao/OfferCandidatesDao.xml create mode 100644 model/src/main/resources/dao/OfferDao.xml create mode 100644 model/src/main/resources/dao/OfferStatusDao.xml create mode 100644 ws/src/main/java/com/ontimize/ws/core/rest/OfferRestController.java diff --git a/Ontimize Boot Training.postman_collection.json b/Ontimize Boot Training.postman_collection.json index 84fee9e..30ecc13 100644 --- a/Ontimize Boot Training.postman_collection.json +++ b/Ontimize Boot Training.postman_collection.json @@ -11,21 +11,6 @@ { "name": "candidate -C", "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "demouser", - "type": "string" - }, - { - "key": "username", - "value": "demo", - "type": "string" - } - ] - }, "method": "POST", "header": [], "body": { @@ -53,23 +38,37 @@ "response": [] }, { - "name": "candidate -R", + "name": "candidate -C Non Related", "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "demouser", - "type": "string" - }, - { - "key": "username", - "value": "demo", - "type": "string" + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"PHONE\": \"555-444-8888\",\n \"BIRTHDAY\": 788224700000,\n \"SURNAME\": \"Wilson\",\n \"EMAIL\": \"wwiilsoon@example.org\",\n \"SPECIALTIES\": \"C#\",\n \"NAME\": \"William\",\n \"DNI\": \"88643946Z\",\n \"EDUCATION\": 1,\n \"EXPERIENCE_LEVEL\": 1,\n \"ORIGIN\": \"Event\",\n \"PROFILE\": \"Administrator\",\n \"STATUS\": 1\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"COMMENT\": 12,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", + "options": { + "raw": { + "language": "json" } - ] + } }, + "url": { + "raw": "http://localhost:33333/candidates/candidate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "candidates", + "candidate" + ] + } + }, + "response": [] + }, + { + "name": "candidate -R", + "request": { "method": "GET", "header": [], "url": { @@ -96,21 +95,6 @@ { "name": "candidate -R (complex)", "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "demouser", - "type": "string" - }, - { - "key": "username", - "value": "demo", - "type": "string" - } - ] - }, "method": "POST", "header": [], "body": { @@ -141,26 +125,11 @@ { "name": "candidate -U", "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "demouser", - "type": "string" - }, - { - "key": "username", - "value": "demo", - "type": "string" - } - ] - }, "method": "PUT", "header": [], "body": { "mode": "raw", - "raw": "{\n\t\"filter\" :{\n\t\t\"ID\" :15\n\t},\n \"data\": {\n \"EMAIL\": \"wwilson@example.org\"\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EXPERIENCE_LEVEL\": 4,\n \"STATUS\": 4,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"ORIGIN\": 4,\n \"EDUCATION\": 4,\n \"COMMENT\": 12,\n \"PROFILE\": 4,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", + "raw": "{\n\t\"filter\" :{\n\t\t\"ID\" :16\n\t},\n \"data\": {\n \"EMAIL\": \"wwilson@example.org\",\n \"PROFILE\": \"Tester\"\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"COMMENT\": 12,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", "options": { "raw": { "language": "json" @@ -185,21 +154,6 @@ { "name": "candidate -D", "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "demouser", - "type": "string" - }, - { - "key": "username", - "value": "demo", - "type": "string" - } - ] - }, "method": "DELETE", "header": [], "body": { @@ -984,6 +938,704 @@ } ], "protocolProfileBehavior": {} + }, + { + "name": "Offers", + "item": [ + { + "name": "Offer", + "item": [ + { + "name": "offer status -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n\t\t\"ACRONYM\": \"Istari support\", \n\t\t\"DESCRIPTION\": \"Will provide administrative and logistical support to members of the executive team and may support other as needed. Must display professionalism and a strong work ethic while fostering a work environment that is positive, optimistic and collaborative. Position requires excellent administrative, communication, organizational and time management skills paired with flexibility, integrity and the ability to work independently. Must have Balrog fighting proficiency.\",\n\t\t\"APPLICANT\": \"Eru Iúvatar\",\n\t\t\"OFFER_STATUS\": 0,\n\t\t\"CREATION_DATE\": 1589148000000,\n\t\t\"START_DATE\": 1598911200000,\n\t\t\"END_DATE\": 1609369200000\n },\n \"sqltypes\": {\n \"END_DATE\": 91,\n \"CREATION_DATE\": 91,\n \"START_DATE\": 91\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offer", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offer" + ] + } + }, + "response": [] + }, + { + "name": "offer status-R", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"PHONE\": \"555-444-8888\",\n \"BIRTHDAY\": 788224700000,\n \"SURNAME\": \"Wilson\",\n \"EMAIL\": \"wwiilsoon@example.org\",\n \"SPECIALTIES\": \"C#\",\n \"NAME\": \"William\",\n \"DNI\": \"88643946Z\"\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EXPERIENCE_LEVEL\": 4,\n \"STATUS\": 4,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"ORIGIN\": 4,\n \"EDUCATION\": 4,\n \"COMMENT\": 12,\n \"PROFILE\": 4,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offer?columns=ID,ACRONYM,DESCRIPTION,APPLICANT,OFFER_STATUS,CREATION_DATE,START_DATE,END_DATE", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offer" + ], + "query": [ + { + "key": "columns", + "value": "ID,ACRONYM,DESCRIPTION,APPLICANT,OFFER_STATUS,CREATION_DATE,START_DATE,END_DATE" + } + ] + } + }, + "response": [] + }, + { + "name": "offer status -R (Complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \t\"ID\": 0\n },\n \"columns\": [\"ID\",\"DESCRIPTION\",\"OFFER_STATUS\",\"END_DATE\",\"APPLICANT\",\"ACRONYM\",\"CREATION_DATE\",\"START_DATE\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offer/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offer", + "search" + ] + } + }, + "response": [] + }, + { + "name": "offer status -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n \t\"ID\": 1\n },\n \"data\": {\n \t\"APPLICANT\": \"Rosaline Maddocks\",\n \t\"DESCRIPTION\": \"Will provide administrative and logistical support to members of the executive team and may support other as needed. Must display professionalism and a strong work ethic while fostering a work environment that is positive, optimistic and collaborative. Position requires excellent administrative, communication, organizational and time management skills paired with flexibility, integrity and the ability to work independently.\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offer", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offer" + ] + } + }, + "response": [] + }, + { + "name": "offer status -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n \t\"ID\": 1\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offer", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offer" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Offer Status", + "item": [ + { + "name": "offer status -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \t\"DESCRIPTION\": \"STARTED\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerStatus", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerStatus" + ] + } + }, + "response": [] + }, + { + "name": "offer status-R", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"PHONE\": \"555-444-8888\",\n \"BIRTHDAY\": 788224700000,\n \"SURNAME\": \"Wilson\",\n \"EMAIL\": \"wwiilsoon@example.org\",\n \"SPECIALTIES\": \"C#\",\n \"NAME\": \"William\",\n \"DNI\": \"88643946Z\"\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EXPERIENCE_LEVEL\": 4,\n \"STATUS\": 4,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"ORIGIN\": 4,\n \"EDUCATION\": 4,\n \"COMMENT\": 12,\n \"PROFILE\": 4,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerStatus?columns=ID,DESCRIPTION", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerStatus" + ], + "query": [ + { + "key": "columns", + "value": "ID,DESCRIPTION" + } + ] + } + }, + "response": [] + }, + { + "name": "offer status -R (Complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \t\"ID\": 0\n },\n \"columns\": [\"ID\", \"DESCRIPTION\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerStatus/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerStatus", + "search" + ] + } + }, + "response": [] + }, + { + "name": "offer status -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n \t\"ID\": 1\n },\n \"data\": {\n \t\"DESCRIPTION\": \"Started\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerStatus", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerStatus" + ] + } + }, + "response": [] + }, + { + "name": "offer status -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n \t\"ID\": 1\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerStatus", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerStatus" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Offer Candidate", + "item": [ + { + "name": "offer candidate -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"OFFER_ID\": 0,\n \"CANDIDATE_ID\": 1,\n \"OFFER_CANDIDATE_STATUS\": 0\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidate" + ] + } + }, + "response": [] + }, + { + "name": "offer candidate -R", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"PHONE\": \"555-444-8888\",\n \"BIRTHDAY\": 788224700000,\n \"SURNAME\": \"Wilson\",\n \"EMAIL\": \"wwiilsoon@example.org\",\n \"SPECIALTIES\": \"C#\",\n \"NAME\": \"William\",\n \"DNI\": \"88643946Z\"\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EXPERIENCE_LEVEL\": 4,\n \"STATUS\": 4,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"ORIGIN\": 4,\n \"EDUCATION\": 4,\n \"COMMENT\": 12,\n \"PROFILE\": 4,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidate?columns=ID,OFFER_ID,CANDIDATE_ID,OFFER_CANDIDATE_STATUS", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidate" + ], + "query": [ + { + "key": "columns", + "value": "ID,OFFER_ID,CANDIDATE_ID,OFFER_CANDIDATE_STATUS" + } + ] + } + }, + "response": [] + }, + { + "name": "offer candidate -R (Complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \t\"ID\": 0\n },\n \"columns\": [\"ID\",\"OFFER_ID\",\"CANDIDATE_ID\",\"OFFER_CANDIDATE_STATUS\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidate/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidate", + "search" + ] + } + }, + "response": [] + }, + { + "name": "offer candidate -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n \t\"ID\": 4\n },\n \"data\": {\n \t\"OFFER_ID\": 0,\n \"CANDIDATE_ID\": 2,\n \"OFFER_CANDIDATE_STATUS\": 0\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidate" + ] + } + }, + "response": [] + }, + { + "name": "offer candidate -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n \t\"ID\": 4\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidate", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidate" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "6bd9c516-af63-446b-966e-e5a203013215", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "33e79744-9761-48f9-8a78-9aa908f9a3ea", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Offer Candidate Status", + "item": [ + { + "name": "offer candidate status -C", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \t\"DESCRIPTION\": \"PENDING CV\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidateStatus", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidateStatus" + ] + } + }, + "response": [] + }, + { + "name": "offer candidate status-R", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"data\": {\n \"PHONE\": \"555-444-8888\",\n \"BIRTHDAY\": 788224700000,\n \"SURNAME\": \"Wilson\",\n \"EMAIL\": \"wwiilsoon@example.org\",\n \"SPECIALTIES\": \"C#\",\n \"NAME\": \"William\",\n \"DNI\": \"88643946Z\"\n },\n \"sqltypes\": {\n \"SPECIALTIES\": 12,\n \"LINKEDIN\": 12,\n \"PHONE\": 12,\n \"EXPERIENCE_LEVEL\": 4,\n \"STATUS\": 4,\n \"EMAIL\": 12,\n \"WAGE_LEVEL\": 2,\n \"DNI\": 12,\n \"ID\": 4,\n \"ORIGIN\": 4,\n \"EDUCATION\": 4,\n \"COMMENT\": 12,\n \"PROFILE\": 4,\n \"SURNAME\": 12,\n \"NAME\": 12,\n \"BIRTHDAY\": 91\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidateStatus?columns=ID,DESCRIPTION", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidateStatus" + ], + "query": [ + { + "key": "columns", + "value": "ID,DESCRIPTION" + } + ] + } + }, + "response": [] + }, + { + "name": "offer candidate status -R (Complex)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \t\"ID\": 0\n },\n \"columns\": [\"ID\", \"DESCRIPTION\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidateStatus/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidateStatus", + "search" + ] + } + }, + "response": [] + }, + { + "name": "offer candidate status -U", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n \t\"ID\": 1\n },\n \"data\": {\n \t\"DESCRIPTION\": \"Pending CV\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidateStatus", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidateStatus" + ] + } + }, + "response": [] + }, + { + "name": "offer candidate status -D", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"filter\": {\n \t\"ID\": 1\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidateStatus", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidateStatus" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "71ed2803-2464-4851-b017-89befc12a4ae", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "8232af92-b4d4-4bb0-a0b9-da02afea9de6", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + } + ], + "protocolProfileBehavior": {} } ], "auth": { diff --git a/api/src/main/java/com/ontimize/api/core/service/IOfferService.java b/api/src/main/java/com/ontimize/api/core/service/IOfferService.java new file mode 100644 index 0000000..35cbfad --- /dev/null +++ b/api/src/main/java/com/ontimize/api/core/service/IOfferService.java @@ -0,0 +1,34 @@ +package com.ontimize.api.core.service; + +import java.util.List; +import java.util.Map; + +import com.ontimize.db.EntityResult; +import com.ontimize.jee.common.exceptions.OntimizeJEERuntimeException; + +public interface IOfferService { + + // OFFER + public EntityResult offerQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult offerInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult offerUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult offerDelete(Map keyMap) throws OntimizeJEERuntimeException; + + // OFFER STATUS + public EntityResult offerStatusQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult offerStatusInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult offerStatusUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult offerStatusDelete(Map keyMap) throws OntimizeJEERuntimeException; + + // OFFER CANDIDATES + public EntityResult offerCandidateQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult offerCandidateInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult offerCandidateUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult offerCandidateDelete(Map keyMap) throws OntimizeJEERuntimeException; + + // OFFER CANDIDATES STATUS + public EntityResult offerCandidateStatusQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult offerCandidateStatusInsert(Map attrMap) throws OntimizeJEERuntimeException; + public EntityResult offerCandidateStatusUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; + public EntityResult offerCandidateStatusDelete(Map keyMap) throws OntimizeJEERuntimeException; +} \ No newline at end of file diff --git a/model/src/main/db/templateDB.script b/model/src/main/db/templateDB.script index cf626b5..f2a0731 100644 --- a/model/src/main/db/templateDB.script +++ b/model/src/main/db/templateDB.script @@ -64,6 +64,14 @@ CREATE MEMORY TABLE PUBLIC.ORIGIN(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(ST ALTER TABLE PUBLIC.ORIGIN ALTER COLUMN ID RESTART WITH 1 CREATE MEMORY TABLE PUBLIC.EXPERIENCE_LEVEL(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) ALTER TABLE PUBLIC.EXPERIENCE_LEVEL ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.OFFER_STATUS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.OFFER_STATUS ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.OFFER_CANDIDATE_STATUS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.OFFER_CANDIDATE_STATUS ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.OFFER(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ACRONYM VARCHAR(255),DESCRIPTION VARCHAR(1000),APPLICANT VARCHAR(255),OFFER_STATUS INTEGER,CREATION_DATE DATE,START_DATE DATE,END_DATE DATE,CONSTRAINT OFFER_FK_OFFER_STATUS FOREIGN KEY(OFFER_STATUS) REFERENCES PUBLIC.OFFER_STATUS(ID)) +ALTER TABLE PUBLIC.OFFER ALTER COLUMN ID RESTART WITH 10 +CREATE MEMORY TABLE PUBLIC.OFFER_CANDIDATES(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,OFFER_ID INTEGER NOT NULL,CANDIDATE_ID INTEGER NOT NULL,OFFER_CANDIDATE_STATUS INTEGER,CONSTRAINT OFFER_CANDIDATES_FK_CANDIDATES FOREIGN KEY(CANDIDATE_ID) REFERENCES PUBLIC.CANDIDATE(ID),CONSTRAINT OFFER_CANDIDATES_FK_OFFER FOREIGN KEY(OFFER_ID) REFERENCES PUBLIC.OFFER(ID),CONSTRAINT OFFER_CANDIDATES_FK_OFFER_CANDIDATES_STATUS FOREIGN KEY(OFFER_CANDIDATE_STATUS) REFERENCES PUBLIC.OFFER_CANDIDATE_STATUS(ID)) +ALTER TABLE PUBLIC.OFFER_CANDIDATES ALTER COLUMN ID RESTART WITH 4 ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_EDUCATION FOREIGN KEY(EDUCATION) REFERENCES PUBLIC.EDUCATION(ID) ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_STATUS FOREIGN KEY(STATUS) REFERENCES PUBLIC.STATUS(ID) ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_ORIGIN FOREIGN KEY(ORIGIN) REFERENCES PUBLIC.ORIGIN(ID) @@ -145,3 +153,19 @@ INSERT INTO EDUCATION VALUES(0,'Degree in Computer Science') INSERT INTO STATUS VALUES(0,'Available') INSERT INTO ORIGIN VALUES(0,'Recruiter') INSERT INTO EXPERIENCE_LEVEL VALUES(0,'Junior') +INSERT INTO OFFER_STATUS VALUES(0,'PENDING') +INSERT INTO OFFER_CANDIDATE_STATUS VALUES(0,'INTERVIEW') +INSERT INTO OFFER VALUES(0,'Digital Twin','Two new Java developers should be incorporated. The salary range is between 20k\u20ac and 30k\u20ac. The location is in Vigo full time.','Janna Tirte',0,'2020-01-01','2020-02-07',NULL) +INSERT INTO OFFER VALUES(1,'Exotic language programmer','We are looking for a talented Programmer to create secure and functional code.\u000d\u000aYou may have to provide quality coding solutions both for simple applications and complex information or operating systems.\u000d\u000aThe ideal candidate will have a passion for technology and software building.\u000d\u000aAttention to detail and an analytical mind are essential qualities for a successful career in programming.','Richard Stallman',0,'2019-12-01','2019-12-15',NULL) +INSERT INTO OFFER VALUES(2,'HR Manager','We are looking for an experienced leader for our project management office focused on Project Management activities within our service delivery center to join our team in our Atlanta office. This role is integral to achieve accurate project management and process standardization throughout the organization. The major priority for the successful candidate will be to lead a team of project managers across a large portfolio of projects. Projects range from small enhancements, large-scale technology implementations, and daily operational activities.','Harry May',0,'2020-01-01','2020-01-07',NULL) +INSERT INTO OFFER VALUES(3,'Software developer','Works under the direction and supervision of application managers and project managers to help build the next generation of global financial data systems to support the client\u2019s front office, middle office processes and back-office risk, finance, compliance reporting, regulatory reporting, and capital markets and banking needs.','Tanya Howard',0,'2020-01-01','2020-01-02',NULL) +INSERT INTO OFFER VALUES(4,'UI developer','The ideal candidate will be responsible for developing user interfaces and controls that achieve maximum usability for our enterprise application and our customers.','Francis Harris',0,'2019-12-01','2019-12-24',NULL) +INSERT INTO OFFER VALUES(5,'Entry level management','With the addition of various new clients requesting that we expand our services to new markets, we have an urgent need for a passionate individual that we can train, support, and groom to accept a role as a Manager within our firm.\u000d\u000a\u000d\u000aTo ensure your success, we offer training that encompasses all facets of our business operations. You\u2019ll experience hands on training provided by seasoned professionals in each department, primarily:\u000d\u000a\u000d\u000aPromotional Marketing\u000d\u000aCustomer Service\u000d\u000aConsumer Relations\u000d\u000aBusiness Administration\u000d\u000aRecruiting and Talent Acquisition','Joy Boyd',0,'2019-11-01','2019-11-06',NULL) +INSERT INTO OFFER VALUES(6,'PHP developer','Responsible for all requests for data processing services including, preparation of specifications, development and maintenance of computer programs, job control language and operational documentation. Assists productions systems group. Interfaces with other departments to determine user needs.','Rebecca Bowman',0,'2020-01-01','2020-01-06',NULL) +INSERT INTO OFFER VALUES(7,'Security engineer','This position is open within the Security Engineering teams, which has full end-to-end ownership of security tools that allows for strong security prevention, detection and response capabilities. Our mission is to ensure cyber infrastructure is in line with industry standards by performing day-to-day system administration, product selection for new tools, deployment, configuration, maintenance, and support and license management.','Harry Gardner',0,'2020-01-01','2020-01-16',NULL) +INSERT INTO OFFER VALUES(8,'Project Manager','Performs a variety of duties associated with the development and production of the aircraft maintenance manuals, wiring diagram manuals and other associated documents. Utilize an automated publishing system to download, import, and distribute manual data.Individual will incorporate vendor revisions and Delta engineering documents into a Delta customized manual and coordinate the publishing of the same. Additional responsibilities may include continuous improvement of revision processes, training and point person for data issues. The Project Leader may also be responsible for review and distribution of Aircraft Maintenance Alerts (AMAs), company policy & procedures, bulletins, vendor access, and other technical information.','Erika Torres',0,'2020-01-01','2020-01-15',NULL) +INSERT INTO OFFER VALUES(9,'Istari support','Will provide administrative and logistical support to members of the executive team and may support other as needed. Must display professionalism and a strong work ethic while fostering a work environment that is positive, optimistic and collaborative. Position requires excellent administrative, communication, organizational and time management skills paired with flexibility, integrity and the ability to work independently. Must have Balrog fighting proficiency.','Eru I\u00favatar',0,'2020-01-01','2020-01-06',NULL) +INSERT INTO OFFER_CANDIDATES VALUES(0,0,0,0) +INSERT INTO OFFER_CANDIDATES VALUES(1,0,3,0) +INSERT INTO OFFER_CANDIDATES VALUES(2,0,8,0) +INSERT INTO OFFER_CANDIDATES VALUES(3,0,12,0) diff --git a/model/src/main/db/templateDB.txt b/model/src/main/db/templateDB.txt index cf626b5..f2a0731 100644 --- a/model/src/main/db/templateDB.txt +++ b/model/src/main/db/templateDB.txt @@ -64,6 +64,14 @@ CREATE MEMORY TABLE PUBLIC.ORIGIN(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(ST ALTER TABLE PUBLIC.ORIGIN ALTER COLUMN ID RESTART WITH 1 CREATE MEMORY TABLE PUBLIC.EXPERIENCE_LEVEL(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) ALTER TABLE PUBLIC.EXPERIENCE_LEVEL ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.OFFER_STATUS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.OFFER_STATUS ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.OFFER_CANDIDATE_STATUS(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) +ALTER TABLE PUBLIC.OFFER_CANDIDATE_STATUS ALTER COLUMN ID RESTART WITH 1 +CREATE MEMORY TABLE PUBLIC.OFFER(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ACRONYM VARCHAR(255),DESCRIPTION VARCHAR(1000),APPLICANT VARCHAR(255),OFFER_STATUS INTEGER,CREATION_DATE DATE,START_DATE DATE,END_DATE DATE,CONSTRAINT OFFER_FK_OFFER_STATUS FOREIGN KEY(OFFER_STATUS) REFERENCES PUBLIC.OFFER_STATUS(ID)) +ALTER TABLE PUBLIC.OFFER ALTER COLUMN ID RESTART WITH 10 +CREATE MEMORY TABLE PUBLIC.OFFER_CANDIDATES(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,OFFER_ID INTEGER NOT NULL,CANDIDATE_ID INTEGER NOT NULL,OFFER_CANDIDATE_STATUS INTEGER,CONSTRAINT OFFER_CANDIDATES_FK_CANDIDATES FOREIGN KEY(CANDIDATE_ID) REFERENCES PUBLIC.CANDIDATE(ID),CONSTRAINT OFFER_CANDIDATES_FK_OFFER FOREIGN KEY(OFFER_ID) REFERENCES PUBLIC.OFFER(ID),CONSTRAINT OFFER_CANDIDATES_FK_OFFER_CANDIDATES_STATUS FOREIGN KEY(OFFER_CANDIDATE_STATUS) REFERENCES PUBLIC.OFFER_CANDIDATE_STATUS(ID)) +ALTER TABLE PUBLIC.OFFER_CANDIDATES ALTER COLUMN ID RESTART WITH 4 ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_EDUCATION FOREIGN KEY(EDUCATION) REFERENCES PUBLIC.EDUCATION(ID) ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_STATUS FOREIGN KEY(STATUS) REFERENCES PUBLIC.STATUS(ID) ALTER TABLE PUBLIC.CANDIDATE ADD CONSTRAINT CANDIDATE_FK_ORIGIN FOREIGN KEY(ORIGIN) REFERENCES PUBLIC.ORIGIN(ID) @@ -145,3 +153,19 @@ INSERT INTO EDUCATION VALUES(0,'Degree in Computer Science') INSERT INTO STATUS VALUES(0,'Available') INSERT INTO ORIGIN VALUES(0,'Recruiter') INSERT INTO EXPERIENCE_LEVEL VALUES(0,'Junior') +INSERT INTO OFFER_STATUS VALUES(0,'PENDING') +INSERT INTO OFFER_CANDIDATE_STATUS VALUES(0,'INTERVIEW') +INSERT INTO OFFER VALUES(0,'Digital Twin','Two new Java developers should be incorporated. The salary range is between 20k\u20ac and 30k\u20ac. The location is in Vigo full time.','Janna Tirte',0,'2020-01-01','2020-02-07',NULL) +INSERT INTO OFFER VALUES(1,'Exotic language programmer','We are looking for a talented Programmer to create secure and functional code.\u000d\u000aYou may have to provide quality coding solutions both for simple applications and complex information or operating systems.\u000d\u000aThe ideal candidate will have a passion for technology and software building.\u000d\u000aAttention to detail and an analytical mind are essential qualities for a successful career in programming.','Richard Stallman',0,'2019-12-01','2019-12-15',NULL) +INSERT INTO OFFER VALUES(2,'HR Manager','We are looking for an experienced leader for our project management office focused on Project Management activities within our service delivery center to join our team in our Atlanta office. This role is integral to achieve accurate project management and process standardization throughout the organization. The major priority for the successful candidate will be to lead a team of project managers across a large portfolio of projects. Projects range from small enhancements, large-scale technology implementations, and daily operational activities.','Harry May',0,'2020-01-01','2020-01-07',NULL) +INSERT INTO OFFER VALUES(3,'Software developer','Works under the direction and supervision of application managers and project managers to help build the next generation of global financial data systems to support the client\u2019s front office, middle office processes and back-office risk, finance, compliance reporting, regulatory reporting, and capital markets and banking needs.','Tanya Howard',0,'2020-01-01','2020-01-02',NULL) +INSERT INTO OFFER VALUES(4,'UI developer','The ideal candidate will be responsible for developing user interfaces and controls that achieve maximum usability for our enterprise application and our customers.','Francis Harris',0,'2019-12-01','2019-12-24',NULL) +INSERT INTO OFFER VALUES(5,'Entry level management','With the addition of various new clients requesting that we expand our services to new markets, we have an urgent need for a passionate individual that we can train, support, and groom to accept a role as a Manager within our firm.\u000d\u000a\u000d\u000aTo ensure your success, we offer training that encompasses all facets of our business operations. You\u2019ll experience hands on training provided by seasoned professionals in each department, primarily:\u000d\u000a\u000d\u000aPromotional Marketing\u000d\u000aCustomer Service\u000d\u000aConsumer Relations\u000d\u000aBusiness Administration\u000d\u000aRecruiting and Talent Acquisition','Joy Boyd',0,'2019-11-01','2019-11-06',NULL) +INSERT INTO OFFER VALUES(6,'PHP developer','Responsible for all requests for data processing services including, preparation of specifications, development and maintenance of computer programs, job control language and operational documentation. Assists productions systems group. Interfaces with other departments to determine user needs.','Rebecca Bowman',0,'2020-01-01','2020-01-06',NULL) +INSERT INTO OFFER VALUES(7,'Security engineer','This position is open within the Security Engineering teams, which has full end-to-end ownership of security tools that allows for strong security prevention, detection and response capabilities. Our mission is to ensure cyber infrastructure is in line with industry standards by performing day-to-day system administration, product selection for new tools, deployment, configuration, maintenance, and support and license management.','Harry Gardner',0,'2020-01-01','2020-01-16',NULL) +INSERT INTO OFFER VALUES(8,'Project Manager','Performs a variety of duties associated with the development and production of the aircraft maintenance manuals, wiring diagram manuals and other associated documents. Utilize an automated publishing system to download, import, and distribute manual data.Individual will incorporate vendor revisions and Delta engineering documents into a Delta customized manual and coordinate the publishing of the same. Additional responsibilities may include continuous improvement of revision processes, training and point person for data issues. The Project Leader may also be responsible for review and distribution of Aircraft Maintenance Alerts (AMAs), company policy & procedures, bulletins, vendor access, and other technical information.','Erika Torres',0,'2020-01-01','2020-01-15',NULL) +INSERT INTO OFFER VALUES(9,'Istari support','Will provide administrative and logistical support to members of the executive team and may support other as needed. Must display professionalism and a strong work ethic while fostering a work environment that is positive, optimistic and collaborative. Position requires excellent administrative, communication, organizational and time management skills paired with flexibility, integrity and the ability to work independently. Must have Balrog fighting proficiency.','Eru I\u00favatar',0,'2020-01-01','2020-01-06',NULL) +INSERT INTO OFFER_CANDIDATES VALUES(0,0,0,0) +INSERT INTO OFFER_CANDIDATES VALUES(1,0,3,0) +INSERT INTO OFFER_CANDIDATES VALUES(2,0,8,0) +INSERT INTO OFFER_CANDIDATES VALUES(3,0,12,0) diff --git a/model/src/main/java/com/ontimize/model/core/dao/OfferCandidateStatusDao.java b/model/src/main/java/com/ontimize/model/core/dao/OfferCandidateStatusDao.java new file mode 100644 index 0000000..bcf1a04 --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/OfferCandidateStatusDao.java @@ -0,0 +1,17 @@ +package com.ontimize.model.core.dao; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("OfferCandidateStatusDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/OfferCandidateStatusDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class OfferCandidateStatusDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID ="ID"; + public static final String ATTR_DESCRIPTION ="DESCRIPTION"; + +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/dao/OfferCandidatesDao.java b/model/src/main/java/com/ontimize/model/core/dao/OfferCandidatesDao.java new file mode 100644 index 0000000..bc98b94 --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/OfferCandidatesDao.java @@ -0,0 +1,19 @@ +package com.ontimize.model.core.dao; + +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("OfferCandidatesDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/OfferCandidatesDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class OfferCandidatesDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID ="ID"; + public static final String ATTR_OFFER_ID ="OFFER_ID"; + public static final String ATTR_CANDIDATE_ID ="CANDIDATE_ID"; + public static final String ATTR_OFFER_CANDIDATE_STATUS ="OFFER_CANDIDATE_STATUS"; + +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/dao/OfferDao.java b/model/src/main/java/com/ontimize/model/core/dao/OfferDao.java new file mode 100644 index 0000000..59c6b02 --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/OfferDao.java @@ -0,0 +1,22 @@ +package com.ontimize.model.core.dao; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("OfferDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/OfferDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class OfferDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID = "ID"; + public static final String ATTR_ACRONYM = "ACRONYM"; + public static final String ATTR_DESCRIPTION = "DESCRIPTION"; + public static final String ATTR_APPLICANT = "APPLICANT"; + public static final String ATTR_OFFER_STATUS = "OFFER_STATUS"; + public static final String ATTR_CREATION_DATE = "CREATION_DATE"; + public static final String ATTR_START_DATE = "START_DATE"; + public static final String ATTR_END_DATE = "END_DATE"; + +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/dao/OfferStatusDao.java b/model/src/main/java/com/ontimize/model/core/dao/OfferStatusDao.java new file mode 100644 index 0000000..a143a0b --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/dao/OfferStatusDao.java @@ -0,0 +1,16 @@ +package com.ontimize.model.core.dao; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Repository; + +import com.ontimize.jee.server.dao.common.ConfigurationFile; +import com.ontimize.jee.server.dao.jdbc.OntimizeJdbcDaoSupport; + +@Repository("OfferStatusDao") +@Lazy +@ConfigurationFile(configurationFile = "dao/OfferStatusDao.xml", configurationFilePlaceholder = "dao/placeholders.properties") +public class OfferStatusDao extends OntimizeJdbcDaoSupport { + + public static final String ATTR_ID ="ID"; + public static final String ATTR_DESCRIPTION ="DESCRIPTION"; + +} \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/service/OfferService.java b/model/src/main/java/com/ontimize/model/core/service/OfferService.java new file mode 100644 index 0000000..11bca9a --- /dev/null +++ b/model/src/main/java/com/ontimize/model/core/service/OfferService.java @@ -0,0 +1,116 @@ +package com.ontimize.model.core.service; + +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import com.ontimize.db.EntityResult; +import com.ontimize.api.core.service.IOfferService; +import com.ontimize.model.core.dao.OfferCandidateStatusDao; +import com.ontimize.model.core.dao.OfferCandidatesDao; +import com.ontimize.model.core.dao.OfferDao; +import com.ontimize.model.core.dao.OfferStatusDao; +import com.ontimize.jee.common.exceptions.OntimizeJEERuntimeException; +import com.ontimize.jee.server.dao.DefaultOntimizeDaoHelper; + +@Service("OfferService") +@Lazy +public class OfferService implements IOfferService { + + @Autowired private OfferDao offerDao; + @Autowired private OfferStatusDao offerStatusDao; + @Autowired private OfferCandidatesDao offerCandidatesDao; + @Autowired private OfferCandidateStatusDao offerCandidateStatusDao; + @Autowired private DefaultOntimizeDaoHelper daoHelper; + + @Override + public EntityResult offerQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.offerDao, keyMap, attrList); + } + + @Override + public EntityResult offerInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.offerDao, attrMap); + } + + @Override + public EntityResult offerUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.offerDao, attrMap, keyMap); + } + + @Override + public EntityResult offerDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.offerDao, keyMap); + } + + @Override + public EntityResult offerStatusQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.offerStatusDao, keyMap, attrList); + } + + @Override + public EntityResult offerStatusInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.offerStatusDao, attrMap); + } + + @Override + public EntityResult offerStatusUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.offerStatusDao, attrMap, keyMap); + } + + @Override + public EntityResult offerStatusDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.offerStatusDao, keyMap); + } + + @Override + public EntityResult offerCandidateQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.offerCandidatesDao, keyMap, attrList); + } + + @Override + public EntityResult offerCandidateInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.offerCandidatesDao, attrMap); + } + + @Override + public EntityResult offerCandidateUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.offerCandidatesDao, attrMap, keyMap); + } + + @Override + public EntityResult offerCandidateDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.offerCandidatesDao, keyMap); + } + + @Override + public EntityResult offerCandidateStatusQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.offerCandidateStatusDao, keyMap, attrList); + } + + @Override + public EntityResult offerCandidateStatusInsert(Map attrMap) throws OntimizeJEERuntimeException { + return this.daoHelper.insert(this.offerCandidateStatusDao, attrMap); + } + + @Override + public EntityResult offerCandidateStatusUpdate(Map attrMap, Map keyMap) + throws OntimizeJEERuntimeException { + return this.daoHelper.update(this.offerCandidateStatusDao, attrMap, keyMap); + } + + @Override + public EntityResult offerCandidateStatusDelete(Map keyMap) throws OntimizeJEERuntimeException { + return this.daoHelper.delete(this.offerCandidateStatusDao, keyMap); + } +} \ No newline at end of file diff --git a/model/src/main/resources/dao/OfferCandidateStatusDao.xml b/model/src/main/resources/dao/OfferCandidateStatusDao.xml new file mode 100644 index 0000000..81c9375 --- /dev/null +++ b/model/src/main/resources/dao/OfferCandidateStatusDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/model/src/main/resources/dao/OfferCandidatesDao.xml b/model/src/main/resources/dao/OfferCandidatesDao.xml new file mode 100644 index 0000000..10f25c5 --- /dev/null +++ b/model/src/main/resources/dao/OfferCandidatesDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/model/src/main/resources/dao/OfferDao.xml b/model/src/main/resources/dao/OfferDao.xml new file mode 100644 index 0000000..7d2c5e7 --- /dev/null +++ b/model/src/main/resources/dao/OfferDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/model/src/main/resources/dao/OfferStatusDao.xml b/model/src/main/resources/dao/OfferStatusDao.xml new file mode 100644 index 0000000..98bfe67 --- /dev/null +++ b/model/src/main/resources/dao/OfferStatusDao.xml @@ -0,0 +1,15 @@ + + + + ID + + + ID + + ID + \ No newline at end of file diff --git a/ws/src/main/java/com/ontimize/ws/core/rest/OfferRestController.java b/ws/src/main/java/com/ontimize/ws/core/rest/OfferRestController.java new file mode 100644 index 0000000..254219d --- /dev/null +++ b/ws/src/main/java/com/ontimize/ws/core/rest/OfferRestController.java @@ -0,0 +1,23 @@ +package com.ontimize.ws.core.rest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ontimize.api.core.service.IOfferService; +import com.ontimize.jee.server.rest.ORestController; + +@RestController +@RequestMapping("/offers") +@ComponentScan(basePackageClasses = { com.ontimize.api.core.service.IOfferService.class }) +public class OfferRestController extends ORestController { + + @Autowired + private IOfferService offerService; + + @Override + public IOfferService getService() { + return this.offerService; + } +} \ No newline at end of file From 695c740b4726e0be71f82ea1259fe4c0fe8f77b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Tue, 23 Jun 2020 12:58:10 +0200 Subject: [PATCH 07/10] Exercise 9: Use of Basic Expression and new methods --- ...mize Boot Training.postman_collection.json | 120 ++++++++++++++++++ .../ws/core/rest/OfferRestController.java | 73 +++++++++++ 2 files changed, 193 insertions(+) diff --git a/Ontimize Boot Training.postman_collection.json b/Ontimize Boot Training.postman_collection.json index 30ecc13..b3a8b9c 100644 --- a/Ontimize Boot Training.postman_collection.json +++ b/Ontimize Boot Training.postman_collection.json @@ -1042,6 +1042,126 @@ }, "response": [] }, + { + "name": "offer status -R (Basic Expression)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \"@basic_expression\": {\n \"lop\": \"START_DATE\",\n \"op\": \">=\",\n \"rop\": \"2020-01-15\"\n }\n },\n \"columns\": [\n \"ID\",\n \"DESCRIPTION\",\n \"OFFER_STATUS\",\n \"END_DATE\",\n \"APPLICANT\",\n \"ACRONYM\",\n \"CREATION_DATE\",\n \"START_DATE\"\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offer/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offer", + "search" + ] + } + }, + "response": [] + }, + { + "name": "offer status -R (Complex Basic Expression)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \"@basic_expression\": {\n \"lop\": {\n \"lop\": \"START_DATE\",\n \"op\": \">=\",\n \"rop\": \"2019-06-01\"\n },\n \"op\": \"AND\",\n \"rop\": {\n \"lop\": \"START_DATE\",\n \"op\": \"<\",\n \"rop\": \"2020-01-01\"\n }\n }\n },\n \"columns\": [\n \"ID\",\n \"DESCRIPTION\",\n \"OFFER_STATUS\",\n \"END_DATE\",\n \"APPLICANT\",\n \"ACRONYM\",\n \"CREATION_DATE\",\n \"START_DATE\"\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offer/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offer", + "search" + ] + } + }, + "response": [] + }, + { + "name": "offer status -R (REST Basic Expression - Current)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"columns\": [\n \"ID\",\n \"DESCRIPTION\",\n \"OFFER_STATUS\",\n \"END_DATE\",\n \"APPLICANT\",\n \"ACRONYM\",\n \"CREATION_DATE\",\n \"START_DATE\"\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/currentOffers/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "currentOffers", + "search" + ] + } + }, + "response": [] + }, + { + "name": "offer status -R (REST Basic Expression - FilterYear)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \"YEAR\": 2019\n },\n \"columns\": [\n \"ID\",\n \"DESCRIPTION\",\n \"OFFER_STATUS\",\n \"END_DATE\",\n \"APPLICANT\",\n \"ACRONYM\",\n \"CREATION_DATE\",\n \"START_DATE\"\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/yearOffers/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "yearOffers", + "search" + ] + } + }, + "response": [] + }, { "name": "offer status -U", "request": { diff --git a/ws/src/main/java/com/ontimize/ws/core/rest/OfferRestController.java b/ws/src/main/java/com/ontimize/ws/core/rest/OfferRestController.java index 254219d..0c4ed23 100644 --- a/ws/src/main/java/com/ontimize/ws/core/rest/OfferRestController.java +++ b/ws/src/main/java/com/ontimize/ws/core/rest/OfferRestController.java @@ -1,11 +1,27 @@ package com.ontimize.ws.core.rest; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import com.ontimize.db.EntityResult; +import com.ontimize.db.SQLStatementBuilder; +import com.ontimize.db.SQLStatementBuilder.BasicExpression; +import com.ontimize.db.SQLStatementBuilder.BasicOperator; +import com.ontimize.db.SQLStatementBuilder.BasicField; import com.ontimize.api.core.service.IOfferService; +import com.ontimize.model.core.dao.OfferDao; import com.ontimize.jee.server.rest.ORestController; @RestController @@ -20,4 +36,61 @@ public class OfferRestController extends ORestController { public IOfferService getService() { return this.offerService; } + + @RequestMapping(value = "currentOffers/search", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) + public EntityResult currentOffersSearch(@RequestBody Map req) { + try { + List columns = (List) req.get("columns"); + Map key = new HashMap(); + key.put(SQLStatementBuilder.ExtendedSQLConditionValuesProcessor.EXPRESSION_KEY, + searchBetween(OfferDao.ATTR_START_DATE)); + return offerService.offerQuery(key, columns); + } catch (Exception e) { + e.printStackTrace(); + EntityResult res = new EntityResult(); + res.setCode(EntityResult.OPERATION_WRONG); + return res; + } + } + + @RequestMapping(value = "yearOffers/search", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) + public EntityResult yearOffersSearch(@RequestBody Map req) { + try { + List columns = (List) req.get("columns"); + Map filter = (Map) req.get("filter"); + int year = (int) filter.get("YEAR"); + Map key = new HashMap(); + key.put(SQLStatementBuilder.ExtendedSQLConditionValuesProcessor.EXPRESSION_KEY, + searchBetweenWithYear(OfferDao.ATTR_START_DATE, year)); + return offerService.offerQuery(key, columns); + } catch (Exception e) { + e.printStackTrace(); + EntityResult res = new EntityResult(); + res.setCode(EntityResult.OPERATION_WRONG); + return res; + } + } + + private BasicExpression searchBetween(String param) { + + Calendar cal = Calendar.getInstance(); + int currentYear = cal.get(Calendar.YEAR); + + return this.searchBetweenWithYear(param, currentYear); + } + + private BasicExpression searchBetweenWithYear(String param, int year) { + + Calendar cal = Calendar.getInstance(); + cal.set(year, 0, 1); + Date startDate = cal.getTime(); + cal.set(year + 1, 0, 1); + Date endDate = cal.getTime(); + + BasicField field = new BasicField(param); + BasicExpression bexp1 = new BasicExpression(field, BasicOperator.MORE_EQUAL_OP, startDate); + BasicExpression bexp2 = new BasicExpression(field, BasicOperator.LESS_OP, endDate); + return new BasicExpression(bexp1, BasicOperator.AND_OP, bexp2); + } + } \ No newline at end of file From 886371114412ae76dd3f135328a816df12c6b04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Wed, 1 Jul 2020 11:23:55 +0200 Subject: [PATCH 08/10] Exercise 10: Use of complex queries --- ...mize Boot Training.postman_collection.json | 62 ++++++++++++++----- .../api/core/service/IOfferService.java | 1 + .../model/core/dao/OfferCandidatesDao.java | 1 + .../model/core/service/OfferService.java | 6 ++ .../main/resources/dao/OfferCandidatesDao.xml | 28 +++++++++ 5 files changed, 82 insertions(+), 16 deletions(-) diff --git a/Ontimize Boot Training.postman_collection.json b/Ontimize Boot Training.postman_collection.json index b3a8b9c..9de46d5 100644 --- a/Ontimize Boot Training.postman_collection.json +++ b/Ontimize Boot Training.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "66b8d05b-4d9c-4acc-81bf-82fd5c095ce1", + "_postman_id": "aa064168-a723-4551-a42a-26f4c0063ca4", "name": "Ontimize Boot Training", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, @@ -946,7 +946,7 @@ "name": "Offer", "item": [ { - "name": "offer status -C", + "name": "offer -C", "request": { "method": "POST", "header": [], @@ -975,7 +975,7 @@ "response": [] }, { - "name": "offer status-R", + "name": "offer -R", "protocolProfileBehavior": { "disableBodyPruning": true }, @@ -1013,7 +1013,7 @@ "response": [] }, { - "name": "offer status -R (Complex)", + "name": "offer -R (Complex)", "request": { "method": "POST", "header": [], @@ -1043,7 +1043,7 @@ "response": [] }, { - "name": "offer status -R (Basic Expression)", + "name": "offer -R (Basic Expression)", "request": { "method": "POST", "header": [], @@ -1073,7 +1073,7 @@ "response": [] }, { - "name": "offer status -R (Complex Basic Expression)", + "name": "offer -R (Complex Basic Expression)", "request": { "method": "POST", "header": [], @@ -1103,7 +1103,7 @@ "response": [] }, { - "name": "offer status -R (REST Basic Expression - Current)", + "name": "offer -R (REST Basic Expression - Current)", "request": { "method": "POST", "header": [], @@ -1133,7 +1133,7 @@ "response": [] }, { - "name": "offer status -R (REST Basic Expression - FilterYear)", + "name": "offer -R (REST Basic Expression - FilterYear)", "request": { "method": "POST", "header": [], @@ -1163,7 +1163,7 @@ "response": [] }, { - "name": "offer status -U", + "name": "offer -U", "request": { "method": "PUT", "header": [], @@ -1192,7 +1192,7 @@ "response": [] }, { - "name": "offer status -D", + "name": "offer -D", "request": { "method": "DELETE", "header": [], @@ -1486,6 +1486,36 @@ }, "response": [] }, + { + "name": "offer candidate -R (Details)", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"filter\": {\n \t\"ID\": 0\n },\n \"columns\": [\"ID\",\"DESCRIPTION\",\"OFFER_STATUS\",\"END_DATE\",\"APPLICANT\",\"ACRONYM\",\"CREATION_DATE\",\"START_DATE\",\"NAME\",\"SURNAME\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:33333/offers/offerCandidateDetails/search", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "33333", + "path": [ + "offers", + "offerCandidateDetails", + "search" + ] + } + }, + "response": [] + }, { "name": "offer candidate -U", "request": { @@ -1549,7 +1579,7 @@ { "listen": "prerequest", "script": { - "id": "6bd9c516-af63-446b-966e-e5a203013215", + "id": "11ecf888-72e5-4228-b9f5-1c2fc78b6a94", "type": "text/javascript", "exec": [ "" @@ -1559,7 +1589,7 @@ { "listen": "test", "script": { - "id": "33e79744-9761-48f9-8a78-9aa908f9a3ea", + "id": "502d90b1-22e9-4426-8b62-9a37f7cfcda7", "type": "text/javascript", "exec": [ "" @@ -1733,7 +1763,7 @@ { "listen": "prerequest", "script": { - "id": "71ed2803-2464-4851-b017-89befc12a4ae", + "id": "d8f708c5-b635-4a34-a905-0fbfde0ce49e", "type": "text/javascript", "exec": [ "" @@ -1743,7 +1773,7 @@ { "listen": "test", "script": { - "id": "8232af92-b4d4-4bb0-a0b9-da02afea9de6", + "id": "cdd0f9d4-0cc5-412b-9571-83e52211fe5f", "type": "text/javascript", "exec": [ "" @@ -1777,7 +1807,7 @@ { "listen": "prerequest", "script": { - "id": "da23bd76-51cd-4551-be67-de10f86ae2cd", + "id": "523e4020-c1e5-458c-9538-b5bb6f0784ff", "type": "text/javascript", "exec": [ "" @@ -1787,7 +1817,7 @@ { "listen": "test", "script": { - "id": "e3e834ee-d7cc-4c03-bdf7-c38cabd4982b", + "id": "978f2bf4-7ab1-4f60-9cbb-c4a2de0ea2c1", "type": "text/javascript", "exec": [ "" diff --git a/api/src/main/java/com/ontimize/api/core/service/IOfferService.java b/api/src/main/java/com/ontimize/api/core/service/IOfferService.java index 35cbfad..cd10e54 100644 --- a/api/src/main/java/com/ontimize/api/core/service/IOfferService.java +++ b/api/src/main/java/com/ontimize/api/core/service/IOfferService.java @@ -22,6 +22,7 @@ public interface IOfferService { // OFFER CANDIDATES public EntityResult offerCandidateQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; + public EntityResult offerCandidateDetailsQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException; public EntityResult offerCandidateInsert(Map attrMap) throws OntimizeJEERuntimeException; public EntityResult offerCandidateUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException; public EntityResult offerCandidateDelete(Map keyMap) throws OntimizeJEERuntimeException; diff --git a/model/src/main/java/com/ontimize/model/core/dao/OfferCandidatesDao.java b/model/src/main/java/com/ontimize/model/core/dao/OfferCandidatesDao.java index bc98b94..0d9362a 100644 --- a/model/src/main/java/com/ontimize/model/core/dao/OfferCandidatesDao.java +++ b/model/src/main/java/com/ontimize/model/core/dao/OfferCandidatesDao.java @@ -15,5 +15,6 @@ public class OfferCandidatesDao extends OntimizeJdbcDaoSupport { public static final String ATTR_OFFER_ID ="OFFER_ID"; public static final String ATTR_CANDIDATE_ID ="CANDIDATE_ID"; public static final String ATTR_OFFER_CANDIDATE_STATUS ="OFFER_CANDIDATE_STATUS"; + public static final String QUERY_OFFER_DETAILS = "details"; } \ No newline at end of file diff --git a/model/src/main/java/com/ontimize/model/core/service/OfferService.java b/model/src/main/java/com/ontimize/model/core/service/OfferService.java index 11bca9a..38702ff 100644 --- a/model/src/main/java/com/ontimize/model/core/service/OfferService.java +++ b/model/src/main/java/com/ontimize/model/core/service/OfferService.java @@ -75,6 +75,12 @@ public EntityResult offerCandidateQuery(Map keyMap, List throws OntimizeJEERuntimeException { return this.daoHelper.query(this.offerCandidatesDao, keyMap, attrList); } + + @Override + public EntityResult offerCandidateDetailsQuery(Map keyMap, List attrList) + throws OntimizeJEERuntimeException { + return this.daoHelper.query(this.offerCandidatesDao, keyMap, attrList, OfferCandidatesDao.QUERY_OFFER_DETAILS); + } @Override public EntityResult offerCandidateInsert(Map attrMap) throws OntimizeJEERuntimeException { diff --git a/model/src/main/resources/dao/OfferCandidatesDao.xml b/model/src/main/resources/dao/OfferCandidatesDao.xml index 10f25c5..4974034 100644 --- a/model/src/main/resources/dao/OfferCandidatesDao.xml +++ b/model/src/main/resources/dao/OfferCandidatesDao.xml @@ -12,4 +12,32 @@ ID ID + + + + + + + + + + + + \ No newline at end of file From 6fdb04242c0bbef8d9a0f5273496099a7896508f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Thu, 2 Jul 2020 15:46:35 +0200 Subject: [PATCH 09/10] Exercise 11: Using server permission --- .../ontimize/boot/core/ServerApplication.java | 2 + model/src/main/db/templateDB.script | 45 +++++++++++++++++-- model/src/main/db/templateDB.txt | 45 +++++++++++++++++-- .../model/core/service/OfferService.java | 19 ++++++++ 4 files changed, 103 insertions(+), 8 deletions(-) diff --git a/boot/src/main/java/com/ontimize/boot/core/ServerApplication.java b/boot/src/main/java/com/ontimize/boot/core/ServerApplication.java index 3973efa..3db59e1 100644 --- a/boot/src/main/java/com/ontimize/boot/core/ServerApplication.java +++ b/boot/src/main/java/com/ontimize/boot/core/ServerApplication.java @@ -4,10 +4,12 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.EnableAspectJAutoProxy; @SpringBootApplication @ComponentScan(basePackages = {"com.ontimize.model.core","com.ontimize.ws.core"}) +@EnableAspectJAutoProxy(proxyTargetClass = false) public class ServerApplication { public static void main(String[] args) { diff --git a/model/src/main/db/templateDB.script b/model/src/main/db/templateDB.script index f2a0731..1b69a7c 100644 --- a/model/src/main/db/templateDB.script +++ b/model/src/main/db/templateDB.script @@ -36,11 +36,11 @@ CREATE SCHEMA PUBLIC AUTHORIZATION DBA SET SCHEMA PUBLIC CREATE MEMORY TABLE PUBLIC.TUSER(USER_ VARCHAR(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR(50),NAME VARCHAR(50),SURNAME VARCHAR(50),EMAIL VARCHAR(50),NIF VARCHAR(50),USERBLOCKED TIMESTAMP,LASTPASSWORDUPDATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,FIRSTLOGIN BOOLEAN DEFAULT TRUE) CREATE MEMORY TABLE PUBLIC.TROLE(ID_ROLENAME INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ROLENAME VARCHAR(255),XMLCLIENTPERMISSION VARCHAR(16777216)) -ALTER TABLE PUBLIC.TROLE ALTER COLUMN ID_ROLENAME RESTART WITH 1 +ALTER TABLE PUBLIC.TROLE ALTER COLUMN ID_ROLENAME RESTART WITH 2 CREATE MEMORY TABLE PUBLIC.TUSER_ROLE(ID_USER_ROLE INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_ROLENAME INTEGER,USER_ VARCHAR(50),CONSTRAINT FK_TUSER FOREIGN KEY(USER_) REFERENCES PUBLIC.TUSER(USER_),CONSTRAINT FK_TROLE FOREIGN KEY(ID_ROLENAME) REFERENCES PUBLIC.TROLE(ID_ROLENAME)) -ALTER TABLE PUBLIC.TUSER_ROLE ALTER COLUMN ID_USER_ROLE RESTART WITH 1 +ALTER TABLE PUBLIC.TUSER_ROLE ALTER COLUMN ID_USER_ROLE RESTART WITH 2 CREATE MEMORY TABLE PUBLIC.TSERVER_PERMISSION(ID_SERVER_PERMISSION INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PERMISSION_NAME VARCHAR(16777216)) -ALTER TABLE PUBLIC.TSERVER_PERMISSION ALTER COLUMN ID_SERVER_PERMISSION RESTART WITH 17 +ALTER TABLE PUBLIC.TSERVER_PERMISSION ALTER COLUMN ID_SERVER_PERMISSION RESTART WITH 34 CREATE MEMORY TABLE PUBLIC.TREQUEST_STATISTICS(ID_REQUEST_STATISTICS INTEGER NOT NULL PRIMARY KEY,SERVICE_NAME VARCHAR(255),METHOD_NAME VARCHAR(50),USER_NAME VARCHAR(50),EXECUTION_DATE DATE,EXECUTION_TIME INTEGER,METHOD_PARAMS VARCHAR(5000),SERVICE_EXCEPTION VARCHAR(5000)) CREATE MEMORY TABLE PUBLIC.TSETTING(ID_SETTING INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,SETTING_KEY VARCHAR(16777216),SETTING_VALUE VARCHAR(16777216),SETTING_COMMENT VARCHAR(16777216)) ALTER TABLE PUBLIC.TSETTING ALTER COLUMN ID_SETTING RESTART WITH 8 @@ -51,7 +51,7 @@ ALTER TABLE PUBLIC.TI18N ALTER COLUMN ID_I18N RESTART WITH 1 CREATE MEMORY TABLE PUBLIC.TI18N_VALUE(ID_I18N_VALUE INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_I18N INTEGER NOT NULL,"KEY" VARCHAR(250),ES_ES VARCHAR(16777216),EN_US VARCHAR(16777216),GL_ES VARCHAR(16777216)) ALTER TABLE PUBLIC.TI18N_VALUE ALTER COLUMN ID_I18N_VALUE RESTART WITH 34 CREATE MEMORY TABLE PUBLIC.TROLE_SERVER_PERMISSION(ID_ROLE_SERVER_PERMISSION INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_ROLENAME INTEGER,ID_SERVER_PERMISSION INTEGER,CONSTRAINT FK_TROLE_SERVER_PERMISSION FOREIGN KEY(ID_ROLENAME) REFERENCES PUBLIC.TROLE(ID_ROLENAME),CONSTRAINT FK_TSERVER_PERMISSION FOREIGN KEY(ID_SERVER_PERMISSION) REFERENCES PUBLIC.TSERVER_PERMISSION(ID_SERVER_PERMISSION)) -ALTER TABLE PUBLIC.TROLE_SERVER_PERMISSION ALTER COLUMN ID_ROLE_SERVER_PERMISSION RESTART WITH 17 +ALTER TABLE PUBLIC.TROLE_SERVER_PERMISSION ALTER COLUMN ID_ROLE_SERVER_PERMISSION RESTART WITH 34 CREATE MEMORY TABLE PUBLIC.CANDIDATE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PHOTO VARBINARY(16777216),NAME VARCHAR(255),SURNAME VARCHAR(255),BIRTHDAY DATE,DNI VARCHAR(255),PHONE VARCHAR(255),EMAIL VARCHAR(255),EDUCATION INTEGER,SPECIALTIES VARCHAR(255),STATUS INTEGER,ORIGIN INTEGER,WAGE_LEVEL NUMERIC(128),EXPERIENCE_LEVEL INTEGER,PROFILE INTEGER,COMMENT VARCHAR(255),LINKEDIN VARCHAR(255)) ALTER TABLE PUBLIC.CANDIDATE ALTER COLUMN ID RESTART WITH 15 CREATE MEMORY TABLE PUBLIC.PROFILE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) @@ -88,9 +88,12 @@ GRANT DBA TO SA SET SCHEMA SYSTEM_LOBS INSERT INTO BLOCKS VALUES(0,2147483647,0) SET SCHEMA PUBLIC +INSERT INTO TUSER VALUES('candidate','candidate','candidate','candidate',NULL,'99999999R',NULL,'2020-07-03 11:50:40.665000',NULL) INSERT INTO TUSER VALUES('demo','demouser','demo','demo',NULL,'44460713B',NULL,NULL,NULL) INSERT INTO TROLE VALUES(0,'admin','') +INSERT INTO TROLE VALUES(1,'candidate','') INSERT INTO TUSER_ROLE VALUES(0,0,'demo') +INSERT INTO TUSER_ROLE VALUES(1,1,'candidate') INSERT INTO TSERVER_PERMISSION VALUES(0,'com.ontimize.jee.common.services.user.IUserInformationService/getUserInformation') INSERT INTO TSERVER_PERMISSION VALUES(1,'com.ontimize.jee.common.services.mail.IMailService/sendMail') INSERT INTO TSERVER_PERMISSION VALUES(2,'com.ontimize.jee.common.services.mail.IMailService/sendMailWithoutAttach') @@ -107,6 +110,23 @@ INSERT INTO TSERVER_PERMISSION VALUES(12,'com.ontimize.jee.common.services.prefe INSERT INTO TSERVER_PERMISSION VALUES(13,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/savePreferences') INSERT INTO TSERVER_PERMISSION VALUES(14,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/loadPreferences') INSERT INTO TSERVER_PERMISSION VALUES(15,'com.ontimize.jee.common.services.i18n.II18nService/deleteBundleValues') +INSERT INTO TSERVER_PERMISSION VALUES(17,'com.ontimize.model.core.service.OfferService/offerQuery') +INSERT INTO TSERVER_PERMISSION VALUES(18,'com.ontimize.model.core.service.OfferService/offerInsert') +INSERT INTO TSERVER_PERMISSION VALUES(19,'com.ontimize.model.core.service.OfferService/offerUpdate') +INSERT INTO TSERVER_PERMISSION VALUES(20,'com.ontimize.model.core.service.OfferService/offerDelete') +INSERT INTO TSERVER_PERMISSION VALUES(21,'com.ontimize.model.core.service.OfferService/offerStatusQuery') +INSERT INTO TSERVER_PERMISSION VALUES(22,'com.ontimize.model.core.service.OfferService/offerStatusInsert') +INSERT INTO TSERVER_PERMISSION VALUES(23,'com.ontimize.model.core.service.OfferService/offerStatusUpdate') +INSERT INTO TSERVER_PERMISSION VALUES(24,'com.ontimize.model.core.service.OfferService/offerStatusDelete') +INSERT INTO TSERVER_PERMISSION VALUES(25,'com.ontimize.model.core.service.OfferService/offerCandidateQuery') +INSERT INTO TSERVER_PERMISSION VALUES(26,'com.ontimize.model.core.service.OfferService/offerCandidateDetailsQuery') +INSERT INTO TSERVER_PERMISSION VALUES(27,'com.ontimize.model.core.service.OfferService/offerCandidateInsert') +INSERT INTO TSERVER_PERMISSION VALUES(28,'com.ontimize.model.core.service.OfferService/offerCandidateUpdate') +INSERT INTO TSERVER_PERMISSION VALUES(29,'com.ontimize.model.core.service.OfferService/offerCandidateDelete') +INSERT INTO TSERVER_PERMISSION VALUES(30,'com.ontimize.model.core.service.OfferService/offerCandidateStatusQuery') +INSERT INTO TSERVER_PERMISSION VALUES(31,'com.ontimize.model.core.service.OfferService/offerCandidateStatusInsert') +INSERT INTO TSERVER_PERMISSION VALUES(32,'com.ontimize.model.core.service.OfferService/offerCandidateStatusUpdate') +INSERT INTO TSERVER_PERMISSION VALUES(33,'com.ontimize.model.core.service.OfferService/offerCandidateStatusDelete') INSERT INTO TSETTING VALUES(0,'mail_host','smtp.gmail.com','Host del servidor') INSERT INTO TSETTING VALUES(1,'mail_port','587','Puerto del servidor de email') INSERT INTO TSETTING VALUES(2,'mail_protocol','smtp','Protocolo de env\u005cu00edo de mails') @@ -133,6 +153,23 @@ INSERT INTO TROLE_SERVER_PERMISSION VALUES(12,0,12) INSERT INTO TROLE_SERVER_PERMISSION VALUES(13,0,13) INSERT INTO TROLE_SERVER_PERMISSION VALUES(14,0,14) INSERT INTO TROLE_SERVER_PERMISSION VALUES(15,0,15) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(17,0,17) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(18,0,18) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(19,0,19) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(20,0,20) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(21,0,21) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(22,0,22) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(23,0,23) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(24,0,24) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(25,0,25) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(26,0,26) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(27,0,27) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(28,0,28) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(29,0,29) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(30,0,30) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(31,0,31) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(32,0,32) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(33,0,33) INSERT INTO CANDIDATE VALUES(0,NULL,'Nonnah','Baden','1994-12-24','71958681F','591-646-5605','nbaden0@plala.or.jp',NULL,'Erlang',NULL,NULL,NULL,NULL,NULL,NULL,NULL) INSERT INTO CANDIDATE VALUES(1,NULL,'Claiborn','Shawell','1989-08-01','28224678K','909-780-3858','cshawell1@chron.com',NULL,'JavaFX',NULL,NULL,NULL,NULL,NULL,NULL,NULL) INSERT INTO CANDIDATE VALUES(2,NULL,'Anne-marie','Frampton','1985-12-17','48230973L','466-225-8193','aframpton2@addtoany.com',NULL,'Matlab',NULL,NULL,NULL,NULL,NULL,NULL,NULL) diff --git a/model/src/main/db/templateDB.txt b/model/src/main/db/templateDB.txt index f2a0731..1b69a7c 100644 --- a/model/src/main/db/templateDB.txt +++ b/model/src/main/db/templateDB.txt @@ -36,11 +36,11 @@ CREATE SCHEMA PUBLIC AUTHORIZATION DBA SET SCHEMA PUBLIC CREATE MEMORY TABLE PUBLIC.TUSER(USER_ VARCHAR(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR(50),NAME VARCHAR(50),SURNAME VARCHAR(50),EMAIL VARCHAR(50),NIF VARCHAR(50),USERBLOCKED TIMESTAMP,LASTPASSWORDUPDATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,FIRSTLOGIN BOOLEAN DEFAULT TRUE) CREATE MEMORY TABLE PUBLIC.TROLE(ID_ROLENAME INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ROLENAME VARCHAR(255),XMLCLIENTPERMISSION VARCHAR(16777216)) -ALTER TABLE PUBLIC.TROLE ALTER COLUMN ID_ROLENAME RESTART WITH 1 +ALTER TABLE PUBLIC.TROLE ALTER COLUMN ID_ROLENAME RESTART WITH 2 CREATE MEMORY TABLE PUBLIC.TUSER_ROLE(ID_USER_ROLE INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_ROLENAME INTEGER,USER_ VARCHAR(50),CONSTRAINT FK_TUSER FOREIGN KEY(USER_) REFERENCES PUBLIC.TUSER(USER_),CONSTRAINT FK_TROLE FOREIGN KEY(ID_ROLENAME) REFERENCES PUBLIC.TROLE(ID_ROLENAME)) -ALTER TABLE PUBLIC.TUSER_ROLE ALTER COLUMN ID_USER_ROLE RESTART WITH 1 +ALTER TABLE PUBLIC.TUSER_ROLE ALTER COLUMN ID_USER_ROLE RESTART WITH 2 CREATE MEMORY TABLE PUBLIC.TSERVER_PERMISSION(ID_SERVER_PERMISSION INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PERMISSION_NAME VARCHAR(16777216)) -ALTER TABLE PUBLIC.TSERVER_PERMISSION ALTER COLUMN ID_SERVER_PERMISSION RESTART WITH 17 +ALTER TABLE PUBLIC.TSERVER_PERMISSION ALTER COLUMN ID_SERVER_PERMISSION RESTART WITH 34 CREATE MEMORY TABLE PUBLIC.TREQUEST_STATISTICS(ID_REQUEST_STATISTICS INTEGER NOT NULL PRIMARY KEY,SERVICE_NAME VARCHAR(255),METHOD_NAME VARCHAR(50),USER_NAME VARCHAR(50),EXECUTION_DATE DATE,EXECUTION_TIME INTEGER,METHOD_PARAMS VARCHAR(5000),SERVICE_EXCEPTION VARCHAR(5000)) CREATE MEMORY TABLE PUBLIC.TSETTING(ID_SETTING INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,SETTING_KEY VARCHAR(16777216),SETTING_VALUE VARCHAR(16777216),SETTING_COMMENT VARCHAR(16777216)) ALTER TABLE PUBLIC.TSETTING ALTER COLUMN ID_SETTING RESTART WITH 8 @@ -51,7 +51,7 @@ ALTER TABLE PUBLIC.TI18N ALTER COLUMN ID_I18N RESTART WITH 1 CREATE MEMORY TABLE PUBLIC.TI18N_VALUE(ID_I18N_VALUE INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_I18N INTEGER NOT NULL,"KEY" VARCHAR(250),ES_ES VARCHAR(16777216),EN_US VARCHAR(16777216),GL_ES VARCHAR(16777216)) ALTER TABLE PUBLIC.TI18N_VALUE ALTER COLUMN ID_I18N_VALUE RESTART WITH 34 CREATE MEMORY TABLE PUBLIC.TROLE_SERVER_PERMISSION(ID_ROLE_SERVER_PERMISSION INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,ID_ROLENAME INTEGER,ID_SERVER_PERMISSION INTEGER,CONSTRAINT FK_TROLE_SERVER_PERMISSION FOREIGN KEY(ID_ROLENAME) REFERENCES PUBLIC.TROLE(ID_ROLENAME),CONSTRAINT FK_TSERVER_PERMISSION FOREIGN KEY(ID_SERVER_PERMISSION) REFERENCES PUBLIC.TSERVER_PERMISSION(ID_SERVER_PERMISSION)) -ALTER TABLE PUBLIC.TROLE_SERVER_PERMISSION ALTER COLUMN ID_ROLE_SERVER_PERMISSION RESTART WITH 17 +ALTER TABLE PUBLIC.TROLE_SERVER_PERMISSION ALTER COLUMN ID_ROLE_SERVER_PERMISSION RESTART WITH 34 CREATE MEMORY TABLE PUBLIC.CANDIDATE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,PHOTO VARBINARY(16777216),NAME VARCHAR(255),SURNAME VARCHAR(255),BIRTHDAY DATE,DNI VARCHAR(255),PHONE VARCHAR(255),EMAIL VARCHAR(255),EDUCATION INTEGER,SPECIALTIES VARCHAR(255),STATUS INTEGER,ORIGIN INTEGER,WAGE_LEVEL NUMERIC(128),EXPERIENCE_LEVEL INTEGER,PROFILE INTEGER,COMMENT VARCHAR(255),LINKEDIN VARCHAR(255)) ALTER TABLE PUBLIC.CANDIDATE ALTER COLUMN ID RESTART WITH 15 CREATE MEMORY TABLE PUBLIC.PROFILE(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(255) NOT NULL) @@ -88,9 +88,12 @@ GRANT DBA TO SA SET SCHEMA SYSTEM_LOBS INSERT INTO BLOCKS VALUES(0,2147483647,0) SET SCHEMA PUBLIC +INSERT INTO TUSER VALUES('candidate','candidate','candidate','candidate',NULL,'99999999R',NULL,'2020-07-03 11:50:40.665000',NULL) INSERT INTO TUSER VALUES('demo','demouser','demo','demo',NULL,'44460713B',NULL,NULL,NULL) INSERT INTO TROLE VALUES(0,'admin','') +INSERT INTO TROLE VALUES(1,'candidate','') INSERT INTO TUSER_ROLE VALUES(0,0,'demo') +INSERT INTO TUSER_ROLE VALUES(1,1,'candidate') INSERT INTO TSERVER_PERMISSION VALUES(0,'com.ontimize.jee.common.services.user.IUserInformationService/getUserInformation') INSERT INTO TSERVER_PERMISSION VALUES(1,'com.ontimize.jee.common.services.mail.IMailService/sendMail') INSERT INTO TSERVER_PERMISSION VALUES(2,'com.ontimize.jee.common.services.mail.IMailService/sendMailWithoutAttach') @@ -107,6 +110,23 @@ INSERT INTO TSERVER_PERMISSION VALUES(12,'com.ontimize.jee.common.services.prefe INSERT INTO TSERVER_PERMISSION VALUES(13,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/savePreferences') INSERT INTO TSERVER_PERMISSION VALUES(14,'com.ontimize.jee.common.services.preferences.IRemoteApplicationPreferencesService/loadPreferences') INSERT INTO TSERVER_PERMISSION VALUES(15,'com.ontimize.jee.common.services.i18n.II18nService/deleteBundleValues') +INSERT INTO TSERVER_PERMISSION VALUES(17,'com.ontimize.model.core.service.OfferService/offerQuery') +INSERT INTO TSERVER_PERMISSION VALUES(18,'com.ontimize.model.core.service.OfferService/offerInsert') +INSERT INTO TSERVER_PERMISSION VALUES(19,'com.ontimize.model.core.service.OfferService/offerUpdate') +INSERT INTO TSERVER_PERMISSION VALUES(20,'com.ontimize.model.core.service.OfferService/offerDelete') +INSERT INTO TSERVER_PERMISSION VALUES(21,'com.ontimize.model.core.service.OfferService/offerStatusQuery') +INSERT INTO TSERVER_PERMISSION VALUES(22,'com.ontimize.model.core.service.OfferService/offerStatusInsert') +INSERT INTO TSERVER_PERMISSION VALUES(23,'com.ontimize.model.core.service.OfferService/offerStatusUpdate') +INSERT INTO TSERVER_PERMISSION VALUES(24,'com.ontimize.model.core.service.OfferService/offerStatusDelete') +INSERT INTO TSERVER_PERMISSION VALUES(25,'com.ontimize.model.core.service.OfferService/offerCandidateQuery') +INSERT INTO TSERVER_PERMISSION VALUES(26,'com.ontimize.model.core.service.OfferService/offerCandidateDetailsQuery') +INSERT INTO TSERVER_PERMISSION VALUES(27,'com.ontimize.model.core.service.OfferService/offerCandidateInsert') +INSERT INTO TSERVER_PERMISSION VALUES(28,'com.ontimize.model.core.service.OfferService/offerCandidateUpdate') +INSERT INTO TSERVER_PERMISSION VALUES(29,'com.ontimize.model.core.service.OfferService/offerCandidateDelete') +INSERT INTO TSERVER_PERMISSION VALUES(30,'com.ontimize.model.core.service.OfferService/offerCandidateStatusQuery') +INSERT INTO TSERVER_PERMISSION VALUES(31,'com.ontimize.model.core.service.OfferService/offerCandidateStatusInsert') +INSERT INTO TSERVER_PERMISSION VALUES(32,'com.ontimize.model.core.service.OfferService/offerCandidateStatusUpdate') +INSERT INTO TSERVER_PERMISSION VALUES(33,'com.ontimize.model.core.service.OfferService/offerCandidateStatusDelete') INSERT INTO TSETTING VALUES(0,'mail_host','smtp.gmail.com','Host del servidor') INSERT INTO TSETTING VALUES(1,'mail_port','587','Puerto del servidor de email') INSERT INTO TSETTING VALUES(2,'mail_protocol','smtp','Protocolo de env\u005cu00edo de mails') @@ -133,6 +153,23 @@ INSERT INTO TROLE_SERVER_PERMISSION VALUES(12,0,12) INSERT INTO TROLE_SERVER_PERMISSION VALUES(13,0,13) INSERT INTO TROLE_SERVER_PERMISSION VALUES(14,0,14) INSERT INTO TROLE_SERVER_PERMISSION VALUES(15,0,15) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(17,0,17) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(18,0,18) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(19,0,19) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(20,0,20) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(21,0,21) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(22,0,22) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(23,0,23) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(24,0,24) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(25,0,25) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(26,0,26) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(27,0,27) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(28,0,28) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(29,0,29) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(30,0,30) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(31,0,31) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(32,0,32) +INSERT INTO TROLE_SERVER_PERMISSION VALUES(33,0,33) INSERT INTO CANDIDATE VALUES(0,NULL,'Nonnah','Baden','1994-12-24','71958681F','591-646-5605','nbaden0@plala.or.jp',NULL,'Erlang',NULL,NULL,NULL,NULL,NULL,NULL,NULL) INSERT INTO CANDIDATE VALUES(1,NULL,'Claiborn','Shawell','1989-08-01','28224678K','909-780-3858','cshawell1@chron.com',NULL,'JavaFX',NULL,NULL,NULL,NULL,NULL,NULL,NULL) INSERT INTO CANDIDATE VALUES(2,NULL,'Anne-marie','Frampton','1985-12-17','48230973L','466-225-8193','aframpton2@addtoany.com',NULL,'Matlab',NULL,NULL,NULL,NULL,NULL,NULL,NULL) diff --git a/model/src/main/java/com/ontimize/model/core/service/OfferService.java b/model/src/main/java/com/ontimize/model/core/service/OfferService.java index 38702ff..d7d5192 100644 --- a/model/src/main/java/com/ontimize/model/core/service/OfferService.java +++ b/model/src/main/java/com/ontimize/model/core/service/OfferService.java @@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; +import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Service; import com.ontimize.db.EntityResult; @@ -14,6 +15,7 @@ import com.ontimize.model.core.dao.OfferDao; import com.ontimize.model.core.dao.OfferStatusDao; import com.ontimize.jee.common.exceptions.OntimizeJEERuntimeException; +import com.ontimize.jee.common.security.PermissionsProviderSecured; import com.ontimize.jee.server.dao.DefaultOntimizeDaoHelper; @Service("OfferService") @@ -27,95 +29,112 @@ public class OfferService implements IOfferService { @Autowired private DefaultOntimizeDaoHelper daoHelper; @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException { return this.daoHelper.query(this.offerDao, keyMap, attrList); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerInsert(Map attrMap) throws OntimizeJEERuntimeException { return this.daoHelper.insert(this.offerDao, attrMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException { return this.daoHelper.update(this.offerDao, attrMap, keyMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerDelete(Map keyMap) throws OntimizeJEERuntimeException { return this.daoHelper.delete(this.offerDao, keyMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerStatusQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException { return this.daoHelper.query(this.offerStatusDao, keyMap, attrList); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerStatusInsert(Map attrMap) throws OntimizeJEERuntimeException { return this.daoHelper.insert(this.offerStatusDao, attrMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerStatusUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException { return this.daoHelper.update(this.offerStatusDao, attrMap, keyMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerStatusDelete(Map keyMap) throws OntimizeJEERuntimeException { return this.daoHelper.delete(this.offerStatusDao, keyMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException { return this.daoHelper.query(this.offerCandidatesDao, keyMap, attrList); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateDetailsQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException { return this.daoHelper.query(this.offerCandidatesDao, keyMap, attrList, OfferCandidatesDao.QUERY_OFFER_DETAILS); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateInsert(Map attrMap) throws OntimizeJEERuntimeException { return this.daoHelper.insert(this.offerCandidatesDao, attrMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException { return this.daoHelper.update(this.offerCandidatesDao, attrMap, keyMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateDelete(Map keyMap) throws OntimizeJEERuntimeException { return this.daoHelper.delete(this.offerCandidatesDao, keyMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateStatusQuery(Map keyMap, List attrList) throws OntimizeJEERuntimeException { return this.daoHelper.query(this.offerCandidateStatusDao, keyMap, attrList); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateStatusInsert(Map attrMap) throws OntimizeJEERuntimeException { return this.daoHelper.insert(this.offerCandidateStatusDao, attrMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateStatusUpdate(Map attrMap, Map keyMap) throws OntimizeJEERuntimeException { return this.daoHelper.update(this.offerCandidateStatusDao, attrMap, keyMap); } @Override + @Secured({ PermissionsProviderSecured.SECURED }) public EntityResult offerCandidateStatusDelete(Map keyMap) throws OntimizeJEERuntimeException { return this.daoHelper.delete(this.offerCandidateStatusDao, keyMap); } From 0f87a5ca9cd5f0288e981a080242d4c3bcbe4f31 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Jan 2023 11:45:03 +0000 Subject: [PATCH 10/10] Bump json-schema and jsprim in /frontend/src/main/ngx Bumps [json-schema](https://github.com/kriszyp/json-schema) and [jsprim](https://github.com/joyent/node-jsprim). These dependencies needed to be updated together. Updates `json-schema` from 0.2.3 to 0.4.0 - [Release notes](https://github.com/kriszyp/json-schema/releases) - [Commits](https://github.com/kriszyp/json-schema/compare/v0.2.3...v0.4.0) Updates `jsprim` from 1.4.1 to 1.4.2 - [Release notes](https://github.com/joyent/node-jsprim/releases) - [Changelog](https://github.com/TritonDataCenter/node-jsprim/blob/v1.4.2/CHANGES.md) - [Commits](https://github.com/joyent/node-jsprim/compare/v1.4.1...v1.4.2) --- updated-dependencies: - dependency-name: json-schema dependency-type: indirect - dependency-name: jsprim dependency-type: indirect ... Signed-off-by: dependabot[bot] --- frontend/src/main/ngx/package-lock.json | 65 ++++++++++++++++--------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/frontend/src/main/ngx/package-lock.json b/frontend/src/main/ngx/package-lock.json index 085eeba..3d05c3b 100644 --- a/frontend/src/main/ngx/package-lock.json +++ b/frontend/src/main/ngx/package-lock.json @@ -866,7 +866,7 @@ }, "ajv": { "version": "6.4.0", - "resolved": "http://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz", "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=", "dev": true, "requires": { @@ -1115,7 +1115,7 @@ }, "async": { "version": "1.5.2", - "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, @@ -1197,7 +1197,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -3539,7 +3539,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3560,12 +3561,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "1.0.0", "concat-map": "0.0.1" @@ -3580,17 +3583,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3707,7 +3713,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3719,6 +3726,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "1.0.1" } @@ -3733,6 +3741,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "1.1.11" } @@ -3740,12 +3749,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "5.1.2", "yallist": "3.0.3" @@ -3764,6 +3775,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3844,7 +3856,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3856,6 +3869,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1.0.2" } @@ -3941,7 +3955,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3977,6 +3992,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "1.1.0", "is-fullwidth-code-point": "1.0.0", @@ -3996,6 +4012,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "2.1.1" } @@ -4039,12 +4056,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -4105,7 +4124,7 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, @@ -5369,7 +5388,7 @@ "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "integrity": "sha512-4Dj8Rf+fQ+/Pn7C5qeEX02op1WfOss3PKTE9Nsop3Dx+6UPxlm1dr/og7o2cRa5hNN07CACr4NFzRLtj/rjWog==", "dev": true, "requires": { "assert-plus": "1.0.0", @@ -6029,7 +6048,7 @@ "dependencies": { "semver": { "version": "5.3.0", - "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true }, @@ -6120,7 +6139,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -6466,7 +6485,7 @@ }, "yargs": { "version": "3.32.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", "dev": true, "requires": { @@ -6545,7 +6564,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -7200,7 +7219,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -8320,7 +8339,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -8640,7 +8659,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": {