aboutsummaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorsebdet <sd378r@intl.att.com>2018-09-03 14:39:21 +0200
committersebdet <sd378r@intl.att.com>2018-09-03 14:54:30 +0200
commit6651e17eab83a2231e1502f8083689f0ddc4751b (patch)
tree1df99c4200eaa13d1d0785246c6426825af1969d /extra
parent7c71ae72fb394728b0354dbfe9cae0e5f45230bc (diff)
Introduce tosca saving
Introduce tosca saving for generic Config policy + rest apis Issue-ID: CLAMP-214 Signed-off-by: sebdet <sd378r@intl.att.com> Change-Id: I34431d256b195071ea6f7581fc20aff9a6b9aaf7
Diffstat (limited to 'extra')
-rw-r--r--extra/sql/bulkload/clds-create-db-objects.sql47
-rw-r--r--extra/sql/bulkload/clds-stored-procedures.sql64
-rw-r--r--extra/sql/drop/clds-drop-db-objects.sql6
3 files changed, 117 insertions, 0 deletions
diff --git a/extra/sql/bulkload/clds-create-db-objects.sql b/extra/sql/bulkload/clds-create-db-objects.sql
index 78a1f7a6c..38cc466f5 100644
--- a/extra/sql/bulkload/clds-create-db-objects.sql
+++ b/extra/sql/bulkload/clds-create-db-objects.sql
@@ -114,6 +114,53 @@ CREATE TABLE clds_service_cache (
PRIMARY KEY (invariant_service_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+CREATE TABLE IF NOT EXISTS tosca_model (
+ tosca_model_id VARCHAR(36) NOT NULL,
+ tosca_model_name VARCHAR(80) NOT NULL,
+ policy_type VARCHAR(80) NULL,
+ user_id VARCHAR(80),
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (tosca_model_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE IF NOT EXISTS tosca_model_revision (
+ tosca_model_revision_id VARCHAR(36) NOT NULL,
+ tosca_model_id VARCHAR(36) NOT NULL,
+ version DOUBLE NOT NULL DEFAULT 1,
+ tosca_model_yaml MEDIUMTEXT NULL,
+ tosca_model_json MEDIUMTEXT NULL,
+ user_id VARCHAR(80),
+ createdTimestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ lastUpdatedTimestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (tosca_model_revision_id),
+ CONSTRAINT tosca_model_revision_ukey UNIQUE KEY (tosca_model_id, version),
+ CONSTRAINT tosca_model_revision_fkey01 FOREIGN KEY (tosca_model_id) REFERENCES tosca_model (tosca_model_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE IF NOT EXISTS dictionary (
+ dictionary_id VARCHAR(36) NOT NULL,
+ dictionary_name VARCHAR(80) NOT NULL,
+ created_by VARCHAR(80),
+ modified_by VARCHAR(80),
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (dictionary_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE IF NOT EXISTS dictionary_elements (
+ dict_element_id VARCHAR(36) NOT NULL,
+ dictionary_id VARCHAR(36) NOT NULL,
+ dict_element_name VARCHAR(250) NOT NULL,
+ dict_element_short_name VARCHAR(80) NOT NULL,
+ dict_element_description VARCHAR(250),
+ dict_element_type VARCHAR(80) NOT NULL,
+ created_by VARCHAR(80),
+ modified_by VARCHAR(80),
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (dict_element_id),
+ CONSTRAINT dictionary_elements_ukey UNIQUE KEY (dict_element_name, dict_element_short_name),
+ CONSTRAINT dictionary_elements_ukey_fkey01 FOREIGN KEY (dictionary_id) REFERENCES dictionary (dictionary_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
ALTER TABLE template
ADD CONSTRAINT template_bpmn_id_fkey01
FOREIGN KEY (template_bpmn_id)
diff --git a/extra/sql/bulkload/clds-stored-procedures.sql b/extra/sql/bulkload/clds-stored-procedures.sql
index d09d3fc81..107717451 100644
--- a/extra/sql/bulkload/clds-stored-procedures.sql
+++ b/extra/sql/bulkload/clds-stored-procedures.sql
@@ -15,6 +15,10 @@ DROP PROCEDURE IF EXISTS get_model_template;
DROP PROCEDURE IF EXISTS set_template;
DROP PROCEDURE IF EXISTS get_template;
DROP PROCEDURE IF EXISTS del_model;
+DROP PROCEDURE IF EXISTS set_new_tosca_model_version;
+DROP PROCEDURE IF EXISTS set_tosca_model;
+DROP PROCEDURE IF EXISTS set_dictionary;
+DROP PROCEDURE IF EXISTS set_dictionary_elements;
DELIMITER //
CREATE PROCEDURE get_template
(IN v_template_name VARCHAR(80),
@@ -456,5 +460,65 @@ BEGIN
DELETE from model_properties where model_id = v_model_id;
DELETE from model where model_id = v_model_id;
END
+
+CREATE PROCEDURE set_new_tosca_model_version
+ (IN v_tosca_model_id VARCHAR(36),
+ IN v_version DOUBLE,
+ IN v_tosca_model_yaml MEDIUMTEXT,
+ IN v_tosca_model_json MEDIUMTEXT,
+ IN v_user_id VARCHAR(80),
+ OUT v_revision_id VARCHAR(36))
+BEGIN
+ SET v_revision_id = UUID();
+ INSERT INTO tosca_model_revision
+ (tosca_model_revision_id, tosca_model_id, version, tosca_model_yaml, tosca_model_json, user_id)
+ VALUES (v_revision_id, v_tosca_model_id, v_version, v_tosca_model_yaml, v_tosca_model_json, v_user_id);
+END;
+
+CREATE PROCEDURE set_tosca_model
+ (IN v_tosca_model_name VARCHAR(80),
+ IN v_policy_type VARCHAR(80),
+ IN v_user_id VARCHAR(80),
+ IN v_tosca_model_yaml MEDIUMTEXT,
+ IN v_tosca_model_json MEDIUMTEXT,
+ IN v_version DOUBLE,
+ OUT v_tosca_model_id VARCHAR(36),
+ OUT v_revision_id VARCHAR(36))
+BEGIN
+ SET v_tosca_model_id = UUID();
+ INSERT INTO tosca_model
+ (tosca_model_id, tosca_model_name, policy_type, user_id)
+ VALUES (v_tosca_model_id, v_tosca_model_name, v_policy_type, v_user_id);
+ SET v_revision_id = UUID();
+ INSERT INTO tosca_model_revision
+ (tosca_model_revision_id, tosca_model_id, version, tosca_model_yaml, tosca_model_json, user_id)
+ VALUES (v_revision_id, v_tosca_model_id, v_version, v_tosca_model_yaml, v_tosca_model_json, v_user_id);
+END;
+
+CREATE PROCEDURE set_dictionary
+ (IN v_dictionary_name VARCHAR(80),
+ IN v_user_id VARCHAR(80),
+ OUT v_dictionary_id VARCHAR(36))
+BEGIN
+ SET v_dictionary_id = UUID();
+ INSERT INTO dictionary
+ (dictionary_id, dictionary_name, created_by, modified_by)
+ VALUES (v_dictionary_id, v_dictionary_name, v_user_id, v_user_id);
+END;
+
+CREATE PROCEDURE set_dictionary_elements
+ (IN v_dictionary_id VARCHAR(36),
+ IN v_dict_element_name VARCHAR(250),
+ IN v_dict_element_short_name VARCHAR(80),
+ IN v_dict_element_description VARCHAR(250),
+ IN v_dict_element_type VARCHAR(80),
+ IN v_user_id VARCHAR(80),
+ OUT v_dict_element_id VARCHAR(36))
+BEGIN
+ SET v_dict_element_id = UUID();
+ INSERT INTO dictionary_elements
+ (dict_element_id, dictionary_id, dict_element_name, dict_element_short_name, dict_element_description, dict_element_type, created_by, modified_by)
+ VALUES (v_dict_element_id, v_dictionary_id, v_dict_element_name, v_dict_element_short_name, v_dict_element_description, v_dict_element_type, v_user_id, v_user_id);
+END;
//
DELIMITER ;
diff --git a/extra/sql/drop/clds-drop-db-objects.sql b/extra/sql/drop/clds-drop-db-objects.sql
index 478eaf0e0..1c173a414 100644
--- a/extra/sql/drop/clds-drop-db-objects.sql
+++ b/extra/sql/drop/clds-drop-db-objects.sql
@@ -31,3 +31,9 @@ DROP TABLE template_doc;
DROP TABLE template_image;
DROP TABLE template_bpmn;
DROP TABLE template;
+
+DROP TABLE dictionary_elements;
+DROP TABLE dictionary;
+DROP TABLE tosca_model_revision;
+DROP TABLE tosca_model;
+