aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/tools
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/tools')
-rw-r--r--openecomp-be/tools/build/scripts/cassandra-commands.json64
-rw-r--r--openecomp-be/tools/build/scripts/zusammen-cassandra-commands.json17
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/questionnaire/vsp.ftl1
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml241
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml41
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java469
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java102
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java92
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java102
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java79
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java84
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java77
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java91
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java95
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java70
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java98
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java92
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java162
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java83
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java100
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java55
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java31
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java30
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java31
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java31
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java55
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java35
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java63
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java55
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java55
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java61
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java61
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java50
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java61
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java53
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java276
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java136
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java122
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java15
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java49
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java45
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml15
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java67
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/HealAll.java29
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java45
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/SetHealingFlag.java31
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java108
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ImportProperties.java20
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java87
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java73
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java135
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java44
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java54
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java41
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java41
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java64
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java125
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java152
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportDataCommand.java37
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportProperties.java7
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java166
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspGeneralLoader.java40
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspItemLoader.java4
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java10
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/ColumnDefinition.java84
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java12
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/CassandraElementRepository.java23
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java13
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/HealingHandler.java54
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java6
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java21
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntity.java78
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java4
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java23
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java30
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml1
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/resources/queries.yaml16
-rw-r--r--openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java48
-rw-r--r--openecomp-be/tools/zusammen-tools/src/test/resources/configuration.yaml251
-rw-r--r--openecomp-be/tools/zusammen-tools/src/test/resources/queries.yaml16
80 files changed, 1231 insertions, 4374 deletions
diff --git a/openecomp-be/tools/build/scripts/cassandra-commands.json b/openecomp-be/tools/build/scripts/cassandra-commands.json
index 2935acad4a..34916fe74d 100644
--- a/openecomp-be/tools/build/scripts/cassandra-commands.json
+++ b/openecomp-be/tools/build/scripts/cassandra-commands.json
@@ -5,22 +5,7 @@
"version_info": "CREATE TABLE IF NOT EXISTS version_info (entity_type text, entity_id text, active_version frozen<version>, status text, candidate frozen<user_candidate_version>, viewable_versions set<frozen<version>>, latest_final_version frozen<version>, PRIMARY KEY (entity_type, entity_id))",
"version_info_deleted": "CREATE TABLE IF NOT EXISTS version_info_deleted (entity_type text, entity_id text, active_version frozen<version>, status text, candidate frozen<user_candidate_version>, viewable_versions set<frozen<version>>, latest_final_version frozen<version>, PRIMARY KEY (entity_type, entity_id))",
"unique_value" : "CREATE TABLE IF NOT EXISTS unique_value (type text, value text, PRIMARY KEY ((type, value)))",
- "choice_or_other": "CREATE TYPE IF NOT EXISTS choice_or_other (result text)",
- "multi_choice_or_other": "CREATE TYPE IF NOT EXISTS multi_choice_or_other (results set<text>)",
- "vendor_license_model": "CREATE TABLE IF NOT EXISTS vendor_license_model (vlm_id text, version frozen<version>, vendor_name text, description text, icon text, PRIMARY KEY ((vlm_id, version)))",
- "license_agreement": "CREATE TABLE IF NOT EXISTS license_agreement (vlm_id text, version frozen<version>, la_id text, name text, description text, lic_term frozen<choice_or_other>, req_const text, fg_ids set<text>, PRIMARY KEY ((vlm_id, version), la_id))",
- "feature_group": "CREATE TABLE IF NOT EXISTS feature_group (vlm_id text, version frozen<version>, fg_id text, name text, description text, part_num text, ep_ids set<text>, lkg_ids set<text>, ref_la_ids set<text>, PRIMARY KEY ((vlm_id, version), fg_id))",
- "license_key_group": "CREATE TABLE IF NOT EXISTS license_key_group (vlm_id text, version frozen<version>, lkg_id text,name text,description text, type text, operational_scope frozen<multi_choice_or_other>, ref_fg_ids set<text>, version_uuid text, PRIMARY KEY ((vlm_id, version), lkg_id))",
- "entitlement_pool": "CREATE TABLE IF NOT EXISTS entitlement_pool (vlm_id text, version frozen<version>, ep_id text,name text,description text,threshold float,threshold_unit text,entitlement_metric frozen<choice_or_other>,increments text,aggregation_func frozen<choice_or_other>, operational_scope frozen<multi_choice_or_other>, time frozen<choice_or_other>,manufacturer_ref_num text,ref_fg_ids set<text>, version_uuid text, PRIMARY KEY ((vlm_id, version), ep_id))",
- "vsp_information": "CREATE TABLE IF NOT EXISTS vsp_information (VSP_ID text, version frozen<version>, NAME text,DESCRIPTION text,CATEGORY text,SUB_CATEGORY text,ICON text,PACKAGE_NAME text,PACKAGE_VERSION text,vendor_name text, vendor_id text,LICENSE_AGREEMENT text,FEATURE_GROUPS list<text>,VALIDATION_DATA text,CONTENT_DATA blob, questionnaire_data text, vlm_version frozen<version>, is_old_version text, onboarding_method text, PRIMARY KEY ((VSP_ID, version)))",
- "package_details": "CREATE TABLE IF NOT EXISTS package_details (VSP_ID text, version frozen<version>,DISPLAY_NAME text,vsp_name text,vsp_description text,VENDOR_NAME text,CATEGORY text,SUB_CATEGORY text,VENDOR_RELEASE text,PACKAGE_CHECKSUM text,PACKAGE_TYPE text,TRANSLATE_CONTENT blob,PRIMARY KEY ((VSP_ID, version)))",
- "vsp_network": "CREATE TABLE IF NOT EXISTS vsp_network (vsp_id text, version frozen<version>, network_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), network_id))",
- "vsp_component": "CREATE TABLE IF NOT EXISTS vsp_component (vsp_id text, version frozen<version>, component_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), component_id))",
- "vsp_component_nic": "CREATE TABLE IF NOT EXISTS vsp_component_nic (vsp_id text, version frozen<version>, component_id text, nic_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), component_id, nic_id))",
- "vsp_component_image": "CREATE TABLE IF NOT EXISTS vsp_component_image (vsp_id text, version frozen<version>, component_id text, image_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), component_id, image_id))",
- "vsp_process" : "CREATE TABLE IF NOT EXISTS vsp_process (vsp_id text, version frozen<version>, component_id text, process_id text, name text, description text, type text, artifact_name text, artifact blob, PRIMARY KEY ((vsp_id, version), component_id, process_id))",
- "vsp_service_artifact" : "CREATE TABLE IF NOT EXISTS vsp_service_artifact (vsp_id text, version frozen<version>, name text, content_data blob, PRIMARY KEY ((vsp_id, version), name))",
- "vsp_service_template" : "CREATE TABLE IF NOT EXISTS vsp_service_template (vsp_id text, version frozen<version>, base_name text static, name text, content_data blob, PRIMARY KEY ((vsp_id, version), name))",
+ "package_details": "CREATE TABLE IF NOT EXISTS package_details (VSP_ID text, version text,DISPLAY_NAME text,vsp_name text,vsp_description text,VENDOR_NAME text,CATEGORY text,SUB_CATEGORY text,VENDOR_RELEASE text,PACKAGE_CHECKSUM text,PACKAGE_TYPE text,TRANSLATE_CONTENT blob,PRIMARY KEY ((VSP_ID, version)))",
"vsp_enriched_service_template" : "CREATE TABLE IF NOT EXISTS vsp_enriched_service_template (vsp_id text, version frozen<version>, base_name text static, name text, content_data blob, PRIMARY KEY ((vsp_id, version), name))",
"vsp_enriched_service_artifact" : "CREATE TABLE IF NOT EXISTS vsp_enriched_service_artifact (vsp_id text, version frozen<version>, name text, content_data blob, PRIMARY KEY ((vsp_id, version), name))",
"application_config" : "CREATE TABLE IF NOT EXISTS application_config (namespace text, key text, value text, PRIMARY KEY (namespace, key))",
@@ -31,37 +16,22 @@
"vendor_list_index" : "CREATE INDEX IF NOT EXISTS action_vendor_list ON dox.Action (vendor_list)",
"actionUUID_index" : "CREATE INDEX IF NOT EXISTS action_actionUUID ON dox.Action (actionUUID)",
"ecomp_component": "CREATE TABLE IF NOT EXISTS dox.ecompcomponent(id text PRIMARY KEY, name text)",
- "vsp_component_artifact": "CREATE TABLE IF NOT EXISTS vsp_component_artifact (vsp_id text, version frozen<version>, component_id text, artifact_type text, artifact_id text, name text, description text, artifact blob, PRIMARY KEY ((vsp_id, version), component_id, artifact_type, artifact_id))",
"name_index": "CREATE INDEX IF NOT EXISTS action_name ON dox.Action (name)",
"action_artifact":"CREATE TABLE IF NOT EXISTS action_artifact(artifactuuid text, effective_version int, artifact blob, PRIMARY KEY(artifactuuid, effective_version)) WITH CLUSTERING ORDER BY (effective_version DESC)",
- "vsp_orchestration_template_candidate" : "CREATE TABLE IF NOT EXISTS vsp_orchestration_template_candidate (vsp_id text, version frozen<version>, files_data_structure text, content_data blob, PRIMARY KEY ((vsp_id, version)))",
- "vsp_deployment_flavor" : "CREATE TABLE IF NOT EXISTS vsp_deployment_flavor (vsp_id text, version frozen<version>, deployment_flavor_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), deployment_flavor_id))",
- "vsp_component_compute": "CREATE TABLE IF NOT EXISTS vsp_component_compute (vsp_id text, version frozen<version>, component_id text, compute_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), component_id, compute_id))",
- "vsp_component_dependency_model" : "CREATE TABLE IF NOT EXISTS vsp_component_dependency_model (vsp_id text, version frozen<version>, dependency_id text, sourcecomponent_id text, targetcomponent_id text, relation text, PRIMARY KEY ((vsp_id, version), dependency_id))",
"activity_log" : "CREATE TABLE IF NOT EXISTS activity_log (item_id text, version_id text, activity_id text, type text, user text, timestamp timestamp, success boolean, message text, comment text, PRIMARY KEY (item_id, version_id, activity_id))",
- "migration": "CREATE TABLE IF NOT EXISTS migration (id text, ismigrated boolean, primary key(id))"
+ "healing" : "CREATE TABLE IF NOT EXISTS healing (space text,item_id text,version_id text, healing_needed boolean,old_version text, PRIMARY KEY((space,item_id),version_id))",
+ "migration": "CREATE TABLE IF NOT EXISTS migration (id text, ismigrated boolean, primary key (id))",
+ "item_permissions" : "CREATE TABLE IF NOT EXISTS item_permissions (item_id text,user_id text, permission text, PRIMARY KEY(item_id,user_id)) WITH CLUSTERING ORDER BY (user_id DESC)",
+ "notification_subscribers": "CREATE TABLE IF NOT EXISTS NOTIFICATION_SUBSCRIBERS (entity_id text PRIMARY KEY, subscribers set<text>)",
+ "last_notification": "CREATE TABLE IF NOT EXISTS last_notification (owner_id text PRIMARY KEY, event_id timeuuid)",
+ "notifications": "CREATE TABLE IF NOT EXISTS notifications (owner_id text, event_id timeuuid, read boolean, originator_id text, event_type text, event_attributes text, PRIMARY KEY (owner_id, event_id)) WITH CLUSTERING ORDER BY (event_id DESC)",
+ "vsp_merge_hint": "CREATE TABLE IF NOT EXISTS vsp_merge_hint (space text, item_id text, version_id text, model_id text, model_resolution text, PRIMARY KEY ((space, item_id, version_id)))"
},
"drop": {
- "version_info": "DROP TABLE IF EXISTS version_info",
"version_info_deleted": "DROP TABLE IF EXISTS version_info_deleted",
"unique_value": "DROP TABLE IF EXISTS unique_value",
- "entitlement_pool": "DROP TABLE IF EXISTS entitlement_pool",
- "vendor_license_model": "DROP TABLE IF EXISTS vendor_license_model",
- "license_agreement": "DROP TABLE IF EXISTS license_agreement",
- "feature_group": "DROP TABLE IF EXISTS feature_group",
- "license_key_group": "DROP TABLE IF EXISTS license_key_group",
- "vsp_information": "DROP TABLE IF EXISTS vsp_information",
"package_details": "DROP TABLE IF EXISTS package_details",
- "vsp_network": "DROP TABLE IF EXISTS vsp_network",
- "vsp_component_image": "DROP TABLE IF EXISTS vsp_component_image",
- "vsp_component": "DROP TABLE IF EXISTS vsp_component",
- "vsp_component_nic": "DROP TABLE IF EXISTS vsp_component_nic",
- "vsp_process":"DROP TABLE IF EXISTS vsp_process",
- "choice_or_other": "DROP TYPE IF EXISTS choice_or_other",
- "multi_choice_or_other": "DROP TYPE IF EXISTS multi_choice_or_other",
"application_config" : "DROP TABLE IF EXISTS application_config",
- "vsp_service_artifact" :"DROP TABLE IF EXISTS vsp_service_artifact",
- "vsp_service_template" :"DROP TABLE IF EXISTS vsp_service_template",
"vsp_enriched_service_artifact" :"DROP TABLE IF EXISTS vsp_enriched_service_artifact",
"vsp_enriched_service_template" :"DROP TABLE IF EXISTS vsp_enriched_service_template",
"action" : "DROP TABLE IF EXISTS action",
@@ -72,22 +42,16 @@
"actionUUID_index" : "DROP INDEX IF EXISTS dox.action_actionUUID",
"name_index" : "DROP INDEX IF EXISTS dox.action_name",
"ecomp_component": "DROP TABLE IF EXISTS dox.ecompcomponent",
- "vsp_component_artifact": "DROP TABLE IF EXISTS dox.vsp_component_artifact",
"action_artifact":"DROP TABLE IF EXISTS action_artifact",
- "vsp_orchestration_template_candidate":"DROP TABLE IF EXISTS vsp_orchestration_template_candidate",
- "vsp_deployment_flavor":"DROP TABLE IF EXISTS vsp_deployment_flavor",
- "vsp_component_dependency_model":"DROP TABLE IF EXISTS vsp_component_dependency_model",
"activity_log": "DROP TABLE IF EXISTS activity_log",
- "migration": "DROP TABLE IF EXISTS migration"
+ "migration": "DROP TABLE IF EXISTS migration",
+ "item_permissions": "DROP TABLE IF EXISTS item_permissions",
+ "notification_subscribers": "DROP TABLE IF EXISTS notification_subscribers",
+ "last_notification": "DROP TABLE IF EXISTS last_notification",
+ "notifications": "DROP TABLE IF EXISTS notifications",
+ "vsp_merge_hint": "DROP TABLE IF EXISTS vsp_merge_hint"
},
"alter": {
- "vsp_information": "ALTER TABLE vsp_information ADD questionnaire_data text",
- "vsp_information_1": "ALTER TABLE vsp_information ADD vlm_version frozen<version>",
- "vsp_information_2": "ALTER TABLE vsp_information ADD onboarding_method text",
- "vsp_process": "ALTER TABLE vsp_process ADD type text",
- "entitlement_pool": "alter table entitlement_pool ADD version_uuid text",
- "license_key_group": "alter table license_key_group ADD version_uuid text",
- "application_config": "delete from application_config where namespace='vsp.monitoring' and key = 'component.ceilometer'"
},
"actions": {
"truncate_configuration": "truncate configuration"
diff --git a/openecomp-be/tools/build/scripts/zusammen-cassandra-commands.json b/openecomp-be/tools/build/scripts/zusammen-cassandra-commands.json
index 1395fec8f1..5ddb1d7024 100644
--- a/openecomp-be/tools/build/scripts/zusammen-cassandra-commands.json
+++ b/openecomp-be/tools/build/scripts/zusammen-cassandra-commands.json
@@ -1,19 +1,26 @@
{
"create": {
"item": "CREATE TABLE IF NOT EXISTS item (item_id text primary key, item_info text, creation_time timestamp, modification_time timestamp)",
- "version": "CREATE TABLE IF NOT EXISTS version (space text, item_id text, version_id text,base_version_id text,info text,relations text,creation_time timestamp,modification_time timestamp,PRIMARY KEY (( space, item_id ), version_id))",
- "version_elements": "CREATE TABLE IF NOT EXISTS version_elements (space text,item_id text,version_id text,element_ids set<text>,PRIMARY KEY (( space, item_id, version_id )))",
- "element_namespace": "CREATE TABLE IF NOT EXISTS element_namespace (space text, item_id text, element_id text, namespace text, PRIMARY KEY ((space, item_id, element_id)))",
- "element": "CREATE TABLE IF NOT EXISTS element (space text,item_id text,version_id text,element_id text,parent_id text,namespace text,info text,relations text,data blob,searchable_data blob,visualization blob,sub_element_ids set<text>,PRIMARY KEY (( space, item_id, version_id, element_id )))"
+ "version": "CREATE TABLE IF NOT EXISTS version (space text, item_id text, version_id text,base_version_id text,info text,relations text,creation_time timestamp,modification_time timestamp ,PRIMARY KEY (( space, item_id ), version_id))",
+ "version_elements": "CREATE TABLE IF NOT EXISTS version_elements (space text,item_id text,version_id text,revision_id text,element_ids Map<text,text>, dirty_element_ids set<text>,stage_element_ids set<text>, conflict_element_ids set<text>, publish_time timestamp,user text,message text, PRIMARY KEY (( space, item_id, version_id ),revision_id))",
+ "element_namespace": "CREATE TABLE IF NOT EXISTS element_namespace (item_id text, element_id text, namespace text, PRIMARY KEY ((item_id, element_id)))",
+ "element": "CREATE TABLE IF NOT EXISTS element (space text,item_id text,version_id text,element_id text,revision_id text,parent_id text,namespace text,info text,relations text,data blob,searchable_data blob,visualization blob,sub_element_ids set<text> ,element_hash text,PRIMARY KEY (( space, item_id, version_id, element_id ),revision_id))",
+ "element_synchronization_state": "CREATE TABLE IF NOT EXISTS element_synchronization_state (space text, item_id text, version_id text, element_id text,revision_id text, publish_time timestamp, dirty boolean, PRIMARY KEY (( space, item_id, version_id ), element_id,revision_id))",
+ "element_stage": "CREATE TABLE IF NOT EXISTS element_stage (space text, item_id text,version_id text, element_id text, parent_id text, namespace text, info text, relations text,data blob, searchable_data blob, visualization blob, sub_element_ids set<text>,element_hash text, publish_time timestamp, action text, conflicted boolean,conflict_dependent_ids set<text>, PRIMARY KEY (( space, item_id, version_id, element_id )))",
+ "version_stage": "CREATE TABLE IF NOT EXISTS version_stage (space text, item_id text, version_id text, base_version_id text, creation_time timestamp,modification_time timestamp, publish_time timestamp, action text, PRIMARY KEY (( space, item_id ), version_id))"
},
"drop": {
"item": "DROP TABLE IF EXISTS item",
"version": "DROP TABLE IF EXISTS version",
"version_elements": "DROP TABLE IF EXISTS version_elements",
"element_namespace": "DROP TABLE IF EXISTS element_namespace",
- "element": "DROP TABLE IF EXISTS element"
+ "element": "DROP TABLE IF EXISTS element",
+ "element_synchronization_state": "DROP TABLE IF EXISTS element_synchronization_state",
+ "element_stage": "DROP TABLE IF EXISTS element_stage",
+ "version_stage": "DROP TABLE IF EXISTS version_stage"
},
"alter": {
+
},
"actions": {
}
diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/vsp.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/vsp.ftl
index 96f77b7f23..0f9be1c3e3 100644
--- a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/vsp.ftl
+++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/vsp.ftl
@@ -63,6 +63,7 @@
},
"storageReplicationSize": {
"type": "number",
+ "minimum": 0,
"maximum": 100,
"exclusiveMaximum": true
},
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml
deleted file mode 100644
index c2dbc943e5..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml
+++ /dev/null
@@ -1,241 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <properties>
-
- <groovy.version>2.4.7</groovy.version>
- <janino.version>2.7.7</janino.version>
-
- </properties>
-
-
-
- <name>openecomp-zusammen-migration</name>
- <dependencies>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-software-product-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <artifactId>openecomp-zusammen-plugin</artifactId>
- <groupId>org.openecomp.sdc.core</groupId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-software-product-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-license-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-model-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-zusammen-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.amdocs.zusammen.plugin</groupId>
- <artifactId>zusammen-state-store-cassandra-plugin</artifactId>
- <version>${zusammen-state-store.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate.validator.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-license-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <artifactId>openecomp-zusammen-migration</artifactId>
- <groupId>org.openecomp.sdc.core.migration</groupId>
- <version>1.2.0-SNAPSHOT</version>
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
- <relativePath>../../../lib</relativePath>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
- <build>
- <plugins>
-
- <!-- ================================================== -->
- <!-- Set the JDK compiler version. -->
- <!-- ================================================== -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.5.1</version>
- <inherited>true</inherited>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>license-maven-plugin</artifactId>
- <version>1.10</version>
- <configuration>
- <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
- <processStartTag>
- ============LICENSE_START=======================================================
- </processStartTag>
- <processEndTag>
- ============LICENSE_END=========================================================
- </processEndTag>
- <sectionDelimiter>
- ================================================================================
- </sectionDelimiter>
- <licenseName>apache_v2</licenseName>
- <inceptionYear>2017</inceptionYear>
- <organizationName>AT&amp;T Intellectual Property. All rights reserved.
- </organizationName>
- <projectName>SDC</projectName>
- <canUpdateCopyright>true</canUpdateCopyright>
- <canUpdateDescription>true</canUpdateDescription>
- <canUpdateLicense>true</canUpdateLicense>
- <emptyLineAfterHeader>true</emptyLineAfterHeader>
- <verbose>false</verbose>
- <includes>
- <include>**/*.java</include>
- <include>**/*.js</include>
- <include>**/*.ts</include>
- </includes>
- <roots>
- <root>src</root>
- <root>app</root>
- <root>server-mock</root>
- <root>typings</root>
- </roots>
- </configuration>
- <executions>
- <execution>
- <id>first</id>
- <goals>
- <goal>update-file-header</goal>
- </goals>
- <!--phase>process-sources</phase-->
- </execution>
- </executions>
- </plugin>
-
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>install</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <!--includeScope>runtime</includeScope-->
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <phase>package</phase>
- </execution>
- </executions>
- <configuration>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- <classpathLayoutType>custom</classpathLayoutType>
- <customClasspathLayout>
- lib/${artifact.artifactId}-${baseVersion}.${artifact.extension}
- </customClasspathLayout>
- <mainClass>org.openecomp.core.migration.MigrationMain
- </mainClass>
- </manifest>
- <manifestEntries>
- <Class-Path>lib/</Class-Path>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.19.1</version>
- <configuration>
- <useSystemClassLoader>false</useSystemClassLoader>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- </configuration>
- </plugin>
-
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>ant-test</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <fixcrlf srcdir="./" eol="unix"
- includes="cassandra2zusammen.sh"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>${mvn.assembly.version}</version>
- <executions>
- <execution>
- <id>Generate assembly</id>
- <phase>install</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <descriptors>
- <descriptor>${basedir}/src/main/assembly/migration-lib-assembly.xml
- </descriptor>
- </descriptors>
- <finalName>openecomp-zusammen-migration-lib</finalName>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
-
-</project>
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml
deleted file mode 100644
index 42296baa6e..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-
- <formats>
- <format>zip</format>
- </formats>
-
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <!--files>
- <file>
- <source>../cassandra2zusammen.sh</source>
- </file>
- </files-->
-
- <fileSets>
- <fileSet>
- <directory>${basedir}/..</directory>
- <includes>
- <include>cassandra2zusammen.sh</include>
- </includes>
- <outputDirectory>/</outputDirectory>
- <fileMode>0755</fileMode>
- </fileSet>
- <fileSet>
- <directory>${basedir}/target</directory>
- <includes>
- <include>
- openecomp-zusammen*.jar
- </include>
- </includes>
- <outputDirectory>/</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>${basedir}/target/lib</directory>
- <outputDirectory>/lib</outputDirectory>
- </fileSet>
- </fileSets>
-</assembly>
-
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java
deleted file mode 100644
index 1711e41a65..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java
+++ /dev/null
@@ -1,469 +0,0 @@
-package org.openecomp.core.migration;
-
-import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.UserInfo;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.ItemCassandraDao;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.VersionCassandraDao;
-import org.openecomp.core.migration.convertors.ComponentConvertor;
-import org.openecomp.core.migration.convertors.EntitlementPoolConvertor;
-import org.openecomp.core.migration.convertors.FeatureGroupConvertor;
-import org.openecomp.core.migration.convertors.LKGConvertor;
-import org.openecomp.core.migration.convertors.LicenseAgreementConvertor;
-import org.openecomp.core.migration.convertors.MibConvertor;
-import org.openecomp.core.migration.convertors.NetworkConvertor;
-import org.openecomp.core.migration.convertors.NicConvertor;
-import org.openecomp.core.migration.convertors.OrchestrationTemplateCandidateConvertor;
-import org.openecomp.core.migration.convertors.ProcessConvertor;
-import org.openecomp.core.migration.convertors.VlmConvertor;
-import org.openecomp.core.migration.convertors.VspInformationConvertor;
-import org.openecomp.core.migration.convertors.VspServiceArtifactConvertor;
-import org.openecomp.core.migration.convertors.VspServiceTemplateConvertor;
-import org.openecomp.core.migration.loaders.ComponentCassandraLoader;
-import org.openecomp.core.migration.loaders.EntitlementPoolCassandraLoader;
-import org.openecomp.core.migration.loaders.FeatureGroupCassandraLoader;
-import org.openecomp.core.migration.loaders.LKGCassandraLoader;
-import org.openecomp.core.migration.loaders.LicenseAgreementCassandraLoader;
-import org.openecomp.core.migration.loaders.MibCassandraLoader;
-import org.openecomp.core.migration.loaders.NetworkCassandraLoader;
-import org.openecomp.core.migration.loaders.NicCassandraLoader;
-import org.openecomp.core.migration.loaders.OrchestrationTemplateCandidateCassandraLoader;
-import org.openecomp.core.migration.loaders.ProcessCassandraLoader;
-import org.openecomp.core.migration.loaders.ServiceArtifactCassandraLoader;
-import org.openecomp.core.migration.loaders.ServiceTemplateCassandraLoader;
-import org.openecomp.core.migration.loaders.VendorLicenseModelCassandraLoader;
-import org.openecomp.core.migration.loaders.VendorSoftwareProductInfoLoader;
-import org.openecomp.core.migration.loaders.VersionInfoCassandraLoader;
-import org.openecomp.core.migration.loaders.VspInformation;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.core.migration.store.ItemHandler;
-import org.openecomp.core.migration.util.marker.MigrationMarker;
-import org.openecomp.core.model.types.ServiceArtifact;
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
-import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-
-import java.time.Duration;
-import java.time.Instant;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.openecomp.core.migration.util.Utils.printMessage;
-
-public class MigrationMain {
- private static final String GLOBAL_USER = "GLOBAL_USER";
- private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
- private static int status = 0;
-
- private static Map<String, VersionInfoEntity> versionInfoMap = new HashMap<>();
-
- public static void main(String[] args) {
- CassandraElementRepository cassandraElementRepository = new CassandraElementRepository();
- CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
- printMessage(logger, "Checking whether a migration has already been run.");
- if (MigrationMarker.isMigrated()) {
- printMessage(logger, "The DB has already been migrated, this script will now exit.");
- System.exit(status);
- }
- ItemCassandraDao itemCassandraDao = new ItemCassandraDao();
- VersionCassandraDao versionCassandraDao = new VersionCassandraDao();
- SessionContext context = new SessionContext();
- context.setUser(new UserInfo(GLOBAL_USER));
- context.setTenant("dox");
- printMessage(logger, "Starting migration.\n");
- Instant startTime = Instant.now();
-
- migrateToZusammen(cassandraElementRepository, itemCassandraDao, versionCassandraDao, context);
-
- Instant stopTime = Instant.now();
- Duration duration = Duration.between(startTime, stopTime);
- long minutesPart = duration.toMinutes();
- long secondsPart = duration.minusMinutes(minutesPart).getSeconds();
-
- if (status == 0) {
- MigrationMarker.markMigrated();
- }
- printMessage(logger,
- "Migration finished . Total run time was : " + minutesPart + ":" + secondsPart
- + " minutes");
- System.exit(status);
- }
-
-
- private static void migrateToZusammen(CassandraElementRepository cassandraElementRepository,
- ItemCassandraDao itemCassandraDao,
- VersionCassandraDao versionCassandraDao,
- SessionContext context) {
- loadVersionInfo();
-
-
- try {
- convertVsp(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository);
- printMessage(logger, "Converted VSPs\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
-
- try {
- convertOrchestrationTemplateCandidate(context, cassandraElementRepository);
- printMessage(logger, "Converted OrchestrationTemplateCandidates\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
-
-
- try {
- convertComponent(context, cassandraElementRepository);
- printMessage(logger, "Converted Components\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertNic(context, cassandraElementRepository);
- printMessage(logger, "Converted Nics\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertNetwork(context, cassandraElementRepository);
- printMessage(logger, "Converted Networks\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertMibs(context, cassandraElementRepository);
- printMessage(logger, "Converted MIBs\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertServiceArtifact(context, cassandraElementRepository);
- printMessage(logger, "Converted Service Artifacts\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertServiceTemplate(context, cassandraElementRepository);
- printMessage(logger, "Converted Service Templates\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertProcesses(context, cassandraElementRepository);
- printMessage(logger, "Converted Processes\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
-
-
- try {
- convertVlm(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository);
- printMessage(logger, "Converted VLMs\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertLKG(context, cassandraElementRepository);
- printMessage(logger, "Converted LKGs\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertFeatureGroup(context, cassandraElementRepository);
- printMessage(logger, "Converted Feature Groups\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertEP(context, cassandraElementRepository);
- printMessage(logger, "Converted EPs\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- try {
- convertLicenseAgreement(context, cassandraElementRepository);
- printMessage(logger, "Converted License Agreements\n");
- } catch (Exception e) {
- logger.debug(e.getMessage(), e);
- status = -1;
- }
- }
-
- private static void convertOrchestrationTemplateCandidate(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- OrchestrationTemplateCandidateCassandraLoader orchestrationTemplateCandidateCassandraLoader =
- new OrchestrationTemplateCandidateCassandraLoader();
-
- orchestrationTemplateCandidateCassandraLoader.list().stream()
- .filter(entity -> needMigration(entity.getId(), entity.getVersion()) &&
- entity.getContentData()!=null && entity.getFilesDataStructure()!=null)
- .forEach(entity -> ElementHandler
- .save(context, cassandraElementRepository, entity.getId(), entity.getVersion(),
- OrchestrationTemplateCandidateConvertor
- .convertOrchestrationTemplateCandidateToElement(entity)));
- }
-
- private static void loadVersionInfo() {
-
- VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader();
- Collection<VersionInfoEntity> versions =
- versionInfoCassandraLoader.list();
-
- versions.forEach(versionInfoEntity -> versionInfoMap.put(versionInfoEntity.getEntityId
- (), versionInfoEntity));
-
-
- }
-
- private static void convertMibs(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- MibCassandraLoader cassandraLoader = new MibCassandraLoader();
- Collection<ComponentMonitoringUploadEntity> mibs = cassandraLoader.list();
- mibs.stream().filter(mibEntity -> needMigration(mibEntity.getVspId(), mibEntity.getVersion()))
- .forEach
- (mibEntity -> {
- ElementHandler.save(context, cassandraElementRepository,
- mibEntity
- .getVspId(), mibEntity.getVersion(),
- MibConvertor.convertMibToElement
- (mibEntity));
- });
- }
-
- private static void convertProcesses(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- ProcessCassandraLoader cassandraLoader = new ProcessCassandraLoader();
- Collection<ProcessEntity> processes = cassandraLoader.list();
- processes.stream()
- .filter(processEntity -> needMigration(processEntity.getVspId(), processEntity.getVersion
- ())).forEach(processEntity -> {
- ElementHandler.save(
- context,
- cassandraElementRepository,
- processEntity
- .getId(), processEntity.getVersion(),
- ProcessConvertor.convertProcessToElement(processEntity));
- });
- }
-
- private static void convertVsp(SessionContext context, ItemCassandraDao itemCassandraDao,
- VersionCassandraDao versionCassandraDao,
- CassandraElementRepository cassandraElementRepository) {
- VendorSoftwareProductInfoLoader vendorSoftwareProductInfoLoader = new
- VendorSoftwareProductInfoLoader();
- Collection<VspInformation> vsps =
- vendorSoftwareProductInfoLoader.list();
- vsps.stream().filter(vspInformation -> needMigration(vspInformation.getId(),
- vspInformation.getVersion())).forEach
- (vspInformation
- ->
- ItemHandler.save(context,
- itemCassandraDao,
- versionCassandraDao,
- vspInformation.getId(), vspInformation
- .getVersion(),
- VspInformationConvertor
- .getVspInfo
- (vspInformation),
- VspInformationConvertor.getItemVersionData(vspInformation),
- vspInformation.getWritetimeMicroSeconds()));
-
- vsps.stream().filter(vspInformation -> needMigration(vspInformation.getId(),
- vspInformation.getVersion()))
- .forEach(vspInformation -> ElementHandler.save(context, cassandraElementRepository,
- vspInformation.getId(), vspInformation.getVersion(),
- VspInformationConvertor.convertVspToElement
- (vspInformation)));
- }
-
- private static void convertVlm(SessionContext context, ItemCassandraDao itemCassandraDao,
- VersionCassandraDao versionCassandraDao,
- CassandraElementRepository cassandraElementRepository) {
- VendorLicenseModelCassandraLoader
- vendorLicenseModelCassandraDao = new VendorLicenseModelCassandraLoader();
- Collection<VendorLicenseModelEntity> vlms =
- vendorLicenseModelCassandraDao.list();
- vlms.stream().filter(vlm -> needMigration(vlm.getId(), vlm.getVersion())).forEach(vlmEntity ->
- ItemHandler.save
- (context, itemCassandraDao,
- versionCassandraDao,
- vlmEntity.getId(), vlmEntity.getVersion(),
- VlmConvertor.getVlmInfo
- (vlmEntity),
- VlmConvertor.getItemVersionData(vlmEntity), new Date().getTime()));
- vlms.stream().filter(vlm -> needMigration(vlm.getId(), vlm.getVersion()))
- .forEach(vlmEntity -> ElementHandler.save(context, cassandraElementRepository,
- vlmEntity.getId(), vlmEntity.getVersion(),
- VlmConvertor.convertVlmToElement
- (vlmEntity)));
-
- }
-
- private static void convertNic(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- NicCassandraLoader nicCassandraLoader = new NicCassandraLoader();
- Collection<NicEntity> nics = nicCassandraLoader.list();
- nics.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion
- ())).forEach(nicEntity -> ElementHandler.save(context, cassandraElementRepository,
- nicEntity.getVspId(), nicEntity.getVersion(), NicConvertor.convertNicToElement
- (nicEntity)));
-
- }
-
- private static void convertNetwork(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- NetworkCassandraLoader networkCassandraLoader = new NetworkCassandraLoader();
- Collection<NetworkEntity> networks = networkCassandraLoader.list();
- networks.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion
- ())).forEach(networkEntity -> ElementHandler.save(context, cassandraElementRepository,
- networkEntity.getVspId(), networkEntity.getVersion(), NetworkConvertor
- .convertNetworkToElement(networkEntity)));
-
- }
-
- private static void convertComponent(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- ComponentCassandraLoader componentCassandraLoader = new ComponentCassandraLoader();
- Collection<ComponentEntity> components = componentCassandraLoader.list();
- components.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion
- ())).forEach(componentEntity -> ElementHandler.save(context, cassandraElementRepository,
- componentEntity
- .getVspId(), componentEntity.getVersion(), ComponentConvertor
- .convertComponentToElement(componentEntity)));
-
- }
-
- private static void convertServiceArtifact(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- ServiceArtifactCassandraLoader serviceArtifactCassandraLoader =
- new ServiceArtifactCassandraLoader();
- Collection<ServiceArtifact> serviceArtifacts = serviceArtifactCassandraLoader.list();
- serviceArtifacts.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion
- ())).forEach(serviceArtifact -> ElementHandler.save(context,
- cassandraElementRepository,
- serviceArtifact
- .getVspId(), serviceArtifact.getVersion(),
- VspServiceArtifactConvertor
- .convertServiceArtifactToElement(serviceArtifact)));
-
- }
-
- private static void convertServiceTemplate(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- ServiceTemplateCassandraLoader serviceTemplateCassandraLoader =
- new ServiceTemplateCassandraLoader();
- Collection<ServiceTemplate> serviceTemplates = serviceTemplateCassandraLoader.list();
- serviceTemplates.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion
- ())).forEach(serviceTemplate -> ElementHandler.save(context,
- cassandraElementRepository,
- serviceTemplate
- .getVspId(), serviceTemplate.getVersion(),
- VspServiceTemplateConvertor
- .convertServiceTemplateToElement(serviceTemplate)));
-
- }
-
- private static void convertLKG(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- LKGCassandraLoader LKGCassandraLoader = new LKGCassandraLoader();
- Collection<LicenseKeyGroupEntity> lkgs = LKGCassandraLoader.list();
- lkgs.stream().filter(entity -> needMigration(entity.getVendorLicenseModelId(), entity.getVersion
- ()))
- .forEach(licenseKeyGroupEntity -> ElementHandler.save(context, cassandraElementRepository,
- licenseKeyGroupEntity
- .getVendorLicenseModelId(), licenseKeyGroupEntity.getVersion(),
- LKGConvertor.convertLKGToElement
- (licenseKeyGroupEntity)));
- }
-
- private static void convertEP(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- EntitlementPoolCassandraLoader entitlementPoolCassandraLoader =
- new EntitlementPoolCassandraLoader();
- Collection<EntitlementPoolEntity> entitlementPools = entitlementPoolCassandraLoader.list();
- entitlementPools.stream()
- .filter(entity -> needMigration(entity.getVendorLicenseModelId(), entity.getVersion
- ()))
- .forEach(entitlementPoolEntity -> ElementHandler.save(context, cassandraElementRepository,
- entitlementPoolEntity
- .getVendorLicenseModelId(), entitlementPoolEntity.getVersion(),
- EntitlementPoolConvertor.convertEntitlementPoolToElement(entitlementPoolEntity)));
- }
-
- private static void convertFeatureGroup(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- FeatureGroupCassandraLoader featureGroupCassandraLoader = new FeatureGroupCassandraLoader();
- Collection<FeatureGroupEntity> featureGroupEntities = featureGroupCassandraLoader.list();
- featureGroupEntities.stream()
- .filter(entity -> needMigration(entity.getVendorLicenseModelId(), entity.getVersion
- ()))
- .forEach(featureGroupEntity -> ElementHandler.save(context, cassandraElementRepository,
- featureGroupEntity
- .getVendorLicenseModelId(), featureGroupEntity.getVersion(),
- FeatureGroupConvertor.convertFeatureGroupToElement(featureGroupEntity)));
- }
-
- private static void convertLicenseAgreement(SessionContext context,
- CassandraElementRepository cassandraElementRepository) {
- LicenseAgreementCassandraLoader licenseAgreementCassandraLoader =
- new LicenseAgreementCassandraLoader();
- Collection<LicenseAgreementEntity> licenseAgreementEntities =
- licenseAgreementCassandraLoader.list();
- licenseAgreementEntities.stream()
- .filter(entity -> needMigration(entity.getVendorLicenseModelId(), entity.getVersion
- ()))
- .forEach(licenseAgreementEntity -> ElementHandler.save(context, cassandraElementRepository,
- licenseAgreementEntity
- .getVendorLicenseModelId(), licenseAgreementEntity.getVersion(),
- LicenseAgreementConvertor.convertLicenseAgreementToElement(licenseAgreementEntity)));
- }
-
-
- private static boolean needMigration(String itemId, Version versionId) {
-
- VersionInfoEntity versionInfo =
- MigrationMain.versionInfoMap.get(itemId);
- if (versionInfo == null) {
- printMessage(logger, "ItemId: " + itemId + " is not in version_info table.");
- return false;
- }
- return (versionInfo.getCandidate() != null && versionId.equals(versionInfo.getCandidate()
- .getVersion()))
- || (versionInfo
- .getViewableVersions() != null && versionInfo
- .getViewableVersions().contains(versionId));
- }
-
- public static Map<String, VersionInfoEntity> getVersionInfoMap()
- {
- return versionInfoMap;
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java
deleted file mode 100644
index fb597d5a3e..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author katyr
- * @since April 23, 2017
- */
-
-public class ComponentConvertor {
-
- private static Set<String> componentsLoaded = new HashSet<>();
- private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
-
- public static CollaborationElement[] convertComponentToElement(ComponentEntity componentEntity) {
-
- CollaborationElement[] componentElements;
- List<String> componentNamespace = getComponentNamespace();
-
- int index = 0;
- String componentsEntityId = StructureElement.Components.name();
- String uniqueId = componentEntity.getVspId()+"_"+componentEntity.getVersion().toString();
- if (componentsLoaded.contains(uniqueId)) {
-// printMessage(logger, "Components structural elements exist for component " +
-// componentEntity.getId());
- componentElements = new CollaborationElement[2];
- } else {
- componentsLoaded.add(uniqueId);
-// printMessage(logger, "Creating Components structural elements for component " +
-// componentEntity.getId());
- componentElements = new CollaborationElement[3];
- componentElements[index] = ElementHandler.getElementEntity(
- componentEntity.getVspId(), componentEntity.getVersion().toString(), componentsEntityId,
- componentNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Components.name()),
- null,
- null,
- null);
- index++;
- }
-
- componentNamespace.add(componentsEntityId);
- componentElements[index] = ElementHandler.getElementEntity(
- componentEntity.getVspId(), componentEntity.getVersion().toString(),
- componentEntity.getId(),
- componentNamespace,
- getComponentInfo(componentEntity),
- null,
- null,
- (componentEntity.getCompositionData() != null) ? componentEntity.getCompositionData().getBytes()
- : null);
- index++;
-
- componentNamespace.add(componentEntity.getId());
- componentElements[index] = ElementHandler.getElementEntity(
- componentEntity.getVspId(), componentEntity.getVersion().toString(),StructureElement.Questionnaire.name() + "_" + componentEntity.getId(),
- componentNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Questionnaire.name()),
- null,
- null,
- (componentEntity.getQuestionnaireData() != null) ? componentEntity.getQuestionnaireData().getBytes()
- : null);
-
- return componentElements;
- }
-
- private static Info getComponentInfo(ComponentEntity componentEntity) {
- Info info = new Info();
- info.addProperty(ElementPropertyName.type.name(), ElementType.Component);
- info.addProperty(ElementPropertyName.compositionData.name(),
- componentEntity.getCompositionData());
-
- return info;
- }
-
- private static List<String> getComponentNamespace() {
- return ElementHandler.getElementPath();
- }
-
- public static ElementEntityContext convertComponentToElementContext(
- ComponentEntity componentEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(componentEntity.getVspId(), componentEntity.getVersion().toString()));
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java
deleted file mode 100644
index 86faf15837..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * Created by ayalaben on 4/24/2017
- */
-public class EntitlementPoolConvertor {
-
- private static Set<String> EntitlementPoolsLoaded = new HashSet<>();
-
- public static ElementEntityContext convertEntitlementPoolToElementContext(
- EntitlementPoolEntity entitlementPoolEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(entitlementPoolEntity.getVendorLicenseModelId(),
- entitlementPoolEntity.getVersion().toString()));
- }
-
- public static CollaborationElement[] convertEntitlementPoolToElement(
- EntitlementPoolEntity entitlementPoolEntity) {
-// printMessage(logger, "source EntitlementPoolEntity -> " + entitlementPoolEntity.toString());
- CollaborationElement[] elements;
- List<String> entitlementPoolNamespace = getEntitlementPoolNamespace(entitlementPoolEntity);
-
- int index = 0;
- String entitlememtPoolsEntityId = StructureElement.EntitlementPools.name();
- String uniqueId = entitlementPoolEntity.getVendorLicenseModelId() + "_" +
- entitlementPoolEntity.getVersion().toString();
-
- if (EntitlementPoolsLoaded.contains(uniqueId)) {
- elements = new CollaborationElement[1];
- } else {
- EntitlementPoolsLoaded.add(uniqueId);
- elements = new CollaborationElement[2];
- elements[index] = ElementHandler.getElementEntity(
- entitlementPoolEntity.getVendorLicenseModelId(),
- entitlementPoolEntity.getVersion().toString(),
- entitlememtPoolsEntityId, entitlementPoolNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.EntitlementPools.name()),
- null, null, null);
- index++;
- }
-
- entitlementPoolNamespace.add(entitlememtPoolsEntityId);
-
- elements[index] = ElementHandler.getElementEntity(
- entitlementPoolEntity.getVendorLicenseModelId(),
- entitlementPoolEntity.getVersion().toString(),
- entitlementPoolEntity.getId(), entitlementPoolNamespace,
- getEntitelementPoolInfo(entitlementPoolEntity),
- entitlementPoolEntity.getReferencingFeatureGroups().stream().map(rel ->
- VlmZusammenUtil
- .createRelation( RelationType.EntitlmentPoolToReferencingFeatureGroup, rel))
- .collect(Collectors.toList()), null, null);
-
- return elements;
- }
-
- private static Info getEntitelementPoolInfo(EntitlementPoolEntity entitlementPool) {
-
- Info info = new Info();
- info.setName(entitlementPool.getName());
- info.setDescription(entitlementPool.getDescription());
- info.addProperty("thresholdValue", entitlementPool.getThresholdValue());
- info.addProperty("threshold_unit", entitlementPool.getThresholdUnit());
- //info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric());
- info.addProperty("increments", entitlementPool.getIncrements());
- info.addProperty("operational_scope", entitlementPool.getOperationalScope());
-
- return info;
- }
-
- private static List<String> getEntitlementPoolNamespace(
- EntitlementPoolEntity entitlementPoolEntity) {
- return ElementHandler.getElementPath("");
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java
deleted file mode 100644
index eac5ce64ea..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.datatypes.item.Relation;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil;
-import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * Created by ayalaben on 4/25/2017
- */
-public class FeatureGroupConvertor {
-
- private static Logger logger = LoggerFactory.getLogger(FeatureGroupConvertor.class);
- private static Set<String> FeatureGroupsLoaded = new HashSet<>();
-
- public static ElementEntityContext convertFeatureGroupToElementContext(FeatureGroupEntity featureGroupEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(featureGroupEntity.getVendorLicenseModelId(), featureGroupEntity.getVersion().toString()));
- }
-
- public static CollaborationElement[] convertFeatureGroupToElement(FeatureGroupEntity featureGroupEntity) {
-// printMessage(logger, "source FeatureGroupEntity -> " + featureGroupEntity.toString());
- CollaborationElement[] elements;
- List<String> featureGroupNamespace = getFeatureGroupNamespace(featureGroupEntity);
-
- int index = 0;
- String featureGroupsEntityId = StructureElement.FeatureGroups.name();
- String uniqueId = featureGroupEntity.getVendorLicenseModelId() + "_" + featureGroupEntity.getVersion().toString();
-
- if (FeatureGroupsLoaded.contains(uniqueId)) {
- elements = new CollaborationElement[1];
- } else {
- FeatureGroupsLoaded.add(uniqueId);
- elements = new CollaborationElement[2];
- elements[index] = ElementHandler.getElementEntity(
- featureGroupEntity.getVendorLicenseModelId(), featureGroupEntity.getVersion().toString(),
- featureGroupsEntityId, featureGroupNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.FeatureGroups.name()),
- null, null, null);
- index++;
- }
-
- featureGroupNamespace.add(featureGroupsEntityId);
-
- elements[index] = ElementHandler.getElementEntity(
- featureGroupEntity.getVendorLicenseModelId(), featureGroupEntity.getVersion().toString(),
- featureGroupEntity.getId(), featureGroupNamespace, getFeatureGroupInfo(featureGroupEntity),
- getAllFeatureGroupRelations(featureGroupEntity), null, null);
-
- return elements;
- }
-
- private static Collection<Relation> getAllFeatureGroupRelations(FeatureGroupEntity featureGroup) {
- Collection<Relation> relations = new ArrayList<>();
-
- relations.addAll(featureGroup.getEntitlementPoolIds().stream().map(rel ->
- VlmZusammenUtil.createRelation( RelationType.FeatureGroupToEntitlmentPool, rel))
- .collect(Collectors.toList()));
-
- relations.addAll(featureGroup.getLicenseKeyGroupIds().stream().map(rel ->
- VlmZusammenUtil.createRelation( RelationType.FeatureGroupToLicenseKeyGroup, rel))
- .collect(Collectors.toList()));
-
- relations.addAll(featureGroup.getReferencingLicenseAgreements().stream().map(rel ->
- VlmZusammenUtil.createRelation( RelationType.FeatureGroupToReferencingLicenseAgreement,
- rel)).collect(Collectors.toList()));
-
- return relations;
- }
-
- private static Info getFeatureGroupInfo(FeatureGroupEntity featureGroup) {
-
- Info info = new Info();
- info.setName(featureGroup.getName());
- info.setDescription(featureGroup.getDescription());
- info.addProperty("partNumber", featureGroup.getPartNumber());
- info.addProperty("manufacturerReferenceNumber", featureGroup.getManufacturerReferenceNumber());
-
- return info;
- }
-
-
- private static List<String> getFeatureGroupNamespace(FeatureGroupEntity featureGroupEntity) {
- return ElementHandler.getElementPath("");
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java
deleted file mode 100644
index 7fd640b12d..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * Created by ayalaben on 4/24/2017
- */
-public class LKGConvertor {
-
- private static Logger logger = LoggerFactory.getLogger(LKGConvertor.class);
- private static Set<String> compLKGLoaded = new HashSet<>();
-
- public static CollaborationElement[] convertLKGToElement(LicenseKeyGroupEntity licenseKeyGroupEntity) {
- CollaborationElement[] elements;
- List<String> lkgNamespace = getLKGNamespace(licenseKeyGroupEntity);
-
- int index = 0;
- String lkgsEntityId = StructureElement.LicenseKeyGroups.name();
- String uniqueId = licenseKeyGroupEntity.getVendorLicenseModelId() + "_" + licenseKeyGroupEntity.getVersion().toString();
-
- if (compLKGLoaded.contains(uniqueId)) {
- elements = new CollaborationElement[1];
- } else {
- compLKGLoaded.add(uniqueId);
- elements = new CollaborationElement[2];
- elements[index] = ElementHandler.getElementEntity(
- licenseKeyGroupEntity.getVendorLicenseModelId(), licenseKeyGroupEntity.getVersion().toString(), lkgsEntityId, lkgNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.LicenseKeyGroups.name()), null, null, null);
- index++;
- }
-
- lkgNamespace.add(lkgsEntityId);
-
- elements[index] = ElementHandler.getElementEntity(
- licenseKeyGroupEntity.getVendorLicenseModelId(), licenseKeyGroupEntity.getVersion().toString(), licenseKeyGroupEntity.getId(), lkgNamespace,
- getLKGInfo(licenseKeyGroupEntity), licenseKeyGroupEntity.getReferencingFeatureGroups().stream().map(rel ->
- VlmZusammenUtil.createRelation( RelationType.LicenseKeyGroupToReferencingFeatureGroup, rel))
- .collect(Collectors.toList()), null, null);
-
- return elements;
- }
-
- private static Info getLKGInfo(LicenseKeyGroupEntity licenseKeyGroupEntity) {
-
- Info info = new Info();
- info.setName(licenseKeyGroupEntity.getName());
- info.setDescription(licenseKeyGroupEntity.getDescription());
- info.addProperty("LicenseKeyType", licenseKeyGroupEntity.getType());
- info.addProperty("operational_scope", licenseKeyGroupEntity.getOperationalScope());
-
- return info;
- }
-
- private static List<String> getLKGNamespace(LicenseKeyGroupEntity LKGEntity) {
- return ElementHandler.getElementPath("");
- }
-
- public static ElementEntityContext convertLKGToElementContext(LicenseKeyGroupEntity licenseKeyGroupEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(licenseKeyGroupEntity.getVendorLicenseModelId(), licenseKeyGroupEntity.getVersion().toString()));
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java
deleted file mode 100644
index 25564c3138..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * Created by ayalaben on 4/25/2017
- */
-public class LicenseAgreementConvertor {
-
- private static Logger logger = LoggerFactory.getLogger(LicenseAgreementConvertor.class);
- private static Set<String> LicenseAgreementsLoaded = new HashSet<>();
-
- public static ElementEntityContext convertLicenseAgreementToElementContext(LicenseAgreementEntity licenseAgreementEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(licenseAgreementEntity.getVendorLicenseModelId(), licenseAgreementEntity.getVersion().toString()));
- }
-
-
- public static CollaborationElement[] convertLicenseAgreementToElement(LicenseAgreementEntity licenseAgreementEntity) {
-// printMessage(logger, "source LicenseAgreementEntity -> " + licenseAgreementEntity.toString());
- CollaborationElement[] elements;
- List<String> featureGroupNamespace = getLicenseAgreementNamespace(licenseAgreementEntity);
-
- int index = 0;
- String featureGroupsEntityId = StructureElement.LicenseAgreements.name();
- String uniqueId = licenseAgreementEntity.getVendorLicenseModelId() + "_" + licenseAgreementEntity.getVersion().toString();
-
- if (LicenseAgreementsLoaded.contains(uniqueId)) {
- elements = new CollaborationElement[1];
- } else {
- LicenseAgreementsLoaded.add(uniqueId);
- elements = new CollaborationElement[2];
- elements[index] = ElementHandler.getElementEntity(
- licenseAgreementEntity.getVendorLicenseModelId(), licenseAgreementEntity.getVersion().toString(),
- featureGroupsEntityId, featureGroupNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.LicenseAgreements.name()),
- null, null, null);
- index++;
- }
-
- featureGroupNamespace.add(featureGroupsEntityId);
-
- elements[index] = ElementHandler.getElementEntity(
- licenseAgreementEntity.getVendorLicenseModelId(), licenseAgreementEntity.getVersion().toString(),
- licenseAgreementEntity.getId(), featureGroupNamespace, getLicenseAgreementInfo(licenseAgreementEntity),
- licenseAgreementEntity.getFeatureGroupIds().stream().map(rel ->
- VlmZusammenUtil.createRelation( RelationType.LicenseAgreementToFeatureGroup, rel))
- .collect(Collectors.toList()), null, null);
-
- return elements;
- }
-
- private static Info getLicenseAgreementInfo(LicenseAgreementEntity licenseAgreement) {
-
- Info info = new Info();
- info.setName(licenseAgreement.getName());
- info.setDescription(licenseAgreement.getDescription());
- info.addProperty("licenseTerm", licenseAgreement.getLicenseTerm());
- info.addProperty("requirementsAndConstrains", licenseAgreement.getRequirementsAndConstrains());
-
- return info;
- }
-
- private static List<String> getLicenseAgreementNamespace(LicenseAgreementEntity licenseAgreement) {
- return ElementHandler.getElementPath("");
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java
deleted file mode 100644
index f145e51f02..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class MibConvertor {
- private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
-
- private static Set<String> compMibLoaded = new HashSet<>();
-
-
- public static CollaborationElement[] convertMibToElement(
- ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
- CollaborationElement[] elements;
- List<String> mibNamespace = getMibNamespace(componentMonitoringUploadEntity);
-
- int index = 0;
- String mibsEntityId =
- StructureElement.Mibs.name() + "_" + componentMonitoringUploadEntity.getComponentId();
- if (compMibLoaded.contains(mibsEntityId)) {
- elements = new CollaborationElement[1];
- } else {
- compMibLoaded.add(mibsEntityId);
- elements = new CollaborationElement[2];
- elements[index++] = ElementHandler.getElementEntity(
- componentMonitoringUploadEntity.getVspId(),
- componentMonitoringUploadEntity.getVersion().toString(), mibsEntityId, mibNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Mibs.name()), null, null, null);
- }
-
- mibNamespace.add(mibsEntityId);
- elements[index] = ElementHandler.getElementEntity(
- componentMonitoringUploadEntity.getVspId(),
- componentMonitoringUploadEntity.getVersion().toString(), componentMonitoringUploadEntity
- .getId(), mibNamespace,
- getMibInfo(componentMonitoringUploadEntity), null, null, componentMonitoringUploadEntity
- .getArtifact().array());
-
- return elements;
- }
-
- private static Info getMibInfo(
- ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
- Info info = new Info();
- info.setName(componentMonitoringUploadEntity.getType().toString());
- info.getProperties().put("name", componentMonitoringUploadEntity.getArtifactName());
- return info;
- }
-
- private static List<String> getMibNamespace(
- ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
- return ElementHandler
- .getElementPath(StructureElement.Components.name(), componentMonitoringUploadEntity
- .getComponentId());
- }
-
- public static ElementEntityContext convertMibToElementContext(
- ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(componentMonitoringUploadEntity.getVspId(),
- componentMonitoringUploadEntity
- .getVersion().toString()));
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java
deleted file mode 100644
index 3d4f1575fc..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author katyr
- * @since April 23, 2017
- */
-
-public class NetworkConvertor {
-
- private static Set<String> networksLoaded = new HashSet<>();
- private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
-
-
-
- public static CollaborationElement[] convertNetworkToElement(NetworkEntity networkEntity) {
-
- CollaborationElement[] networkElements;
- List<String> networkNamespace = getNetworkNamespace();
-
- int index = 0;
- String networksEntityId = StructureElement.Networks.name();
- String uniqueId = networkEntity.getVspId()+"_"+networkEntity.getVersion().toString();
- if (networksLoaded.contains(uniqueId)) {
-// printMessage(logger, "Networks structural elements exist for network " +
-// networkEntity.getId());
- networkElements = new CollaborationElement[1];
- } else {
-// printMessage(logger, "Creating Networks structural element for network " +
-// networkEntity.getId());
- networksLoaded.add(uniqueId);
- networkElements = new CollaborationElement[2];
- networkElements[index] = ElementHandler.getElementEntity(
- networkEntity.getVspId(), networkEntity.getVersion().toString(), networksEntityId,
- networkNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Networks.name()),
- null,
- null,
- null);
- index++;
- }
-
- networkNamespace.add(networksEntityId);
-
- networkElements[index] = ElementHandler.getElementEntity(
- networkEntity.getVspId(), networkEntity.getVersion().toString(), networkEntity.getId(),
- networkNamespace,
- getNetworkInfo(networkEntity),
- null,
- null,
- networkEntity.getCompositionData().getBytes());
-
-
- return networkElements;
- }
-
- private static Info getNetworkInfo(NetworkEntity networkEntity) {
- Info info = new Info();
- info.addProperty(ElementPropertyName.type.name(), ElementType.Network);
- info.addProperty(ElementPropertyName.compositionData.name(), networkEntity.getCompositionData());
-
- return info;
- }
-
- private static List<String> getNetworkNamespace() {
- return ElementHandler.getElementPath();
- }
-
- public static ElementEntityContext convertNetworkToElementContext(NetworkEntity networkEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(networkEntity.getVspId(), networkEntity.getVersion().toString()));
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java
deleted file mode 100644
index b17e68c0e5..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class NicConvertor {
-
-
- private static Set<String> compNicLoaded = new HashSet<>();
- private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
-
-
-
- public static CollaborationElement[] convertNicToElement(NicEntity nicEntity) {
-
- CollaborationElement[] nicElements;
- List<String> nicNamespace = getNicNamespace(nicEntity);
-
- int index = 0;
- String nicsEntityId = StructureElement.Nics.name() + "_" + nicEntity.getComponentId();
- if (compNicLoaded.contains(nicsEntityId)) {
-// printMessage(logger, "Nics structural element exists for nic " +
-// nicEntity.getId());
- nicElements = new CollaborationElement[2];
- } else {
-// printMessage(logger, "Creating Nics structural element for nic " +
-// nicEntity.getId());
- compNicLoaded.add(nicsEntityId);
- nicElements = new CollaborationElement[3];
- nicElements[index] = ElementHandler.getElementEntity(
- nicEntity.getVspId(), nicEntity.getVersion().toString(), nicsEntityId,
- nicNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Nics.name()),
- null,
- null,
- null);
- index++;
- }
-
- nicNamespace.add(nicsEntityId);
- nicElements[index] = ElementHandler.getElementEntity(
- nicEntity.getVspId(), nicEntity.getVersion().toString(), nicEntity.getId(),
- nicNamespace,
- getNicInfo(nicEntity),
- null,
- null,
- nicEntity.getCompositionData().getBytes());
- index++;
-
- nicNamespace.add(nicEntity.getId());
- nicElements[index] = ElementHandler.getElementEntity(
- nicEntity.getVspId(), nicEntity.getVersion().toString(),StructureElement.Questionnaire.name() + "_" + nicEntity.getId(),
- nicNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Questionnaire.name()),
- null,
- null,
- (nicEntity.getQuestionnaireData() != null) ? nicEntity.getQuestionnaireData().getBytes()
- : null);
- return nicElements;
- }
-
- private static Info getNicInfo(NicEntity nicEntity) {
- Info info = new Info();
- info.addProperty(ElementPropertyName.type.name(), ElementType.Nic);
- info.addProperty(ElementPropertyName.compositionData.name(), nicEntity.getCompositionData());
- return info;
- }
-
- private static List<String> getNicNamespace(NicEntity nicEntity) {
- return ElementHandler.getElementPath(StructureElement.Components.name(), nicEntity
- .getComponentId());
- }
-
- public static ElementEntityContext convertNicToElementContext(NicEntity nicEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(nicEntity.getVspId(), nicEntity.getVersion().toString()));
- }
-
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java
deleted file mode 100644
index e6ceb360bd..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity;
-
-import java.util.List;
-
-public class OrchestrationTemplateCandidateConvertor {
-
-
-
-
- private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
-
- public static CollaborationElement[] convertOrchestrationTemplateCandidateToElement(
- OrchestrationTemplateCandidateDataEntity entity) {
-
-
- CollaborationElement[] orchestrationTemplateCandidateElements = new CollaborationElement[2];
- List<String> orchestrationTemplateCandidateNamespace =
- getOrchestrationTemplateCandidateNamespace();
-
-
-
- orchestrationTemplateCandidateElements[0] = ElementHandler.getElementEntity(
- entity.getId(), entity.getVersion().toString(), StructureElement.OrchestrationTemplateCandidate.name(),
- orchestrationTemplateCandidateNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.OrchestrationTemplateCandidate.name()),
- null,
- null,
- entity.getFilesDataStructure().getBytes());
-
- orchestrationTemplateCandidateNamespace.add(StructureElement.OrchestrationTemplateCandidate.name());
- orchestrationTemplateCandidateElements[1] = ElementHandler.getElementEntity(
- entity.getId(), entity.getVersion().toString(), StructureElement.OrchestrationTemplateCandidateContent.name(),
- orchestrationTemplateCandidateNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.OrchestrationTemplateCandidateContent.name()),
- null,
- null,
- entity.getContentData().array());
-
-
-
- return orchestrationTemplateCandidateElements;
- }
-
-
- private static List<String> getOrchestrationTemplateCandidateNamespace() {
- return ElementHandler.getElementPath();
- }
-
- public static ElementEntityContext convertComponentToElementContext(
- ComponentEntity componentEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(componentEntity.getVspId(), componentEntity.getVersion().toString()));
- }
-
-
-
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java
deleted file mode 100644
index 0a145c49f7..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class ProcessConvertor {
- private static final String NAME = "name";
- private static final String ELEMENT_TYPE = "type";
- private static final String ARTIFACT_NAME = "artifactName";
- private static final String DESCRIPTION = "description";
- private static final String PROCESS_TYPE = "processType";
- private static Set<String> compProcessesLoaded = new HashSet<>();
-
- private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
-
-
- public static CollaborationElement[] convertProcessToElement(ProcessEntity processEntity) {
- CollaborationElement[] elements;
- boolean isGeneralComponentId = isGeneralComponentId(processEntity);
- List<String> processNamespace = getProcessNamespace(processEntity);
- int index = 0;
- String uniqueId = getUniqueId(processEntity, isGeneralComponentId);
- String processesEntityId = isGeneralComponentId ? StructureElement.Processes.name() :
- (StructureElement.Processes.name() + "_" +processEntity.getComponentId());
- if (compProcessesLoaded.contains(uniqueId)) {
- elements = new CollaborationElement[1];
- } else {
- compProcessesLoaded.add(uniqueId);
- elements = new CollaborationElement[2];
- elements[index++] = ElementHandler.getElementEntity(
- processEntity.getVspId(), processEntity.getVersion().toString(), processesEntityId,
- processNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Processes.name()), null, null, null);
- }
-
- processNamespace.add(processesEntityId);
- elements[index] = ElementHandler.getElementEntity(
- processEntity.getVspId(), processEntity.getVersion().toString(), processEntity.getId(),
- processNamespace,
- getProcessInfo(processEntity), null, null, processEntity.getArtifact() ==
- null ? null : processEntity.getArtifact().array());
-
- return elements;
- }
-
- private static String getUniqueId(ProcessEntity processEntity, boolean isGeneralComponentId) {
- if (isGeneralComponentId) {
- return processEntity.getVspId() + "_" + processEntity.getVersion().toString();
- } else {
- return StructureElement.Processes.name() + "_" + processEntity
- .getComponentId();
- }
- }
-
- private static Info getProcessInfo(ProcessEntity processEntity) {
- Info info = new Info();
- info.setName(processEntity.getName());
- info.addProperty(NAME, processEntity.getName());
- info.addProperty(ELEMENT_TYPE, ElementType.Process);
- info.addProperty(ARTIFACT_NAME, processEntity.getArtifactName());
- info.addProperty(DESCRIPTION, processEntity.getDescription());
- info.addProperty(PROCESS_TYPE,
- processEntity.getType() != null ? processEntity.getType().name() : null);
- return info;
- }
-
- private static List<String> getProcessNamespace(ProcessEntity processEntity) {
- if (isGeneralComponentId(processEntity)) {
- return ElementHandler.getElementPath();
- } else {
- return ElementHandler
- .getElementPath(StructureElement.Components.name(), processEntity.getComponentId());
- }
- }
-
- private static boolean isGeneralComponentId(ProcessEntity processEntity) {
- return processEntity.getComponentId().equals("General");
- }
-
- public static ElementEntityContext convertProcessToElementContext(ProcessEntity processEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(processEntity.getVspId(), processEntity.getVersion().toString()));
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java
deleted file mode 100644
index 2e483747ed..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.datatypes.item.ItemVersionData;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class VlmConvertor {
-
- private static Set<String> compNicLoaded = new HashSet<>();
-
- public static CollaborationElement[] convertVlmToElement(VendorLicenseModelEntity vendorLicenseModel) {
-
- CollaborationElement[] vspElements = new CollaborationElement[1];
- List<String> vspNamespace = getVlmNamespace(vendorLicenseModel);
-
-
- String vspEntityId = StructureElement.General.name();
-
- vspElements[0] = ElementHandler.getElementEntity(
- vendorLicenseModel.getId(), vendorLicenseModel.getVersion().toString(),
- vspEntityId,
- vspNamespace,
- getVlmGeneralInfo(vendorLicenseModel),
- null,
- null,
- null);
- return vspElements;
- }
-
-
- public static ItemVersionData getItemVersionData(
- VendorLicenseModelEntity vendorLicenseModel) {
- ItemVersionData itemVersionData = new ItemVersionData();
- Info info = new Info();
- info.setName("main version");
- itemVersionData.setInfo(info);
- return itemVersionData;
- }
-
- public static Info getVlmInfo(VendorLicenseModelEntity vendorLicenseModel) {
-
- Info info = new Info();
- info.setName(vendorLicenseModel.getVendorName());
- info.setDescription(vendorLicenseModel.getDescription());
- info.addProperty("type", "vlm");
- info.addProperty("version", vendorLicenseModel.getVersion());
- info.addProperty("iconRef", vendorLicenseModel.getIconRef());
- return info;
- }
-
- private static List<String> getVlmNamespace(VendorLicenseModelEntity vlmEntity) {
- return ElementHandler.getElementPath("");
- }
-
- private static Info getVlmGeneralInfo(VendorLicenseModelEntity vendorLicenseModel) {
-
-
- Info info = new Info();
- info.setName(StructureElement.General.name());
- info.addProperty(InfoPropertyName.type.name(), InfoPropertyName.vlm.name());
- info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef());
- info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName());
- info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription());
- return info;
- }
-
- public static ElementEntityContext convertVlmToElementContext(VendorLicenseModelEntity
- vendorLicenseModel) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().toString()));
- }
-
-
- private enum InfoPropertyName {
- name,
- description,
- iconRef,
- type,
- vlm
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java
deleted file mode 100644
index 59fba5f066..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.datatypes.item.ItemVersionData;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.loaders.VspInformation;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-
-import java.util.List;
-
-public class VspInformationConvertor {
-
- public static ItemVersionData getItemVersionData(
- VspInformation vspInformation) {
- Info info = new Info();
- info.setName("main version");
- ItemVersionData itemVersionData = new ItemVersionData();
- itemVersionData.setInfo(info);
- return itemVersionData;
- }
-
- public static Info getVspInfo(VspInformation vspInformation) {
-
- Info info = new Info();
- info.setName(vspInformation.getName());
- info.setDescription(vspInformation.getDescription());
- info.addProperty("type", "vsp");
- addVspDetailsToInfo(info, vspInformation);
- return info;
- }
-
- private static List<String> getVspNamespace(VendorLicenseModelEntity vlmEntity) {
- return ElementHandler.getElementPath("");
- }
-
- private static void addVspDetailsToInfo(Info info, VspInformation vspInformation) {
- info.addProperty("name", vspInformation.getName());
- info.addProperty("description", vspInformation.getDescription());
- info.addProperty("category", vspInformation.getCategory());
- info.addProperty("subCategory", vspInformation.getSubCategory());
- info.addProperty("vendorId", vspInformation.getVendorId());
- info.addProperty("vendorName", vspInformation.getVendorName());
- if (vspInformation.getVlmVersion() != null) {
- info.addProperty("vendorVersion", vspInformation.getVlmVersion().toString());
- }
- info.addProperty("featureGroups", vspInformation.getFeatureGroups());
- info.addProperty("licenseAgreement", vspInformation.getLicenseAgreement());
- String oldVersion = vspInformation.getIsOldVersion() == null? "1702":"1610";
- info.addProperty("oldVersion", oldVersion);
- }
-
- public static CollaborationElement[] convertVspToElement(VspInformation vspInformation) {
-
- CollaborationElement[] vspElements;
- if(vspInformation.getQuestionnaireData() == null){
- vspElements = new CollaborationElement[4];
- }else{
- vspElements = new CollaborationElement[5];
- }
-
- int index=0;
-
- List<String> vspNamespace = getVspNamespace(vspInformation);
-
-
- String vspEntityId = StructureElement.General.name();
-
- vspElements[index] = ElementHandler.getElementEntity(
- vspInformation.getId(), vspInformation.getVersion().toString(),
- vspEntityId,
- vspNamespace,
- getVspGeneralInfo(vspInformation),
- null,
- null,
- null);
-
- index++;
- String vspOrchestrationTemplateEntityId = StructureElement.OrchestrationTemplate.name();
- vspElements[index] = ElementHandler.getElementEntity(
- vspInformation.getId(), vspInformation.getVersion().toString(),
- vspOrchestrationTemplateEntityId,
- vspNamespace,
- ElementHandler.getStructuralElementInfo(vspOrchestrationTemplateEntityId),
- null,
- null,
- null);
-
- if(vspInformation.getQuestionnaireData()!= null) {
- index++;
- String vspQuestionnaireEntityId = StructureElement.Questionnaire.name();
- vspElements[index] = ElementHandler.getElementEntity(
- vspInformation.getId(), vspInformation.getVersion().toString(),
- vspQuestionnaireEntityId,
- vspNamespace,
- ElementHandler.getStructuralElementInfo(vspQuestionnaireEntityId),
- null,
- null,
- vspInformation.getQuestionnaireData().getBytes() != null ? vspInformation
- .getQuestionnaireData().getBytes() : null);
- }
- vspNamespace.add(vspOrchestrationTemplateEntityId);
- index++;
- String vspOrchestrationTemplateValidationDataEntityId = StructureElement.OrchestrationTemplateValidationData.name();
- vspElements[index] = ElementHandler.getElementEntity(
- vspInformation.getId(), vspInformation.getVersion().toString(),
- vspOrchestrationTemplateValidationDataEntityId,
- vspNamespace,
- ElementHandler.getStructuralElementInfo(vspOrchestrationTemplateValidationDataEntityId),
- null,
- null,
- vspInformation.getValidationData()!= null?vspInformation.getValidationData().getBytes()
- :null);
- index++;
- String vspOrchestrationTemplateContentEntityId = StructureElement.OrchestrationTemplateContent.name();
- vspElements[index] = ElementHandler.getElementEntity(
- vspInformation.getId(), vspInformation.getVersion().toString(),
- vspOrchestrationTemplateContentEntityId,
- vspNamespace,
- ElementHandler.getStructuralElementInfo(vspOrchestrationTemplateContentEntityId),
- null,
- null,
- vspInformation.getContentData()!= null?vspInformation.getContentData().array()
- :null);
-
- return vspElements;
- }
-
- private static Info getVspGeneralInfo(VspInformation vspInformation) {
-
-
- Info info = new Info();
- info.setName(StructureElement.General.name());
- info.addProperty("name", vspInformation.getName());
- info.addProperty("description", vspInformation.getDescription());
- info.addProperty("category", vspInformation.getCategory());
- info.addProperty("subCategory", vspInformation.getSubCategory());
- info.addProperty("vendorId", vspInformation.getVendorId());
- info.addProperty("vendorName", vspInformation.getVendorName());
- if (vspInformation.getVlmVersion() != null) {
- info.addProperty("vendorVersion", vspInformation.getVlmVersion().toString());
- }
- info.addProperty("featureGroups", vspInformation.getFeatureGroups());
- info.addProperty("licenseAgreement", vspInformation.getLicenseAgreement());
- String oldVersion = vspInformation.getIsOldVersion() == null? "1702":"1610";
- info.addProperty("oldVersion", oldVersion);
- return info;
- }
-
- private static List<String> getVspNamespace(VspInformation vspEntity) {
- return ElementHandler.getElementPath("");
- }
-
- public static ElementEntityContext convertVspToElementContext(VspInformation vspEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(vspEntity.getId(), vspEntity.getVersion().toString()));
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java
deleted file mode 100644
index 15b8ad729a..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.core.model.types.ServiceArtifact;
-import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.sdc.model.impl.zusammen.StructureElement;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author katyr
- * @since April 23, 2017
- */
-
-public class VspServiceArtifactConvertor
-{
- private static Set<String> serviceArtifactsLoaded = new HashSet<>();
-
-
-
- public static CollaborationElement[] convertServiceArtifactToElement(ServiceArtifact serviceArtifact) {
-
- CollaborationElement[] serviceArtifactElements;
- List<String> serviceArtifactNamespace = getServiceArtifactNamespace();
-
- int index = 0;
- String serviceArtifactsEntityId = StructureElement.Artifacts.name();
- String uniqueId = serviceArtifact.getVspId()+"_"+serviceArtifact.getVersion().toString();
- if (serviceArtifactsLoaded.contains(uniqueId)) {
- serviceArtifactElements = new CollaborationElement[1];
- } else {
- serviceArtifactsLoaded.add(uniqueId);
- serviceArtifactElements = new CollaborationElement[2];
- serviceArtifactElements[index] = ElementHandler.getElementEntity(
- serviceArtifact.getVspId(), serviceArtifact.getVersion().toString(), serviceArtifactsEntityId,
- serviceArtifactNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Artifacts.name()),
- null,
- null,
- null);
- index++;
- }
-
- serviceArtifactNamespace.add(serviceArtifactsEntityId);
- String elementId = serviceArtifact.getVspId()+"_"+serviceArtifact.getVersion().toString()
- +"_"+serviceArtifact.getName();
- serviceArtifactElements[index] = ElementHandler.getElementEntity(
- serviceArtifact.getVspId(), serviceArtifact.getVersion().toString(), elementId,
- serviceArtifactNamespace,
- getServiceArtifactInfo(serviceArtifact),
- null,
- null,
- FileUtils.toByteArray(serviceArtifact.getContent()));
-
- return serviceArtifactElements;
- }
-
- private static Info getServiceArtifactInfo(ServiceArtifact serviceArtifactEntity) {
- Info info = new Info();
- info.setName(serviceArtifactEntity.getName());
- info.addProperty("type", org.openecomp.sdc.model.impl.zusammen.ElementType.Artifact.name());
-
- return info;
- }
-
- private static List<String> getServiceArtifactNamespace() {
- return ElementHandler.getElementPath(StructureElement.ServiceModel.name());
- }
-
- public static ElementEntityContext convertServiceArtifactToElementContext(ServiceArtifact
- serviceArtifactEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(serviceArtifactEntity.getVspId(), serviceArtifactEntity.getVersion().toString()));
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java
deleted file mode 100644
index a767246f12..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.openecomp.core.migration.convertors;
-
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.store.ElementHandler;
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.sdc.model.impl.zusammen.ElementType;
-import org.openecomp.sdc.model.impl.zusammen.StructureElement;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author katyr
- * @since April 23, 2017
- */
-
-public class VspServiceTemplateConvertor
-{
- private static Set<String> serviceTemplatesLoaded = new HashSet<>();
-
-
-
- public static CollaborationElement[] convertServiceTemplateToElement(ServiceTemplate serviceTemplate) {
-
- CollaborationElement[] serviceTemplateElements;
- List<String> serviceTemplateNamespace = getServiceTemplateNamespace();
-
- int index = 0;
- String serviceTemplatesEntityId = StructureElement.Templates.name();
- String uniqueId = serviceTemplate.getVspId()+"_"+serviceTemplate.getVersion().toString();
- if (serviceTemplatesLoaded.contains(uniqueId)) {
- serviceTemplateElements = new CollaborationElement[1];
- } else {
- serviceTemplatesLoaded.add(uniqueId);
- String vspServiceModelEntityId = StructureElement.ServiceModel.name();
-
- serviceTemplateElements = new CollaborationElement[3];
- serviceTemplateElements[index] = ElementHandler.getElementEntity(
- serviceTemplate.getVspId(),
- serviceTemplate.getVersion().toString(),
- vspServiceModelEntityId,
- serviceTemplateNamespace,
- ElementHandler.getServiceModelElementInfo(vspServiceModelEntityId,serviceTemplate),
- null,
- null,
- null);
- index++;
- serviceTemplateNamespace.add(vspServiceModelEntityId);
- serviceTemplateElements[index] = ElementHandler.getElementEntity(
- serviceTemplate.getVspId(), serviceTemplate.getVersion().toString(), serviceTemplatesEntityId,
- serviceTemplateNamespace,
- ElementHandler.getStructuralElementInfo(StructureElement.Templates.name()),
- null,
- null,
- null);
- index++;
- }
-
- serviceTemplateNamespace.add(serviceTemplatesEntityId);
- String elementId = serviceTemplate.getVspId()+"_"+serviceTemplate.getVersion().toString()
- +"_"+serviceTemplate.getName();
- serviceTemplateElements[index] = ElementHandler.getElementEntity(
- serviceTemplate.getVspId(), serviceTemplate.getVersion().toString(), elementId,
- serviceTemplateNamespace,
- getServiceTemplateInfo(serviceTemplate),
- null,
- null,
- FileUtils.toByteArray(serviceTemplate.getContent()));
-
- return serviceTemplateElements;
- }
-
- private static Info getServiceTemplateInfo(ServiceTemplate serviceTemplateEntity) {
- Info info = new Info();
- info.setName(serviceTemplateEntity.getName());
- info.addProperty("type", ElementType.Servicetemplate.name());
- info.addProperty("base", serviceTemplateEntity.getBaseName());
-
-
-
- return info;
- }
-
- private static List<String> getServiceTemplateNamespace() {
- return ElementHandler.getElementPath();
- }
-
- public static ElementEntityContext convertServiceTemplateToElementContext(ServiceTemplate
- serviceTemplateEntity) {
-
- return new ElementEntityContext("GLOBAL_USER", new
- ElementContext(serviceTemplateEntity.getVspId(), serviceTemplateEntity.getVersion().toString()));
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java
deleted file mode 100644
index 3e00f9d2bc..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-
-import java.util.Collection;
-
-public class ComponentCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final ComponentAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ComponentAccessor.class);
-
-
- public Collection<ComponentEntity> list() {
- return accessor.list().all();
- }
-
- @Accessor
- interface ComponentAccessor {
-
- @Query(
- "select * from vsp_component ")
- Result<ComponentEntity> list();
-
-
- }
-
-
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java
deleted file mode 100644
index c307bfcdf6..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-
-import java.util.Collection;
-
-/**
- * Created by ayalaben on 4/24/2017
- */
-public class EntitlementPoolCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
-
- private static final EntitlementPoolCassandraLoader.EntitlementPoolAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(EntitlementPoolCassandraLoader.EntitlementPoolAccessor.class);
-
- public Collection<EntitlementPoolEntity> list() {
- return accessor.list().all();
- }
-
- @Accessor
- interface EntitlementPoolAccessor {
- @Query("select * from entitlement_pool ")
- Result<EntitlementPoolEntity> list();
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java
deleted file mode 100644
index 0c7627f177..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
-
-import java.util.Collection;
-
-/**
- * Created by ayalaben on 4/25/2017.
- */
-public class FeatureGroupCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final FeatureGroupCassandraLoader.FGAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(FeatureGroupCassandraLoader.FGAccessor.class);
-
- public Collection<FeatureGroupEntity> list() {
- return accessor.getAll().all();
- }
-
- @Accessor
- interface FGAccessor {
- @Query("SELECT * FROM feature_group")
- Result<FeatureGroupEntity> getAll();
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java
deleted file mode 100644
index 891a69eb14..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-
-import java.util.Collection;
-
-/**
- * Created by ayalaben on 4/24/2017
- */
-public class LKGCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final LKGCassandraLoader.LKGAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(LKGCassandraLoader.LKGAccessor.class);
-
- public Collection<LicenseKeyGroupEntity> list() {
- return accessor.getAll().all();
- }
-
- @Accessor
- interface LKGAccessor {
- @Query("SELECT * FROM license_key_group")
- Result<LicenseKeyGroupEntity> getAll();
-
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java
deleted file mode 100644
index ca44209bdb..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
-
-import java.util.Collection;
-
-/**
- * Created by ayalaben on 4/25/2017.
- */
-public class LicenseAgreementCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final LicenseAgreementCassandraLoader.LicenseAgreementAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(LicenseAgreementCassandraLoader.LicenseAgreementAccessor.class);
-
- public Collection<LicenseAgreementEntity> list() {
- return accessor.getAll().all();
- }
-
- @Accessor
- interface LicenseAgreementAccessor {
- @Query("SELECT * FROM license_agreement")
- Result<LicenseAgreementEntity> getAll();
-
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java
deleted file mode 100644
index b93033cc72..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
-
-import java.util.Collection;
-
-public class MibCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final MibAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(MibAccessor.class);
-
-
- public Collection<ComponentMonitoringUploadEntity> list() {
- return accessor.list().all();
- }
-
- @Accessor
- interface MibAccessor {
-
- @Query(
- "select * from vsp_component_artifact")
- Result<ComponentMonitoringUploadEntity> list();
-
-
- }
-
-
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java
deleted file mode 100644
index 7ce93bccf2..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
-
-import java.util.Collection;
-
-/**
- * @author katyr
- * @since April 23, 2017
- */
-
-public class NetworkCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final NetworkCassandraLoader.NetworkAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(NetworkCassandraLoader.NetworkAccessor.class);
-
-
- public Collection<NetworkEntity> list() {
- return accessor.list().all();
- }
-
- @Accessor
- interface NetworkAccessor {
-
- @Query(
- "select * from vsp_network ")
- Result<NetworkEntity> list();
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java
deleted file mode 100644
index fea9c089b5..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.util.Collection;
-
-public class NicCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<NicEntity> mapper =
- noSqlDb.getMappingManager().mapper(NicEntity.class);
- private static final NicAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(NicAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
-
- public Collection<NicEntity> list() {
- return accessor.list().all();
- }
-
- @Accessor
- interface NicAccessor {
-
- @Query(
- "select vsp_id, version, component_id, nic_id, composition_data,questionnaire_data "
- + " from vsp_component_nic ")
- Result<NicEntity> list();
-
-
- }
-
-
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java
deleted file mode 100644
index 09da455847..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity;
-
-import java.util.Collection;
-
-public class OrchestrationTemplateCandidateCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final OrchestrationTemplateCandidateAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(OrchestrationTemplateCandidateAccessor.class);
-
-
- public Collection<OrchestrationTemplateCandidateDataEntity> list() {
- return accessor.list().all();
- }
-
- @Accessor
- interface OrchestrationTemplateCandidateAccessor {
-
- @Query(
- "select * from vsp_orchestration_template_candidate ")
- Result<OrchestrationTemplateCandidateDataEntity> list();
-
-
- }
-
-
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java
deleted file mode 100644
index 6672af5fb4..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
-
-import java.util.Collection;
-
-public class ProcessCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final ProcessAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ProcessAccessor.class);
-
-
- public Collection<ProcessEntity> list() {
- return accessor.list().all();
- }
-
- @Accessor
- interface ProcessAccessor {
-
- @Query(
- "select * from vsp_process")
- Result<ProcessEntity> list();
-
-
- }
-
-
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java
deleted file mode 100644
index 523166205a..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.model.types.ServiceArtifact;
-import org.openecomp.core.model.types.ServiceArtifactEntity;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class ServiceArtifactCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final VspServiceArtifactAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(
- VspServiceArtifactAccessor.class);
-
-
- public Collection<ServiceArtifact> list() {
-
-
- List<ServiceArtifactEntity> entityList = accessor.listAll().all();
-
- return entityList.stream().map(entity -> entity.getServiceArtifact())
- .collect(Collectors.toList());
- }
-
- @Accessor
- interface VspServiceArtifactAccessor {
-
- @Query("SELECT * FROM vsp_service_artifact")
- Result<ServiceArtifactEntity> listAll();
-
-
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java
deleted file mode 100644
index f7e5853ffb..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.core.model.types.ServiceTemplateEntity;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class ServiceTemplateCassandraLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final VspServiceTemplateAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(
- VspServiceTemplateAccessor.class);
-
-
- public Collection<ServiceTemplate> list() {
-
-
- List<ServiceTemplateEntity> entityList = accessor.listAll().all();
-
- return entityList.stream().map(entity -> entity.getServiceTemplate())
- .collect(Collectors.toList());
- }
-
- @Accessor
- interface VspServiceTemplateAccessor {
-
- @Query("SELECT * FROM vsp_service_template")
- Result<ServiceTemplateEntity> listAll();
-
-
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java
deleted file mode 100644
index c02cc1e4ef..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-
-import java.util.Collection;
-
-public class VendorLicenseModelCassandraLoader {
-
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static VendorLicenseModelAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VendorLicenseModelAccessor.class);
-
-
- public Collection<VendorLicenseModelEntity> list() {
- return accessor.getAll().all();
- }
-
- @Accessor
- interface VendorLicenseModelAccessor {
-
- @Query("SELECT * FROM vendor_license_model")
- Result<VendorLicenseModelEntity> getAll();
-
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java
deleted file mode 100644
index 26fc23cf5d..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.util.Collection;
-
-public class VendorSoftwareProductInfoLoader {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<VspInformation> mapper =
- noSqlDb.getMappingManager().mapper(VspInformation.class);
- private static final VendorSoftwareProductInfoAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VendorSoftwareProductInfoAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
-
- public Collection<VspInformation> list() {
- return accessor.listAll().all();
- }
-
-
- @Accessor
- interface VendorSoftwareProductInfoAccessor {
-
- @Query(
- "SELECT * " +
- "FROM " +
- "vsp_information")
- Result<VspInformation> listAll();
-
-
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java
deleted file mode 100644
index 725298b195..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-
-import java.util.Collection;
-
-public class VersionInfoCassandraLoader {
-
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<VersionInfoEntity> mapper =
- noSqlDb.getMappingManager().mapper(VersionInfoEntity.class);
- private static VersionInfoAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
-
-
-
-
- public Collection<VersionInfoEntity> list() {
- return accessor.getAll().all();
- }
-
- @Accessor
- interface VersionInfoAccessor {
- @Query("select * from version_info ")
- Result<VersionInfoEntity> getAll();
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java
deleted file mode 100644
index 2db1b09db3..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.core.migration.loaders;
-
-import com.datastax.driver.mapping.annotations.Column;
-import com.datastax.driver.mapping.annotations.Computed;
-import com.datastax.driver.mapping.annotations.Frozen;
-import com.datastax.driver.mapping.annotations.PartitionKey;
-import com.datastax.driver.mapping.annotations.Table;
-import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.nio.ByteBuffer;
-import java.util.List;
-
-@Table(keyspace = "dox", name = "vsp_information")
-public class VspInformation {
- public static final String ENTITY_TYPE = "Vendor Software Product";
-
- @PartitionKey
- @Column(name = "vsp_id")
- private String id;
-
- @PartitionKey(value = 1)
- @Frozen
- private Version version;
-
- private String name;
- private String description;
-
- private String category;
-
- @Column(name = "sub_category")
- private String subCategory;
-
- private String icon;
-
- @Column(name = "vendor_name")
- private String vendorName;
-
- @Column(name = "vendor_id")
- private String vendorId;
-
- @Column(name = "vlm_version")
- @Frozen
- private Version vlmVersion;
-
- @Column(name = "license_agreement")
- private String licenseAgreement;
-
- @Column(name = "feature_groups")
- private List<String> featureGroups;
-
- @Column(name = "package_name")
- private String packageName;
-
- @Column(name = "package_version")
- private String packageVersion;
-
- @Column(name = "validation_data")
- private String validationData;
-
- @Column(name = "is_old_version")
- private String isOldVersion;
-
- @Column(name = "questionnaire_data")
- private String questionnaireData;
-
- @Column(name = "content_data")
- private ByteBuffer contentData;
-
-
- @Computed("writetime(name)")
- private Long writetimeMicroSeconds;
-
-
- public VspInformation() {
- }
-
- public VspInformation(String id, Version version) {
- this.id = id;
- this.version = version;
- }
-
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public String getSubCategory() {
- return subCategory;
- }
-
- public void setSubCategory(String subCategory) {
- this.subCategory = subCategory;
- }
-
- public String getIcon() {
- return icon;
- }
-
- public void setIcon(String icon) {
- this.icon = icon;
- }
-
- public String getVendorName() {
- return vendorName;
- }
-
- public void setVendorName(String vendorName) {
- this.vendorName = vendorName;
- }
-
- public String getVendorId() {
- return vendorId;
- }
-
- public void setVendorId(String vendorId) {
- this.vendorId = vendorId;
- }
-
- public Version getVlmVersion() {
- return vlmVersion;
- }
-
- public void setVlmVersion(Version vlmVersion) {
- this.vlmVersion = vlmVersion;
- }
-
- public String getLicenseAgreement() {
- return licenseAgreement;
- }
-
- public void setLicenseAgreement(String licenseAgreement) {
- this.licenseAgreement = licenseAgreement;
- }
-
- public List<String> getFeatureGroups() {
- return featureGroups;
- }
-
- public void setFeatureGroups(List<String> featureGroups) {
- this.featureGroups = featureGroups;
- }
-
- public String getPackageName() {
- return packageName;
- }
-
- public void setPackageName(String packageName) {
- this.packageName = packageName;
- }
-
- public String getPackageVersion() {
- return packageVersion;
- }
-
- public void setPackageVersion(String packageVersion) {
- this.packageVersion = packageVersion;
- }
-
- public String getValidationData() {
- return validationData;
- }
-
- public void setValidationData(String validationData) {
- this.validationData = validationData;
- }
-
- public ValidationStructureList getValidationDataStructure() {
- return validationData == null ? null
- : JsonUtil.json2Object(validationData, ValidationStructureList.class);
- }
-
- public void setValidationDataStructure(ValidationStructureList validationData) {
- this.validationData = validationData == null ? null
- : JsonUtil.object2Json(validationData);
- }
-
- public Long getWritetimeMicroSeconds() {
- return this.writetimeMicroSeconds;
- }
-
- public void setWritetimeMicroSeconds(Long writetimeMicroSeconds) {
- this.writetimeMicroSeconds = writetimeMicroSeconds;
- }
-
- public String getIsOldVersion() {
- return this.isOldVersion;
- }
-
- public void setIsOldVersion(String oldVersion) {
- this.isOldVersion = oldVersion;
- }
-
- public void setVersion(Version version) {
- this.version = version;
- }
-
- public Version getVersion() {
- return version;
- }
-
- public String getQuestionnaireData() {
- return questionnaireData;
- }
-
- public void setQuestionnaireData(String questionnaireData) {
- this.questionnaireData = questionnaireData;
- }
-
- public ByteBuffer getContentData() {
- return contentData;
- }
-
- public void setContentData(ByteBuffer contentData) {
- this.contentData = contentData;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("Vsp id = ").append(this.id);
- sb.append("Version = ").append(this.version);
-
- return sb.toString();
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java
deleted file mode 100644
index 548a8d989b..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.openecomp.core.migration.store;
-
-import com.amdocs.zusammen.datatypes.Id;
-import com.amdocs.zusammen.datatypes.Namespace;
-import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.datatypes.item.Relation;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.model.types.ServiceTemplate;
-import org.openecomp.core.zusammen.plugin.ZusammenPluginUtil;
-import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository;
-import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class ElementHandler {
-
- private static final String GLOBAL_USER = "GLOBAL_USER";
-
- public static void save(SessionContext context,
- CassandraElementRepository cassandraElementRepository,
- String itemId, Version versionId,
- CollaborationElement[] elements) {
-
- ElementEntityContext elementContext;
- for (CollaborationElement element : elements) {
-
- elementContext = new ElementEntityContext(GLOBAL_USER, new Id(itemId), getVersionId(itemId,
- versionId));
- ElementEntity elementEntity = ZusammenPluginUtil.getElementEntity(element);
-
- cassandraElementRepository.createNamespace(context, elementContext, elementEntity);
-
- cassandraElementRepository.create(context, elementContext, elementEntity);
-
- if (isActiveVersion(itemId, versionId)) {
- elementContext =
- new ElementEntityContext(GLOBAL_USER, new Id(itemId), new Id(versionId.toString()));
- cassandraElementRepository.create(context, elementContext, elementEntity);
-
- }
- }
- }
-
- public static CollaborationElement getElementEntity(String itemId,
- String versionId,
- String elementId,
- List<String> elementPath,
- Info info,
- Collection<Relation> relations,
- List<String> subElements,
- byte[] data) {
- Namespace namespace = new Namespace();
- for (String pathElementId : elementPath) {
- namespace = new Namespace(namespace, new Id(pathElementId));
- }
- if (namespace.getValue() == null || namespace.getValue().equals("")) {
- namespace = Namespace.ROOT_NAMESPACE;
- }
- CollaborationElement elementEntity = new CollaborationElement(new Id(itemId), new Id(versionId),
- namespace, new Id(elementId));
-
- Id parentId = namespace.getParentElementId() != null ? namespace.getParentElementId() : Id.ZERO;
- elementEntity.setParentId(parentId);
- elementEntity.setInfo(info);
- elementEntity.setRelations(relations);
- if (subElements != null) {
- Set<Id> subElementSet = new HashSet<>();
-
- subElements.forEach(subElement -> subElementSet.add(new Id(subElement)));
-
- }
- if (data != null) {
- elementEntity.setData(new ByteArrayInputStream(data));
- }
-
- return elementEntity;
- }
-
- public static List<String> getElementPath(String... paths) {
- List<String> pathList = new ArrayList<>();
- if (paths != null) {
- Collections.addAll(pathList, paths);
- }
- return pathList;
- }
-
- public static Info getStructuralElementInfo(String elementName) {
- Info info = new Info();
- info.setName(elementName);
- return info;
- }
-
-
- private static Id getVersionId(String itemId, Version versionId) {
- VersionInfoEntity versionInfo =
- MigrationMain.getVersionInfoMap().get(itemId);
- if (versionInfo == null) {
- return new Id(versionId.toString());
- }
- Version lastVersion = versionInfo.getCandidate() != null ? versionInfo.getCandidate()
- .getVersion()
- : versionInfo.getActiveVersion();
-
- if (lastVersion.equals(versionId)) {
- return new Id(itemId);
- } else {
- return new Id(versionId.toString());
- }
- }
-
- private static boolean isActiveVersion(String itemId, Version versionId) {
- VersionInfoEntity versionInfo =
- MigrationMain.getVersionInfoMap().get(itemId);
- return versionInfo != null && versionInfo.getActiveVersion().equals(versionId);
- }
-
-
- public static Info getServiceModelElementInfo(String vspServiceModelEntityId,
- ServiceTemplate serviceTemplate) {
- Info info = ElementHandler.getStructuralElementInfo(vspServiceModelEntityId);
- info.addProperty("base", serviceTemplate.getBaseName());
- return info;
-
- }
-} \ No newline at end of file
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java
deleted file mode 100644
index 801984ab24..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.openecomp.core.migration.store;
-
-import com.amdocs.zusammen.datatypes.Id;
-import com.amdocs.zusammen.datatypes.Namespace;
-import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-import com.amdocs.zusammen.datatypes.item.ItemVersionData;
-import com.amdocs.zusammen.datatypes.item.Relation;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.ItemCassandraDao;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.VersionCassandraDao;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntity;
-
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class ItemHandler {
-
- public static ElementEntity getElementEntity(String id, List<String>
- elementPath, Info info, Collection<Relation> relations, List<String> subElements,
- byte[] data) {
- ElementEntity elementEntity = new ElementEntity(new Id(id));
-
- Namespace namespace = new Namespace();
- for (String elementId : elementPath) {
- namespace = new Namespace(namespace, new Id(elementId));
- }
- elementEntity.setNamespace(namespace);
- elementEntity.setParentId(namespace.getParentElementId());
- elementEntity.setInfo(info);
- elementEntity.setRelations(relations);
- if(subElements!=null) {
- Set<Id> subElementSet = new HashSet<>();
-
- subElements.forEach(subElement -> subElementSet.add(new Id(subElement)));
-
- elementEntity.setSubElementIds(subElementSet);
- }
-
- //elementEntity.setData(new ByteArrayInputStream(data));
- return elementEntity;
- }
-
- public static List<String> getElementPath(String... paths) {
- List<String> pathList = new ArrayList<>();
- for (String path : paths) {
- pathList.add(path);
- }
- return pathList;
- }
-
- public static Info getStractualElementInfo(String elementName) {
- Info info = new Info();
- info.setName(elementName);
- return info;
- }
-
- public static void save(SessionContext context, ItemCassandraDao itemCassandraDao,
- VersionCassandraDao versionCassandraDao,
- String itemId, Version versionId, Info info,
- ItemVersionData itemVersionData, Long writetimeMicroSeconds) {
-
- Date date = writetimeMicroSeconds==null?new Date():new Date(writetimeMicroSeconds);
- itemCassandraDao.create(context,new Id(itemId),info,date);
-
- versionCassandraDao.create(context, context.getUser().getUserName(),new Id(itemId),
- null,getVersionId(itemId,versionId),itemVersionData,date);
-
- if(isActiveVersion(itemId,versionId)){
- versionCassandraDao.create(context, context.getUser().getUserName(),new Id(itemId),
- null,new Id(versionId.toString()),itemVersionData,date);
- }
- }
-
-
-
- private static Info getInfo(VendorLicenseModelEntity vlmEntity) {
- Info info = new Info();
-
- info.setName(vlmEntity.getVendorName());
- info.setDescription(vlmEntity.getDescription());
- info.addProperty("iconRef",vlmEntity.getIconRef());
- info.addProperty("type",vlmEntity.getIconRef());
- return info;
- }
-
- private static Id getVersionId(String itemId, Version versionId) {
- VersionInfoEntity versionInfo =
- MigrationMain.getVersionInfoMap().get(itemId);
- if (versionInfo == null) {
- return new Id(versionId.toString());
- }
- Version lastVersion = versionInfo.getCandidate() != null ? versionInfo.getCandidate()
- .getVersion()
- : versionInfo.getActiveVersion();
-
- if (lastVersion.equals(versionId)) {
- return new Id(itemId);
- } else {
- return new Id(versionId.toString());
- }
- }
- private static boolean isActiveVersion(String itemId, Version versionId) {
- VersionInfoEntity versionInfo =
- MigrationMain.getVersionInfoMap().get(itemId);
- if (versionInfo == null) {
- return false;
- }
-
- return versionInfo.getActiveVersion().equals(versionId);
- }
-
-
-} \ No newline at end of file
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java
deleted file mode 100644
index ea026e5d4f..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.openecomp.core.migration.util;
-
-import org.openecomp.sdc.logging.api.Logger;
-
-/**
- * @author Avrahamg
- * @since April 24, 2017
- */
-public class Utils {
- public static void printMessage(Logger logger, String message) {
- System.out.println(message);
- logger.debug(message);
- }
-}
-
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java
deleted file mode 100644
index 4481b431ec..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.openecomp.core.migration.util.marker;
-
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.migration.MigrationMain;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-/**
- * @author katyr
- * @since May 01, 2017
- */
-
-public class MigrationMarker {
-
- private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final MigrationTableAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(MigrationMarker.MigrationTableAccessor.class);
-
- public static Boolean isMigrated() {
-
- MigrationMarkerEntity result = accessor.isMigrated();
- if (result == null) {
- return false;
- } else {
- return result.getMigrated();
- }
- }
-
- public static void markMigrated() {
- accessor.markMigrated();
- }
-
- @Accessor
- interface MigrationTableAccessor {
- @Query("SELECT * FROM migration where id='1'")
- MigrationMarkerEntity isMigrated();
-
-
- @Query("insert into migration (id,isMigrated) values('1',true)")
- void markMigrated();
-
- }
-
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java
deleted file mode 100644
index 47bb91dc49..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.openecomp.core.migration.util.marker;
-
-import com.datastax.driver.mapping.annotations.ClusteringColumn;
-import com.datastax.driver.mapping.annotations.Column;
-import com.datastax.driver.mapping.annotations.Table;
-
-/**
- * @author katyr
- * @since May 03, 2017
- */
-
-@Table(keyspace = "dox", name = "migration")
-public class MigrationMarkerEntity {
-
- @ClusteringColumn
- private String id;
-
- @Column(name = "ismigrated")
- private Boolean migrated;
-
- public Boolean getMigrated() {
- return migrated;
- }
-
- public void setMigrated(Boolean migrated) {
- this.migrated = migrated;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("MigrationMarkerEntity{");
- sb.append("id='").append(id).append('\'');
- sb.append(", migrated=").append(migrated);
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml
deleted file mode 100644
index 9c9c06c216..0000000000
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<configuration>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration> \ No newline at end of file
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java
deleted file mode 100644
index 487b4131e6..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.openecomp.core.tools.Commands;
-
-import static java.nio.file.Files.createDirectories;
-
-import com.amdocs.zusammen.datatypes.SessionContext;
-import org.apache.commons.io.FileUtils;
-import org.openecomp.core.tools.Commands.exportdata.ElementHandler;
-import org.openecomp.core.tools.Commands.exportdata.ImportProperties;
-import org.openecomp.core.tools.Commands.exportdata.ItemHandler;
-import org.openecomp.core.tools.Commands.exportdata.VersionHandler;
-import org.openecomp.core.tools.util.ZipUtils;
-import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.HashSet;
-import java.util.Set;
-public class ExportDataCommand {
- private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
-
- public static void exportData(SessionContext context, String filterItem) {
- try {
- Set<String> filteredItem = new HashSet<>();
- filteredItem.add(filterItem);
- ImportProperties.initParams();
- CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
- Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY);
- initDir(rootDir);
- if (filterItem != null) {
- filterItem = filterItem.replaceAll("\\r", "");
- }
- new ItemHandler().createItemsData(context, filteredItem);
- new VersionHandler().loadVersions(filteredItem);
- new ElementHandler().loadElements(filteredItem);
- zipPath(rootDir,filteredItem);
- FileUtils.forceDelete(rootDir.toFile());
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
-
- }
- private static void zipPath(Path rootDir,Set<String> filterItem ) throws Exception{
- LocalDateTime date = LocalDateTime.now();
- DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
- String dateStr = date.format(formatter);
- String zipFile = System.getProperty("user.home")+ File.separatorChar+"onboarding_import"+ dateStr + ".zip";
- ZipUtils.createZip(zipFile, rootDir,filterItem);
- logger.info("Exported file :" + zipFile);
- System.out.println("Exported file :" + zipFile);
- }
-
-
- public static void initDir(Path rootDir ) throws IOException{
- if (Files.exists(rootDir)) {
- FileUtils.forceDelete(rootDir.toFile());
- }
- createDirectories(rootDir);
- }
-
-} \ No newline at end of file
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/HealAll.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/HealAll.java
index 2bc48bd0e8..40a56eda83 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/HealAll.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/HealAll.java
@@ -3,6 +3,8 @@ package org.openecomp.core.tools.Commands;
import org.apache.commons.collections.CollectionUtils;
import org.openecomp.core.tools.concurrent.ItemHealingTask;
import org.openecomp.core.tools.loaders.VersionInfoCassandraLoader;
+import org.openecomp.sdc.healing.api.HealingManager;
+import org.openecomp.sdc.healing.factory.HealingManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
@@ -31,18 +33,20 @@ import java.util.stream.Stream;
public class HealAll {
private static final String HEALING_USER = "healing_user";
- private static final int defaulThreadNumber =100;
+ private static final int defaulThreadNumber = 100;
private static BufferedWriter log;
private static List<ItemHealingTask> tasks = new ArrayList<>();
private static VendorSoftwareProductManager vspManager = VspManagerFactory
.getInstance().createInterface();
+ private static HealingManager healingManager = HealingManagerFactory.getInstance()
+ .createInterface();
private static VersioningManager versioningManager = VersioningManagerFactory.getInstance()
.createInterface();
static {
try {
log =
- new BufferedWriter(new FileWriter("healing.log",true));
+ new BufferedWriter(new FileWriter("healing.log", true));
} catch (IOException e) {
if (log != null) {
try {
@@ -64,13 +68,13 @@ public class HealAll {
defaulThreadNumber;
ExecutorService executor = Executors.newFixedThreadPool(numberOfThreads);
- filterByEntityType(VersionInfoCassandraLoader.list(),
+ filterByEntityType(VersionInfoCassandraLoader.list(),
VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE).forEach
- (HealAll::addTaskToTasks);
+ (HealAll::addTaskToTasks);
executeAllTasks(executor);
- writeToLog("----finished healing------" );
+ writeToLog("----finished healing------");
Instant endTime = Instant.now();
writeToLog("Total runtime was: " + Duration.between(startTime, endTime));
@@ -112,7 +116,7 @@ public class HealAll {
if (Objects.nonNull(versionInfoEntity.getCandidate())) {
return versionInfoEntity.getCandidate().getVersion();
} else if (!CollectionUtils.isEmpty(versionInfoEntity.getViewableVersions())) {
- return versionInfoEntity.getViewableVersions().stream().max(Version::compateTo).get();
+ return versionInfoEntity.getViewableVersions().stream().max(Version::compateTo).get();
}
return versionInfoEntity.getActiveVersion();
}
@@ -126,17 +130,16 @@ public class HealAll {
}
}
- private static Stream<VersionInfoEntity> filterByEntityType(Collection<VersionInfoEntity>
- versionInfoEntities,
- String entityType){
+ private static Stream<VersionInfoEntity> filterByEntityType(
+ Collection<VersionInfoEntity> versionInfoEntities, String entityType) {
return versionInfoEntities.stream().filter(versionInfoEntity -> versionInfoEntity
.getEntityType().equals(entityType));
}
- private static void addTaskToTasks(VersionInfoEntity versionInfoEntity){
+
+ private static void addTaskToTasks(VersionInfoEntity versionInfoEntity) {
tasks.add(new ItemHealingTask(versionInfoEntity.getEntityId(), resolveVersion
- (versionInfoEntity).toString(), versionInfoEntity.getCandidate() == null ?
- HEALING_USER : versionInfoEntity.getCandidate().getUser(),
- vspManager, versioningManager));
+ (versionInfoEntity).toString(),
+ vspManager, healingManager));
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java
deleted file mode 100644
index cebff91160..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.openecomp.core.tools.Commands;
-
-import com.amdocs.zusammen.datatypes.SessionContext;
-import org.apache.commons.io.FileUtils;
-import org.openecomp.core.tools.Commands.importdata.TreeWalker;
-import org.openecomp.core.tools.Commands.exportdata.ImportProperties;
-import org.openecomp.core.tools.util.ZipUtils;
-import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-public class ImportCommand {
-
- private static final Logger logger = LoggerFactory.getLogger(ImportCommand.class);
-
-
- public static void importData(SessionContext context, String zippedFile, String filterItem) {
- try {
- ImportProperties.initParams();
- CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
- if (zippedFile == null){
- logger.error("Import must have a valid file as an input.");
- }
- if (zippedFile != null) {
- zippedFile = zippedFile.replaceAll("\\r", "");
- if (filterItem != null) {
- filterItem = filterItem.replaceAll("\\r", "");
- }
- Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY);
- ExportDataCommand.initDir(rootDir);
- ZipUtils.unzip(Paths.get(zippedFile), rootDir);
- TreeWalker.walkFiles(context, rootDir, filterItem);
- FileUtils.forceDelete(rootDir.toFile()); // clear all unzip data at the end.
- }
-
-
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
- }
-
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/SetHealingFlag.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/SetHealingFlag.java
new file mode 100644
index 0000000000..b885ac5d05
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/SetHealingFlag.java
@@ -0,0 +1,31 @@
+package org.openecomp.core.tools.Commands;
+
+import com.datastax.driver.core.ResultSet;
+import org.openecomp.core.tools.store.HealingHandler;
+import org.openecomp.core.tools.store.VersionCassandraLoader;
+import org.openecomp.core.tools.store.zusammen.datatypes.HealingEntity;
+
+import java.util.ArrayList;
+
+
+/**
+ * Created by ayalaben on 10/15/2017
+ */
+public class SetHealingFlag {
+
+
+ public static void populateHealingTable(String oldVersion) {
+
+ VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader();
+ ResultSet listItemVersion = versionCassandraLoader.listItemVersion();
+
+ ArrayList<HealingEntity> healingEntities = new ArrayList<HealingEntity>();
+
+ listItemVersion.iterator().forEachRemaining(entry -> healingEntities.add(new HealingEntity
+ (entry.getString(0),entry.getString(1),entry.getString(2),true,oldVersion)));
+
+ HealingHandler healingHandler = new HealingHandler();
+ healingHandler.populateHealingTable(healingEntities);
+
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java
deleted file mode 100644
index e03b7ffa82..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.openecomp.core.tools.Commands.exportdata;
-
-
-import org.openecomp.core.tools.store.ElementCassandraLoader;
-import org.openecomp.core.tools.store.zusammen.datatypes.ElementEntity;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.nio.ByteBuffer;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Objects;
-import java.util.Set;
-
-import static java.io.File.separator;
-import static java.nio.file.Files.*;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*;
-
-public class ElementHandler {
-
- private static final Logger logger = LoggerFactory.getLogger(ElementHandler.class);
-
- public ElementHandler() {
- }
-
- public void loadElements(Set<String> filteredItem) {
- ElementCassandraLoader elementCassandraLoader = new ElementCassandraLoader();
- elementCassandraLoader.list().forEach(elementEntity -> handleElementEntity(elementEntity,filteredItem));
- }
-
- private void handleElementEntity(ElementEntity elementEntity, Set<String> filteredItem) {
- try {
- String itemId = elementEntity.getItemId();
-
- if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)){
- return;
- }
- String versionId = elementEntity.getVersionId();
- String space = elementEntity.getSpace();
- String namespace = elementEntity.getNamespace();
- String elementId = elementEntity.getElement_id();
-
- String namespacePath = separator;
- if (!isNull(namespace)){
- namespacePath = namespace.replace(ELEMENT_NAMESPACE_SPLITTER,separator)+separator;
- }
- Path elementDirectoryPath;
- if (!isNull(namespace)){
- elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId
- + separator + versionId + separator + space + separator + namespacePath+ separator + elementId);
- } else {
- elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId
- + separator + versionId + separator + space + separator + elementId);
- }
-
- if (notExists(elementDirectoryPath)) {
- Path created = createDirectories(elementDirectoryPath);
- }
-
- String info = elementEntity.getInfo();
- if (!isNull(info)) {
- Path infoFilePath = Paths.get(elementDirectoryPath.toString() + separator + ELEMENT_INFO_PREFIX
- + elementId + JSON_POSTFIX);
- write(infoFilePath, info.getBytes());
- }
-
- String relations = elementEntity.getRelations();
- if (!isNull(relations)) {
- Path realtionsFilePath = Paths.get(elementDirectoryPath.toString() + separator
- + ELEMENT_RELATION_PREFIX + elementId + JSON_POSTFIX);
- write(realtionsFilePath, relations.getBytes());
- }
-
- ByteBuffer data = elementEntity.getData();
- if (!Objects.isNull(data)) {
- Path dataFilePath = Paths.get(elementDirectoryPath.toString() + separator
- + ELEMENT_DATA_PREFIX + elementId + JSON_POSTFIX);
- write(dataFilePath, data.array());
- }
-
- ByteBuffer visualization = elementEntity.getVisualization();
- if (!Objects.isNull(visualization)) {
- Path visualFilePath = Paths.get(elementDirectoryPath.toString() + separator
- + ELEMENT_VISUALIZATION_PREFIX + elementId );
- write(visualFilePath, visualization.array());
- }
-
- ByteBuffer searchableData = elementEntity.getSearchableData();
- if (!Objects.isNull(searchableData)) {
- Path searchableFilePath = Paths.get(elementDirectoryPath.toString() + separator
- + ELEMENT_SEARCHABLE_PREFIX + elementId);
- write(searchableFilePath, searchableData.array());
- }
-
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
-
- }
-
- private boolean isNull(String inStr){
- if (Objects.isNull(inStr)){
- return true;
- }
- return inStr.trim().equalsIgnoreCase("null");
- }
-
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ImportProperties.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ImportProperties.java
deleted file mode 100644
index 3b7566fd1b..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ImportProperties.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.openecomp.core.tools.Commands.exportdata;
-
-import java.io.File;
-
-public class ImportProperties {
- public static final String VERSION_FILE_PREFIX = "version_";
- public static final String VERSION_INFO_FILE_PREFIX = "version_info_";
- public static final String JSON_POSTFIX = ".json";
-
- public static final String ELEMENT_INFO_PREFIX = "elem_info";
- public static final String ELEMENT_RELATION_PREFIX = "elem_relations";
- public static final String ELEMENT_DATA_PREFIX = "elem_data";
- public static final String ELEMENT_VISUALIZATION_PREFIX = "elem_visualization";
- public static final String ELEMENT_SEARCHABLE_PREFIX = "elem_searchableData";
- public static final String ELEMENT_NAMESPACE_SPLITTER = "/";
- public static String ROOT_DIRECTORY;
- public static final void initParams(){
- ROOT_DIRECTORY = System.getProperty("user.home")+File.separator+ "onboarding_import";
- }
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java
deleted file mode 100644
index ebbfb56ed0..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.openecomp.core.tools.Commands.exportdata;
-
-import com.amdocs.zusammen.datatypes.Id;
-import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.Item;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDao;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDaoFactory;
-import com.google.common.base.Strings;
-import org.openecomp.core.tools.Commands.ExportDataCommand;
-import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-
-import static java.io.File.separator;
-import static java.nio.file.Files.*;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX;
-
-public class ItemHandler {
- private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
-
-
- public ItemHandler() {
- ImportProperties.initParams();
- }
-
- public void createItemsData(SessionContext context, Set<String> filteredItem) throws URISyntaxException, IOException {
- final List<Item> items = new ArrayList<>();
- if (filteredItem.isEmpty()) {
- items.addAll(getItemDao(context).list(context));
- } else {
- Optional<Item> item = addItem(context, filteredItem.iterator().next(), items);
- item.ifPresent(foundedItem -> {
- Object vendorId = foundedItem.getInfo().getProperty("vendorId");
- if (vendorId != null) {
- String vendorIdStr = vendorId.toString();
- addItem(context, vendorIdStr, items);
- filteredItem.add(vendorIdStr);
- }
- });
- }
-
- items.parallelStream().forEach(item -> createItemDirectoryAndFiles(item, filteredItem));
-
- }
-
-
-
- private Optional<Item> addItem(SessionContext context, String filteredItem, List<Item> items) {
- Optional<Item> item = getItemDao(context).get(context, new Id(filteredItem));
- item.ifPresent(itemData -> items.add(itemData));
- return item;
- }
-
- private final void createItemDirectoryAndFiles(Item item, Set<String> filteredItem) {
- try {
- String itemId = item.getId().getValue();
- if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)) {
- return;
- }
- Path itemPath = Paths.get(ImportProperties.ROOT_DIRECTORY + separator + itemId);
- Path itemFilePath = Paths.get(ImportProperties.ROOT_DIRECTORY + separator +
- itemId + separator + itemId + JSON_POSTFIX);
- if (notExists(itemPath)) {
- createDirectories(itemPath);
- }
- String itemJson = JsonUtil.object2Json(item);
- write(itemFilePath, itemJson.getBytes());
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
-
- }
-
-
- private ItemDao getItemDao(SessionContext context) {
- return ItemDaoFactory.getInstance().createInterface(context);
- }
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java
deleted file mode 100644
index 4ff562484c..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.openecomp.core.tools.Commands.exportdata;
-
-import org.openecomp.core.tools.Commands.ExportDataCommand;
-import org.openecomp.core.tools.store.VersionInfoCassandraLoader;
-import org.openecomp.core.tools.store.VersionCassandraLoader;
-
-import org.openecomp.core.tools.store.zusammen.datatypes.VersionEntity;
-import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-
-import static java.io.File.separator;
-import static java.nio.file.Files.*;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.ROOT_DIRECTORY;
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Set;
-
-public class VersionHandler {
- private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
-
- public VersionHandler() {
- }
-
- public void loadVersions(Set<String> filteredItem) {
- VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader();
- versionCassandraLoader.list().forEach(versionEntity -> handleVersionEntity(versionEntity,filteredItem));
- VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader();
- versionInfoCassandraLoader.list().forEach(versionInfoEntity -> handleVersionInfo(versionInfoEntity,filteredItem));
- }
-
- private void handleVersionEntity(VersionEntity versionEntity, Set<String> filteredItem) {
- try {
- String itemId = versionEntity.getItemId();
- if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)){
- return;
- }
- String versionId = versionEntity.getVersionId();
- String space = versionEntity.getSpace();
- Path versionDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId
- + separator + versionId + separator + space);
- Path versionFilePath = Paths.get(versionDirectoryPath.toString() + separator + VERSION_FILE_PREFIX
- + versionId + JSON_POSTFIX);
- if (notExists(versionDirectoryPath)) {
- createDirectories(versionDirectoryPath);
- }
- String versionJson = JsonUtil.object2Json(versionEntity);
- write(versionFilePath, versionJson.getBytes());
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
-
- }
-
- private void handleVersionInfo(VersionInfoEntity versionInfoEntity, Set<String> filteredItem) {
- try {
- String itemId = versionInfoEntity.getEntityId();
- Path itemDirectory = Paths.get( ROOT_DIRECTORY + separator + itemId);
- Path versionInfoFilePath = Paths.get(itemDirectory.toString() + separator + VERSION_INFO_FILE_PREFIX
- + itemId + JSON_POSTFIX);
- if (exists(itemDirectory)) {
- String versionJson = JsonUtil.object2Json(versionInfoEntity);
- write(versionInfoFilePath, versionJson.getBytes());
- }
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
-
- }
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java
deleted file mode 100644
index d439468e97..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.openecomp.core.tools.Commands.importdata;
-
-import com.amdocs.zusammen.datatypes.Id;
-import com.amdocs.zusammen.datatypes.SessionContext;
-import org.openecomp.core.tools.store.ElementCassandraLoader;
-import org.openecomp.core.tools.store.ElementNamespaceHandler;
-import org.openecomp.core.tools.store.VersionCassandraLoader;
-import org.openecomp.core.tools.store.zusammen.datatypes.ElementEntity;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import static java.io.File.separator;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*;
-
-public class ElementImport {
- private static final Logger logger = LoggerFactory.getLogger(ElementImport.class);
- public static final String ROOT_ITEM = Id.ZERO.getValue();
-
- private ElementCassandraLoader elementCassandraLoader = new ElementCassandraLoader();
- private ElementNamespaceHandler cassandraElementRepository = new ElementNamespaceHandler();
- private VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader();
-
- public void loadPath(SessionContext sessionContext, Path elementDir, String elementId, String[]
- pathObjects) {
- try {
- if (!Files.isDirectory(elementDir)){
- return;
- }
- // load info file
- ElementEntity elementEntity = new ElementEntity();
- Path infoFilePath = Paths.get(elementDir.toString() + separator + ELEMENT_INFO_PREFIX
- + elementId + JSON_POSTFIX);
- if (Files.exists(infoFilePath)) {
- String info = new String(Files.readAllBytes(infoFilePath));
- elementEntity.setInfo(info);
- }
- // load relation file
- Path realtionsFilePath = Paths.get(elementDir.toString() + separator
- + ELEMENT_RELATION_PREFIX + elementId + JSON_POSTFIX);
- if (Files.exists(realtionsFilePath)) {
- String relations = new String(Files.readAllBytes(realtionsFilePath));
- elementEntity.setRelations(relations);
- }
-
- //load entity data
- Path dataFilePath = Paths.get(elementDir.toString() + separator
- + ELEMENT_DATA_PREFIX + elementId + JSON_POSTFIX);
- if (Files.exists(dataFilePath)) {
- byte[] bytes = Files.readAllBytes(dataFilePath);
- ByteBuffer data = ByteBuffer.wrap(bytes);
- elementEntity.setData(data);
- }
-
- //load visualization
- Path visualFilePath = Paths.get(elementDir.toString() + separator
- + ELEMENT_VISUALIZATION_PREFIX + elementId);
- if (Files.exists(visualFilePath)) {
- byte[] bytes = Files.readAllBytes(visualFilePath);
- ByteBuffer visualization = ByteBuffer.wrap(bytes);
- elementEntity.setVisualization(visualization);
- }
-
- //load searchable
- Path searchableFilePath = Paths.get(elementDir.toString() + separator
- + ELEMENT_SEARCHABLE_PREFIX + elementId);
- if (Files.exists(searchableFilePath)) {
- byte[] bytes = Files.readAllBytes(searchableFilePath);
- ByteBuffer searchable = ByteBuffer.wrap(bytes);
- elementEntity.setSearchableData(searchable);
- }
- String element_Id = pathObjects[pathObjects.length - 1];
- elementEntity.setSpace(pathObjects[2]);
- elementEntity.setItemId(pathObjects[0]);
- elementEntity.setVersionId(pathObjects[1]);
- elementEntity.setElement_id(element_Id);
- elementEntity.setNamespace(getNameSpace(pathObjects));
- elementEntity.setParentId(getParentId(pathObjects));
- elementEntity.setSubElementIds(getAllSubElementsIds(elementDir, element_Id));
- elementCassandraLoader.createEntity(elementEntity);
- cassandraElementRepository.createElementNamespace(elementEntity);
- versionCassandraLoader.insertElementToVersion(elementEntity);
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
- }
-
- private String getParentId(String[] pathObjects) {
-
- if (pathObjects[pathObjects.length - 1].equals(ROOT_ITEM)) {
- return null;
- }
- if (pathObjects.length == 4) {
- return ROOT_ITEM;
- }
- return pathObjects[pathObjects.length - 2];
- }
-
- private Set<String> getAllSubElementsIds(Path root, String elementId) throws IOException {
- if (elementId.equals(ROOT_ITEM)) {
- root = root.getParent();
- }
- File file = root.toFile();
- Set<String> retVal = new HashSet<>();
- File[] files = file.listFiles();
- for (File f : files){
- if (f.isDirectory()){
- retVal.add(f.getName());
- }
- }
- retVal.remove(ROOT_ITEM);
- return retVal;
-
- }
-
- private String getNameSpace(String[] pathObjects) {
- if (pathObjects.length <= 4) {
- return "";
- }
- if (pathObjects.length == 5) {
- return pathObjects[3];
- }
- return Arrays.stream(pathObjects, 3, pathObjects.length - 1)
- .reduce("", (s1, s2) -> s1 + File.separator + s2);
- }
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java
deleted file mode 100644
index 4dd4a1f2c8..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.openecomp.core.tools.Commands.importdata;
-
-import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.Item;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDao;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDaoFactory;
-import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX;
-
-public class ItemImport {
- private static final Logger logger = LoggerFactory.getLogger(ItemImport.class);
-
- public void loadPath(SessionContext sessionContext, Path itemDir, String itemName) {
- try {
- Path itemPath = Paths.get(itemDir.toString() + File.separator + itemName + JSON_POSTFIX);
- if (!Files.exists(itemPath)) {
- return;
- }
- String itemJson = new String(Files.readAllBytes(itemPath));
- if (itemJson.trim().isEmpty()) {
- return;
- }
- Item item = JsonUtil.json2Object(itemJson, Item.class);
- ItemDao itemDao = getItemDao(sessionContext);
- itemDao.create(sessionContext, item.getId(), item.getInfo(), item.getCreationTime());
- logger.info("Item Created :"+item.getInfo().getName()+" , "+item.getId());
- System.out.println("Item Created :"+item.getInfo().getName()+" , "+item.getId());
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
- }
-
- private ItemDao getItemDao(SessionContext context) {
- return ItemDaoFactory.getInstance().createInterface(context);
- }
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java
deleted file mode 100644
index 30c4152491..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.openecomp.core.tools.Commands.importdata;
-
-import com.amdocs.zusammen.datatypes.SessionContext;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.stream.Stream;
-
-public class TreeWalker {
- private static final Logger logger = LoggerFactory.getLogger(TreeWalker.class);
-
- public static final void walkFiles(SessionContext sessionContext,Path rootDir, String filterItem) throws IOException {
- try (Stream<Path> walk = Files.walk(rootDir)) {
- walk.parallel().filter(path -> Files.isDirectory(path)).
- forEach(path -> handlePath(sessionContext,path, rootDir, filterItem));
- }
- }
-
- private static final void handlePath(SessionContext sessionContext, Path path, Path root,String filterItem) {
- String logicalPath = path.toString().replace(root.toString(), "");
- if (logicalPath.startsWith(File.separator)){
- logicalPath = logicalPath.substring(1);
- }
- String[] splitted = logicalPath.split(File.separator);
- if(filterItem != null && splitted.length > 0 && !splitted[0].contains(filterItem)){
- return;
- }
- switch (splitted.length) {
- case 0:
- //root - ignore
- break;
- case 1: // handle Item
- new ItemImport().loadPath(sessionContext,path,splitted[splitted.length -1]);
- new VersionInfoImport().loadPath(sessionContext,path,splitted[splitted.length -1]);
- break;
- case 2:
- //ignore this level
- break;
- case 3: // handle version
- new VersionImport().loadPath(sessionContext,path,splitted[splitted.length -2]);
- break;
- default:
- //handle elements
- new ElementImport().loadPath(sessionContext,path,splitted[splitted.length -1],splitted);
- break;
- }
-
- }
-
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java
deleted file mode 100644
index 48433d8a90..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.openecomp.core.tools.Commands.importdata;
-
-import com.amdocs.zusammen.datatypes.SessionContext;
-import org.openecomp.core.tools.store.VersionCassandraLoader;
-import org.openecomp.core.tools.store.zusammen.datatypes.VersionEntity;
-import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import static java.io.File.separator;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.VERSION_FILE_PREFIX;
-
-public class VersionImport {
- private static final Logger logger = LoggerFactory.getLogger(VersionImport.class);
-
- public void loadPath(SessionContext sessionContext, Path versionDir , String versionId){
- try {
- Path versionPath = Paths.get(versionDir.toString() + separator + VERSION_FILE_PREFIX
- + versionId + JSON_POSTFIX);
- if (!Files.exists(versionPath)) {
- return;
- }
- String versionJson = new String(Files.readAllBytes(versionPath));
- if (versionJson.trim().isEmpty()) {
- return;
- }
- VersionEntity versionEntity = JsonUtil.json2Object(versionJson, VersionEntity.class);
- VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader();
- versionCassandraLoader.insertVersion(versionEntity);
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
- }
-
-
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java
deleted file mode 100644
index e9d4174d6c..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.openecomp.core.tools.Commands.importdata;
-
-import com.amdocs.zusammen.datatypes.SessionContext;
-import org.openecomp.core.tools.store.VersionInfoCassandraLoader;
-import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import static java.io.File.separator;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX;
-import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.VERSION_INFO_FILE_PREFIX;
-
-public class VersionInfoImport {
- private static final Logger logger = LoggerFactory.getLogger(VersionInfoImport.class);
-
- public void loadPath(SessionContext sessionContext, Path itemPath, String itemId) {
- try {
- Path versionInfoFilePath = Paths.get(itemPath.toString() + separator + VERSION_INFO_FILE_PREFIX
- + itemId + JSON_POSTFIX);
- if (!Files.exists(versionInfoFilePath)) {
- return;
- }
- String versionInfoJson = new String(Files.readAllBytes(versionInfoFilePath));
- if (versionInfoJson.trim().isEmpty()) {
- return;
- }
- VersionInfoEntity versionInfoEntity = JsonUtil.json2Object(versionInfoJson, VersionInfoEntity.class);
- VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader();
- versionInfoCassandraLoader.insertVersionInfo(versionInfoEntity);
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
- }
-
-
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java
index 39b62d4e99..878390fdc2 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java
@@ -1,13 +1,8 @@
package org.openecomp.core.tools.concurrent;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
+import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.versioning.VersioningManager;
-import org.openecomp.sdc.versioning.VersioningUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import java.util.concurrent.Callable;
@@ -17,55 +12,44 @@ import java.util.concurrent.Callable;
public class ItemHealingTask implements Callable<String> {
private String itemId;
- private String versionId;
- private String user;
+ private Version version;
private VendorSoftwareProductManager vspManager;
- private VersioningManager versioningManager;
+ private HealingManager healingManager;
public String getItemId() {
return itemId;
}
public String getVersionId() {
- return versionId;
+// return version.getId();
+ return null;
}
- public ItemHealingTask(String itemId, String versionId, String user,
+ public ItemHealingTask(String itemId, String versionId,
VendorSoftwareProductManager vspManager,
- VersioningManager versioningManager) {
- this.itemId = itemId;
- this.versionId = versionId;
- this.user = user;
- this.versioningManager = versioningManager;
+ HealingManager healingManager) {
+// this.itemId = itemId;
+// this.version = new Version(versionId);
this.vspManager = vspManager;
+ this.healingManager = healingManager;
+
}
@Override
public String call() throws Exception {
-
- VersionInfo versionInfo = getVersionInfo(itemId, VersionableEntityAction.Read, user);
- Version resolvedVersion = VersioningUtil.resolveVersion(Version.valueOf(versionId),
- versionInfo, user);
- VspDetails vspDetails = vspManager.getVsp(itemId, resolvedVersion, user);
-
- try {
- vspManager.callAutoHeal(itemId, versionInfo, vspDetails, user);
-
- } catch (Exception e) {
- return (String.format("healing failed on vsp: %s with id: %s, versionId: %s, resolved " +
- "Version: %s, with message: %s",vspDetails.getName(),itemId,
- versionId,resolvedVersion,e.getMessage()));
- }
-
- return String.format("healed vsp: %s, with id: %s, versionId:%s, resolved version: %s",
- vspDetails.getName(), itemId, versionId,resolvedVersion );
- }
-
- private VersionInfo getVersionInfo(String vendorSoftwareProductId, VersionableEntityAction action,
- String user) {
- return versioningManager.getEntityVersionInfo(
- VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
- vendorSoftwareProductId, user, action);
+// VspDetails vspDetails = vspManager.getVsp(itemId, version);
+//
+// try {
+// healingManager.healItemVersion(itemId, version, ItemType.vsp, true);
+// } catch (Exception e) {
+// return (String
+// .format("healing failed on vsp: %s with id: %s, versionId: %s, with message: %s",
+// vspDetails.getName(), itemId, version.getId(), e.getMessage()));
+// }
+//
+// return String.format("healed vsp: %s, with id: %s, versionId: %s",
+// vspDetails.getName(), itemId, version.getId());
+ return null;
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java
new file mode 100644
index 0000000000..5dcc72de59
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportDataCommand.java
@@ -0,0 +1,125 @@
+/**
+ * Copyright © 2016-2017 European Support Limited.
+ */
+package org.openecomp.core.tools.exportinfo;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.ResultSetFuture;
+import com.datastax.driver.core.Session;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import org.apache.commons.io.FileUtils;
+import org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory;
+import org.openecomp.core.tools.importinfo.ImportProperties;
+import org.openecomp.core.tools.util.Utils;
+import org.openecomp.core.tools.util.ZipUtils;
+import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.yaml.snakeyaml.Yaml;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.stream.Collectors;
+
+import static java.nio.file.Files.createDirectories;
+
+
+public class ExportDataCommand {
+ private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
+ public static final String JOIN_DELIMITER = "$#";
+ public static final String JOIN_DELIMITER_SPILTTER = "\\$\\#";
+ public static final String MAP_DELIMITER = "!@";
+ public static final String MAP_DELIMITER_SPLITTER = "\\!\\@";
+ public static final String EXPORT_FILE_NAME = "ITEM_EXPORT";
+
+ public static void exportData(SessionContext sessionContext, String filterItem) {
+ try {
+ CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
+ final Set<String> filteredItems = Sets.newHashSet(filterItem);
+ Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY);
+ initDir(rootDir);
+ Set<String> fis = filteredItems.stream().map(fi -> fi.replaceAll("\\r", "")).collect(Collectors.toSet());
+
+ Map<String, List<String>> queries;
+ Yaml yaml = new Yaml();
+ try (InputStream is = ExportDataCommand.class.getResourceAsStream("/queries.yaml")) {
+ queries = (Map<String, List<String>>) yaml.load(is);
+ }
+ List<String> queriesList = queries.get("queries");
+ List<String> itempsColumns = queries.get("item_columns");
+ Set<String> vlms = new HashSet<>();
+ CountDownLatch doneQueries = new CountDownLatch(queriesList.size());
+ for (int i = 0; i < queriesList.size(); i++) {
+ executeQuery(queriesList.get(i), fis, itempsColumns.get(i), vlms, doneQueries);
+ }
+ doneQueries.await();
+ if (!vlms.isEmpty()) {
+ CountDownLatch doneVmls = new CountDownLatch(queriesList.size());
+
+ for (int i = 0; i < queriesList.size(); i++) {
+ executeQuery(queriesList.get(i), vlms, itempsColumns.get(i), null, doneVmls);
+ }
+
+ doneVmls.await();
+ }
+ zipPath(rootDir);
+ FileUtils.forceDelete(rootDir.toFile());
+ } catch (Exception ex) {
+ Utils.logError(logger, ex);
+ }
+
+ }
+
+
+ private static boolean executeQuery(final String query, final Set<String> filteredItems, final String filteredColumn,
+ final Set<String> vlms, final CountDownLatch donequerying) {
+ Session session = CassandraSessionFactory.getSession();
+ ResultSetFuture resultSetFuture = session.executeAsync(query);
+ Futures.addCallback(resultSetFuture, new FutureCallback<ResultSet>() {
+ @Override
+ public void onSuccess(ResultSet resultSet) {
+ new ExportSerializer().serializeResult(resultSet, filteredItems, filteredColumn, vlms);
+ donequerying.countDown();
+ }
+
+ @Override
+ public void onFailure(Throwable t) {
+ Utils.logError(logger, "Query failed :" + query, t);
+ donequerying.countDown();
+ }
+ });
+ return true;
+ }
+
+ private static void zipPath(Path rootDir) throws Exception {
+ LocalDateTime date = LocalDateTime.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
+ String dateStr = date.format(formatter);
+ dateStr = dateStr.replaceAll(":", "_");
+ String zipFile = System.getProperty("user.home") + File.separatorChar + "onboarding_import" + dateStr + ".zip";
+ ZipUtils.createZip(zipFile, rootDir);
+ Utils.printMessage(logger, "Exported file :" + zipFile);
+ }
+
+
+ public static void initDir(Path rootDir) throws IOException {
+ if (rootDir.toFile().exists()) {
+ FileUtils.forceDelete(rootDir.toFile());
+ }
+ createDirectories(rootDir);
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java
new file mode 100644
index 0000000000..3c917b1c7e
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/exportinfo/ExportSerializer.java
@@ -0,0 +1,152 @@
+/**
+ * Copyright © 2016-2017 European Support Limited.
+ */
+package org.openecomp.core.tools.exportinfo;
+
+import com.datastax.driver.core.DataType.Name;
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.Row;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openecomp.core.tools.importinfo.ImportProperties;
+import org.openecomp.core.tools.model.ColumnDefinition;
+import org.openecomp.core.tools.model.TableData;
+import org.openecomp.core.tools.util.Utils;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static org.openecomp.core.tools.importinfo.ImportSingleTable.dataTypesMap;
+
+public class ExportSerializer {
+
+ private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
+ private static final String ELEMENT_TABLE_NAME = "element";
+ private static final String ELEMENT_INFO_COLUMN_NAME = "info";
+
+ public void serializeResult(final ResultSet resultSet, final Set<String> filteredItems, final String filteredColumn, Set<String> vlms) {
+ try {
+ TableData tableData = new TableData();
+ tableData.definitions = resultSet.getColumnDefinitions().asList().stream().map(column -> new ColumnDefinition(column)).collect(Collectors.toList());
+ String table = tableData.definitions.iterator().next().getTable();
+ boolean isElementTable = table.equals(ELEMENT_TABLE_NAME);
+ Iterator<Row> iterator = resultSet.iterator();
+ iterator.forEachRemaining(row -> {
+ if (!filteredItems.contains(row.getString(filteredColumn))) {
+ return;
+ }
+ List<String> rowData = new ArrayList<>();
+ for (int i = 0; i < tableData.definitions.size(); i++) {
+ ColumnDefinition columnDefinition = tableData.definitions.get(i);
+ Name name = dataTypesMap.get(columnDefinition.getType());
+ boolean checkForVLM = isElementTable && columnDefinition.getName().equals(ELEMENT_INFO_COLUMN_NAME);
+ Object data;
+ data = convertByType(vlms, row, i, name, checkForVLM);
+ rowData.add(data.toString());
+ }
+ tableData.rows.add(rowData);
+ });
+ ObjectMapper objectMapper = new ObjectMapper();
+ String fileName = ImportProperties.ROOT_DIRECTORY + File.separator + table + "_" + System.currentTimeMillis() + ".json";
+ objectMapper.writeValue(Paths.get(fileName).toFile(), tableData);
+ Utils.printMessage(logger, "File exported is :" + fileName);
+
+ } catch (IOException e) {
+ Utils.logError(logger, e);
+ System.exit(1);
+ }
+ }
+
+ private Object convertByType(Set<String> vlms, Row row, int i, Name name, boolean checkForVLM) {
+ Object data;
+ switch (name) {
+ case VARCHAR:
+ case TEXT:
+ case ASCII:
+ String string = row.getString(i);
+ if (string == null) {
+ string = "";
+ }
+ if (checkForVLM && vlms != null){
+ String vlm = extractVlm(string);
+ if (vlm!= null) {
+ vlms.add(vlm);
+ }
+ }
+ data = Base64.getEncoder().encodeToString(string.getBytes());
+ break;
+ case BLOB:
+ ByteBuffer bytes = row.getBytes(i);
+ if (bytes == null) {
+ bytes = ByteBuffer.wrap("".getBytes());
+ }
+ data = Base64.getEncoder().encodeToString(bytes.array());
+ break;
+ case TIMESTAMP:
+ data = row.getDate(i).getTime();
+ break;
+ case BOOLEAN:
+ data = row.getBool(i);
+ break;
+ case COUNTER:
+ data = row.getLong(i);
+ break;
+ case INT:
+ data = row.getInt(i);
+ break;
+ case FLOAT:
+ data = row.getFloat(i);
+ break;
+ case SET:
+ Set set = row.getSet(i, Object.class);
+ Object joined = set.stream().map(o -> o.toString()).collect(Collectors.joining(ExportDataCommand.JOIN_DELIMITER));
+ data = Base64.getEncoder().encodeToString(joined.toString().getBytes());
+ break;
+ case MAP:
+ Map<Object,Object> map = row.getMap(i, Object.class, Object.class);
+ Set<Map.Entry<Object,Object>> entrySet = map.entrySet();
+ Object mapAsString = entrySet.parallelStream().map(entry -> entry.getKey().toString() + ExportDataCommand.MAP_DELIMITER +entry.getValue().toString())
+ .collect(Collectors.joining(ExportDataCommand.MAP_DELIMITER));
+ data = Base64.getEncoder().encodeToString(mapAsString.toString().getBytes());
+ break;
+ default:
+ throw new UnsupportedOperationException("Name is not supported :" + name);
+ }
+ return data;
+ }
+
+ protected String extractVlm(String injson) {
+ try {
+ if (injson == null){
+ return null;
+ }
+ JsonElement root = new JsonParser().parse(injson);
+ if (root == null){
+ return null;
+ }
+ JsonElement properties = root.getAsJsonObject().get("properties");
+ if (properties == null){
+ return null;
+ }
+ JsonElement vendorId = properties.getAsJsonObject().get("vendorId");
+ if (vendorId == null){
+ return null;
+ }
+ return vendorId.getAsString();
+ } catch (Exception ex){
+ return null;
+ }
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportDataCommand.java
new file mode 100644
index 0000000000..bae6cfa4dd
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportDataCommand.java
@@ -0,0 +1,37 @@
+package org.openecomp.core.tools.importinfo;
+
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.apache.commons.io.FileUtils;
+import org.openecomp.core.tools.exportinfo.ExportDataCommand;
+import org.openecomp.core.tools.util.Utils;
+import org.openecomp.core.tools.util.ZipUtils;
+import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.stream.Stream;
+
+public class ImportDataCommand {
+
+ private static final Logger logger = LoggerFactory.getLogger(ImportDataCommand.class);
+
+ public static final void execute(SessionContext sessionContext, String uploadFile) {
+ try {
+ CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
+ Path outputFolder = Paths.get(ImportProperties.ROOT_DIRECTORY);
+ ExportDataCommand.initDir(outputFolder); //clear old imports.
+ ZipUtils.unzip(Paths.get(uploadFile), outputFolder);
+ try( Stream<Path> files = Files.list(outputFolder)) {
+ files.forEach(file -> new ImportSingleTable().importFile(file));
+ }
+ FileUtils.forceDelete(outputFolder.toFile()); // leaves directory clean
+ } catch (IOException e) {
+ Utils.logError(logger, e);
+ }
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportProperties.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportProperties.java
new file mode 100644
index 0000000000..b9a27faeef
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportProperties.java
@@ -0,0 +1,7 @@
+package org.openecomp.core.tools.importinfo;
+
+import java.io.File;
+
+public class ImportProperties {
+ public static final String ROOT_DIRECTORY = System.getProperty("user.home")+File.separator+ "onboarding_import";
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
new file mode 100644
index 0000000000..7504ad1194
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
@@ -0,0 +1,166 @@
+package org.openecomp.core.tools.importinfo;
+
+import com.datastax.driver.core.BoundStatement;
+import com.datastax.driver.core.DataType.Name;
+import com.datastax.driver.core.PreparedStatement;
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.ResultSetFuture;
+import com.datastax.driver.core.Session;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import org.apache.commons.lang3.StringUtils;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory;
+import org.openecomp.core.tools.exportinfo.ExportDataCommand;
+import org.openecomp.core.tools.model.ColumnDefinition;
+import org.openecomp.core.tools.model.TableData;
+import org.openecomp.core.tools.util.Utils;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.file.Path;
+import java.util.Base64;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class ImportSingleTable {
+
+ private static final Logger logger = LoggerFactory.getLogger(ImportSingleTable.class);
+
+ public static final String INSERT_INTO = "INSERT INTO ";
+ public static final String VALUES = " VALUES ";
+ private static final Map<String, PreparedStatement> statementsCache = new HashMap<>();
+
+ public void importFile(Path file) {
+ try {
+ ObjectMapper objectMapper = new ObjectMapper();
+ TableData tableData = objectMapper.readValue(file.toFile(), TableData.class);
+ Session session = CassandraSessionFactory.getSession();
+ PreparedStatement ps = getPrepareStatement(tableData, session);
+ tableData.rows.parallelStream().forEach(row -> executeQuery(session, ps, tableData.definitions, row));
+ } catch (IOException e) {
+ Utils.logError(logger, e);
+ }
+
+ }
+
+ private PreparedStatement getPrepareStatement(TableData tableData, Session session) {
+ String query = createQuery(tableData);
+ if (statementsCache.containsKey(query)) {
+ return statementsCache.get(query);
+ }
+ PreparedStatement preparedStatement = session.prepare(query);
+ statementsCache.put(query, preparedStatement);
+ return preparedStatement;
+ }
+
+ private void executeQuery(Session session, PreparedStatement ps, List<ColumnDefinition> definitions, List<String> rows) {
+ BoundStatement bind = ps.bind();
+ for (int i = 0; i < definitions.size(); i++) {
+ ColumnDefinition columnDefinition = definitions.get(i);
+ String rowData = rows.get(i);
+ Name name = dataTypesMap.get(columnDefinition.getType());
+ handleByType(bind, i, rowData, name);
+ }
+ ResultSetFuture resultSetFuture = session.executeAsync(bind);
+ Futures.addCallback(resultSetFuture, new FutureCallback<ResultSet>() {
+ @Override
+ public void onSuccess(ResultSet resultSet) {
+ Utils.printMessage(logger, "successful write ");
+ }
+
+ @Override
+ public void onFailure(Throwable t) {
+ Utils.logError(logger, t);
+ }
+ });
+ }
+
+ private void handleByType(BoundStatement bind, int i, String rowData, Name name) {
+ switch (name) {
+ case VARCHAR:
+ case TEXT:
+ case ASCII:
+ bind.setString(i, new String(Base64.getDecoder().decode(rowData)));
+ break;
+ case BLOB:
+ bind.setBytes(i, ByteBuffer.wrap(Base64.getDecoder().decode(rowData.getBytes())));
+ break;
+ case TIMESTAMP:
+ bind.setDate(i, new Date(Long.parseLong(rowData)));
+ break;
+ case BOOLEAN:
+ bind.setBool(i, Boolean.parseBoolean(rowData));
+ break;
+ case COUNTER:
+ bind.setLong(i, Long.parseLong(rowData));
+ break;
+ case INT:
+ bind.setInt(i, Integer.parseInt(rowData));
+ break;
+ case FLOAT:
+ bind.setFloat(i, Float.parseFloat(rowData));
+ break;
+ case SET:
+ byte[] decoded = Base64.getDecoder().decode(rowData);
+ String decodedStr = new String(decoded);
+ if (!StringUtils.isEmpty(decodedStr)) {
+ String[] splitted = decodedStr.split(ExportDataCommand.JOIN_DELIMITER_SPILTTER);
+ Set set = Sets.newHashSet(splitted);
+ set.remove("");
+ bind.setSet(i, set);
+ } else {
+ bind.setSet(i, null);
+ }
+ break;
+ case MAP:
+ byte[] decodedMap = Base64.getDecoder().decode(rowData);
+ String mapStr = new String(decodedMap);
+ if (!StringUtils.isEmpty(mapStr)) {
+ String[] splittedMap = mapStr.split(ExportDataCommand.JOIN_DELIMITER_SPILTTER);
+ Map<String, String> map = new HashMap<>();
+ for (String keyValue : splittedMap) {
+ String[] split = keyValue.split(ExportDataCommand.MAP_DELIMITER_SPLITTER);
+ map.put(split[0], split[1]);
+ }
+ bind.setMap(i, map);
+ } else {
+ bind.setMap(i, null);
+ }
+ break;
+ default:
+ throw new UnsupportedOperationException("Name is not supported :" + name);
+
+ }
+ }
+
+ private String createQuery(TableData tableData) {
+ ColumnDefinition def = tableData.definitions.iterator().next();
+ StringBuilder sb = new StringBuilder();
+ sb.append(INSERT_INTO).append(def.getKeyspace()).append(".").append(def.getTable());
+ sb.append(tableData.definitions.stream().map(definition -> definition.getName()).collect(Collectors.joining(" , ", " ( ", " ) ")));
+ sb.append(VALUES).append(tableData.definitions.stream().map(definition -> "?").collect(Collectors.joining(" , ", " ( ", " ) "))).append(";");
+ return sb.toString();
+ }
+
+ public static final ImmutableMap<String, Name> dataTypesMap;
+
+ static {
+ Builder<String, Name> builder = ImmutableMap.builder();
+ Name[] values = Name.values();
+ for (Name name : values) {
+ builder.put(name.name().toLowerCase(), name);
+ }
+ dataTypesMap = builder.build();
+ }
+
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspGeneralLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspGeneralLoader.java
deleted file mode 100644
index d92866bb47..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspGeneralLoader.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.openecomp.core.tools.loaders.zusammen;
-
-import com.amdocs.zusammen.datatypes.Id;
-import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository;
-import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-public class VspGeneralLoader {
- public static Map<String, ElementEntity> load(SessionContext context,
- Map<String, List<String>> vspItemVersionsMap) {
- Map<String, ElementEntity> elementEntityMap = new HashMap<>();
- System.setProperty("cassandra.dox.keystore", "zusammen_dox");
- CassandraElementRepository cassandraElementRepository = new CassandraElementRepository();
- for (Map.Entry<String, List<String>> entry : vspItemVersionsMap.entrySet()) {
-
- for (String version : entry.getValue()) {
-
- Optional<ElementEntity> result =
- cassandraElementRepository.get(context, new ElementEntityContext(
- context.getUser().getUserName(),
- new Id(entry.getKey()),
- new Id(version)),
- new ElementEntity(new Id(StructureElement.General.name())));
- if (result.isPresent()) {
- elementEntityMap.put(context.getUser().getUserName() + "_" + entry.getKey()
- + "_" + version, result.get());
- }
- }
- }
-
- return elementEntityMap;
- }
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspItemLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspItemLoader.java
deleted file mode 100644
index 78b915c525..0000000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspItemLoader.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.openecomp.core.tools.loaders.zusammen;
-
-public class VspItemLoader {
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java
index b55d51709d..182988717e 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java
@@ -3,9 +3,9 @@ package org.openecomp.core.tools.main;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.UserInfo;
import org.openecomp.core.tools.Commands.HealAll;
-import org.openecomp.core.tools.Commands.ImportCommand;
-import org.openecomp.core.tools.Commands.ExportDataCommand;
-import org.openecomp.core.tools.Commands.ResetOldVersion;
+import org.openecomp.core.tools.Commands.SetHealingFlag;
+import org.openecomp.core.tools.exportinfo.ExportDataCommand;
+import org.openecomp.core.tools.importinfo.ImportDataCommand;
import org.openecomp.core.tools.util.ToolsUtil;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -39,13 +39,13 @@ public class ZusammenMainTool {
switch (COMMANDS.valueOf(command)){
case RESET_OLD_VERSION:
- ResetOldVersion.reset(context,ToolsUtil.getParam("v",args),ToolsUtil.getParam("n",args));
+ SetHealingFlag.populateHealingTable(ToolsUtil.getParam("v",args));
break;
case EXPORT:
ExportDataCommand.exportData(context,ToolsUtil.getParam("i",args));
break;
case IMPORT:
- ImportCommand.importData(context, ToolsUtil.getParam("f",args),ToolsUtil.getParam("i",args));
+ ImportDataCommand.execute(context, ToolsUtil.getParam("f",args));
break;
case HEAL_ALL:
HealAll.healAll(ToolsUtil.getParam("t",args));
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/ColumnDefinition.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/ColumnDefinition.java
new file mode 100644
index 0000000000..846392c1ab
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/ColumnDefinition.java
@@ -0,0 +1,84 @@
+/**
+ * Copyright © 2016-2017 European Support Limited.
+ */
+package org.openecomp.core.tools.model;
+
+import com.datastax.driver.core.ColumnDefinitions.Definition;
+import com.datastax.driver.core.DataType;
+
+import java.util.Arrays;
+
+public class ColumnDefinition {
+
+ private String keyspace;
+ private String table;
+ private String name;
+ private String type;
+
+ public ColumnDefinition() {
+ }
+
+ public ColumnDefinition(String keyspace, String table, String name, DataType type) {
+ this.keyspace = keyspace;
+ this.table = table;
+ this.name = name;
+ this.type = type.getName().toString();
+ }
+
+ public ColumnDefinition(Definition definition) {
+ this(definition.getKeyspace(), definition.getTable(), definition.getName(), definition.getType());
+ }
+
+ /**
+ * The name of the keyspace this column is part of.
+ *
+ * @return the name of the keyspace this column is part of.
+ */
+ public String getKeyspace() {
+ return keyspace;
+ }
+
+ /**
+ * Returns the name of the table this column is part of.
+ *
+ * @return the name of the table this column is part of.
+ */
+ public String getTable() {
+ return table;
+ }
+
+ /**
+ * Returns the name of the column.
+ *
+ * @return the name of the column.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the type of the column.
+ *
+ * @return the type of the column.
+ */
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public final int hashCode() {
+ return Arrays.hashCode(new Object[]{keyspace, table, name, type});
+ }
+
+ @Override
+ public final boolean equals(Object o) {
+ if (!(o instanceof ColumnDefinition))
+ return false;
+
+ ColumnDefinition other = (ColumnDefinition) o;
+ return keyspace.equals(other.keyspace)
+ && table.equals(other.table)
+ && name.equals(other.name)
+ && type.equals(other.type);
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java
new file mode 100644
index 0000000000..155f35c006
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/model/TableData.java
@@ -0,0 +1,12 @@
+/**
+ * Copyright © 2016-2017 European Support Limited.
+ */
+package org.openecomp.core.tools.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TableData {
+ public List<ColumnDefinition> definitions = new ArrayList<>();
+ public List<List<String>> rows = new ArrayList<>();
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/CassandraElementRepository.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/CassandraElementRepository.java
index c41b46ea14..fcc67e11d0 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/CassandraElementRepository.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/CassandraElementRepository.java
@@ -34,7 +34,12 @@ import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
import java.lang.reflect.Type;
import java.nio.ByteBuffer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
import java.util.stream.Collectors;
public class CassandraElementRepository {
@@ -61,18 +66,18 @@ public class CassandraElementRepository {
ElementEntity element) {
Row row = getElementAccessor(context).get(
elementContext.getSpace(),
- elementContext.getItemId().toString(),
+ elementContext.getItemId().getValue(),
getVersionId(elementContext),
- element.getId().toString()).one();
+ element.getId().getValue()).one();
return row == null ? Optional.empty() : Optional.of(getElementEntity(element, row));
}
private String getVersionId(ElementEntityContext elementContext) {
- return elementContext.getChangeRef() == null
- ? elementContext.getVersionId().toString()
- : elementContext.getChangeRef();
+ return elementContext.getRevisionId() == null
+ ? elementContext.getVersionId().getValue()
+ : elementContext.getRevisionId().getValue();
}
@@ -92,7 +97,7 @@ public class CassandraElementRepository {
private void updateElement(SessionContext context, ElementEntityContext elementContext,
ElementEntity element) {
- if (elementContext.getChangeRef() == null) {
+ if (elementContext.getRevisionId() == null) {
getElementAccessor(context).update(
JsonUtil.object2Json(element.getInfo()),
@@ -113,7 +118,7 @@ public class CassandraElementRepository {
element.getVisualization(),
elementContext.getSpace(),
elementContext.getItemId().toString(),
- elementContext.getChangeRef(),
+ elementContext.getRevisionId().getValue(),
element.getId().toString());
}
}
@@ -154,7 +159,7 @@ public class CassandraElementRepository {
getVersionId(elementContext)).one();
return row == null
? new HashSet<>()
- : row.getSet(CassandraElementRepository.VersionElementsField.ELEMENT_IDS, String.class);
+ : row.getSet(VersionElementsField.ELEMENT_IDS, String.class);
}
/*
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java
index 5c72c95f49..d8929ea720 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java
@@ -2,7 +2,6 @@ package org.openecomp.core.tools.store;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
@@ -11,23 +10,17 @@ public class ElementHandler {
private static final String GLOBAL_USER = "GLOBAL_USER";
public static void update(SessionContext context,
- String itemId, String versionId, String changeRef,
+ String itemId, String versionId, String revisionId,
ElementEntity elementEntity) {
ElementEntityContext elementContext;
CassandraElementRepository cassandraElementRepository = new CassandraElementRepository();
- if (changeRef == null) {
+ if (revisionId == null) {
elementContext = new ElementEntityContext(GLOBAL_USER, new Id(itemId),
- new Id(versionId));
+ new Id(versionId));
- } else {
- elementContext = new ElementEntityContext(GLOBAL_USER, new ElementContext(new Id(itemId),
- new Id(versionId),
- changeRef));
}
- cassandraElementRepository.update(context, elementContext, elementEntity);
-
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/HealingHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/HealingHandler.java
new file mode 100644
index 0000000000..78bbdf069e
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/HealingHandler.java
@@ -0,0 +1,54 @@
+package org.openecomp.core.tools.store;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.core.tools.store.zusammen.datatypes.HealingEntity;
+
+import java.util.ArrayList;
+
+/**
+ * Created by ayalaben on 10/15/2017
+ */
+public class HealingHandler {
+
+ private static NoSqlDb nnoSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static HealingAccessor accessor =
+ nnoSqlDb.getMappingManager().createAccessor(HealingAccessor.class);
+
+
+ public void populateHealingTable(ArrayList<HealingEntity> healingEntities) {
+ healingEntities.forEach(healingEntity -> {
+ if (isHealingRecordExist(healingEntity)) {
+ accessor.updateFlag(healingEntity.getHealingFlag(), healingEntity.getSpace(),
+ healingEntity.getItemId(), healingEntity.getVersionId());
+ } else {
+ accessor.create(healingEntity.getSpace(), healingEntity.getItemId(),
+ healingEntity.getVersionId(), healingEntity.getHealingFlag(),
+ healingEntity.getOldVersion());
+ }
+ });
+ }
+
+ private boolean isHealingRecordExist(HealingEntity healingEntity) {
+ return accessor.getFlag(healingEntity.getSpace(), healingEntity.getItemId(),
+ healingEntity.getVersionId()).getAvailableWithoutFetching() == 1;
+ }
+
+ @Accessor
+ interface HealingAccessor {
+
+ @Query("SELECT healing_needed FROM healing WHERE space=? AND item_id=? AND version_id=?")
+ ResultSet getFlag(String space, String itemId, String versionId);
+
+ @Query("Insert into healing (space, item_id, version_id, healing_needed, old_version) " +
+ "values (?,?,?,?,?)")
+ void create(String space, String itemId, String versionId, boolean flag, String oldVersion);
+
+ @Query("UPDATE healing SET healing_needed=? WHERE space=? AND item_id=? AND version_id=?")
+ void updateFlag(boolean flag, String space, String itemId, String versionId);
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java
index 851e92dcca..fd9dc25daa 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java
@@ -20,6 +20,7 @@
package org.openecomp.core.tools.store;
+import com.datastax.driver.core.ResultSet;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
@@ -60,6 +61,8 @@ public class VersionCassandraLoader {
return accessor.getAll();
}
+ public ResultSet listItemVersion() { return accessor.getAllItemVersion();}
+
@Accessor
interface VersionAccessor {
@@ -74,5 +77,8 @@ public class VersionCassandraLoader {
@Query("select * from zusammen_dox.version ")
@QueryParameters(fetchSize = 400)
Result<VersionEntity> getAll();
+
+ @Query("select space,item_id,version_id from zusammen_dox.version ")
+ ResultSet getAllItemVersion();
}
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java
index 1d9d2d9774..b8620b8283 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java
@@ -4,14 +4,13 @@ import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
-import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository;
import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Objects;
+import java.util.Optional;
public class VspGeneralLoader {
@@ -56,24 +55,24 @@ public class VspGeneralLoader {
for (Map.Entry<String, List<String>> entry : vspItemChangeRefssMap.entrySet()) {
- for (String changeRef : entry.getValue()) {
+ for (String revisionId : entry.getValue()) {
itemId = new Id(entry.getKey());
- entityId = getEntityIdByInfoNameValue(context, itemId, null, changeRef,null, NAME,
+ entityId = getEntityIdByInfoNameValue(context, itemId, null, revisionId,null, NAME,
GENERAL);
if (entityId != null) {
ElementEntityContext elementContext = new ElementEntityContext(
context.getUser().getUserName(),
itemId,
null);
- elementContext.setChangeRef(changeRef);
+ elementContext.setRevisionId(new Id(revisionId));
Optional<ElementEntity> result =
cassandraElementRepository.get(context, elementContext,
new ElementEntity(entityId));
if (result.isPresent()) {
- elementEntityMap.put(buildKey(context, entry, changeRef), result.get());
+ elementEntityMap.put(buildKey(context, entry, revisionId), result.get());
}
}
}
@@ -90,7 +89,7 @@ public class VspGeneralLoader {
private static Id getEntityIdByInfoNameValue(SessionContext context,
Id itemId,
Id versionId,
- String changeRef,
+ String revisionId,
Id elementId,
String name,
String value) {
@@ -100,8 +99,8 @@ public class VspGeneralLoader {
context.getUser().getUserName(),
itemId,
versionId);
- if (changeRef != null) {
- elementContext.setChangeRef(changeRef);
+ if (revisionId != null) {
+ elementContext.setRevisionId(new Id(revisionId));
}
Optional<ElementEntity> result =
cassandraElementRepository.get(context, elementContext,
@@ -113,8 +112,8 @@ public class VspGeneralLoader {
context.getUser().getUserName(),
itemId,
versionId);
- if(changeRef!= null){
- subElementContext.setChangeRef(changeRef);
+ if(revisionId!= null){
+ subElementContext.setRevisionId(new Id(revisionId));
}
Optional<ElementEntity> subElementEntityOptional =
cassandraElementRepository.get(context, subElementContext,
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntity.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntity.java
new file mode 100644
index 0000000000..8c95f795a6
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntity.java
@@ -0,0 +1,78 @@
+package org.openecomp.core.tools.store.zusammen.datatypes;
+
+import com.datastax.driver.mapping.annotations.Column;
+import com.datastax.driver.mapping.annotations.PartitionKey;
+import com.datastax.driver.mapping.annotations.Table;
+
+/**
+ * Created by ayalaben on 10/15/2017
+ */
+@Table(keyspace = "dox", name = "healing")
+public class HealingEntity {
+ @Column(name = "space")
+ @PartitionKey(0)
+ private String space;
+
+ @Column(name = "item_id")
+ @PartitionKey(1)
+ private String itemId;
+
+ @Column(name = "version_id")
+ @PartitionKey(2)
+ private String versionId;
+
+ @Column(name = "healing_needed")
+ private boolean healingFlag;
+
+ @Column(name = "old_version")
+ private String old_version;
+
+ public String getSpace() {
+ return space;
+ }
+
+ public void setSpace(String space) {
+ this.space = space;
+ }
+
+ public String getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(String itemId) {
+ this.itemId = itemId;
+ }
+
+ public String getVersionId() {
+ return versionId;
+ }
+
+ public void setVersionId(String versionId) {
+ this.versionId = versionId;
+ }
+
+ public boolean getHealingFlag() {
+ return healingFlag;
+ }
+
+ public void setHealingFlag(boolean healingFlag) {
+ this.healingFlag = healingFlag;
+ }
+
+ public HealingEntity(String space, String itemId, String versionId, boolean healingFlag,String
+ oldVersion) {
+ this.space = space;
+ this.itemId = itemId;
+ this.versionId = versionId;
+ this.healingFlag = healingFlag;
+ this.old_version = oldVersion;
+ }
+
+ public String getOldVersion() {
+ return old_version;
+ }
+
+ public void setOldVersion(String old_version) {
+ this.old_version = old_version;
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java
index c7280c8a9d..946c05ef84 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java
@@ -1,6 +1,8 @@
package org.openecomp.core.tools.store.zusammen.datatypes;
-import com.datastax.driver.mapping.annotations.*;
+import com.datastax.driver.mapping.annotations.Column;
+import com.datastax.driver.mapping.annotations.PartitionKey;
+import com.datastax.driver.mapping.annotations.Table;
import java.util.Date;
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java
index d1621ad672..f48b212327 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java
@@ -3,13 +3,36 @@ package org.openecomp.core.tools.util;
import org.openecomp.sdc.logging.api.Logger;
/**
+ * Copyright © 2016-2017 European Support Limited.
* @author Avrahamg
* @since April 24, 2017
+ * Since it is a command line tools writing to console will be helpful to users.
*/
public class Utils {
public static void printMessage(Logger logger, String message) {
+ /**
+ * Since it is a command line tools writing to console will be helpful to users.
+ */
System.out.println(message);
logger.debug(message);
}
+
+
+ public static void logError(Logger logger, Throwable ex) {
+ /**
+ * Since it is a command line tools writing to console will be helpful to users.
+ */
+ ex.printStackTrace();
+ logger.error(ex.getMessage(),ex);
+ }
+
+ public static void logError(Logger logger, String message, Throwable ex) {
+ /**
+ * Since it is a command line tools writing to console will be helpful to users.
+ */
+ System.out.println(message);
+ ex.printStackTrace();
+ logger.error(message,ex);
+ }
}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java
index 2f6693d133..e0fd1a7535 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java
@@ -1,13 +1,17 @@
package org.openecomp.core.tools.util;
import com.google.common.io.ByteStreams;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Objects;
import java.util.Scanner;
import java.util.Set;
@@ -17,12 +21,23 @@ import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
public class ZipUtils {
- public static void createZip(String zipFileName, Path dir, Set<String> filterItem) throws Exception {
+
+ private static final Logger logger = LoggerFactory.getLogger(ZipUtils.class);
+
+ public static void createZip(String zipFileName, Path dir) throws IOException {
File dirObj = dir.toFile();
+ Path zippedFile = Files.createFile(Paths.get(zipFileName));
try (
- FileOutputStream fileOutputStream = new FileOutputStream(zipFileName);
- ZipOutputStream out = new ZipOutputStream(fileOutputStream)) {
- addDir(dirObj, out, dir.toString(), filterItem);
+ FileOutputStream fileOutputStream = new FileOutputStream(File.separator + zippedFile.toFile());
+ BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);
+ ZipOutputStream out = new ZipOutputStream(bos)) {
+ File[] files = dirObj.listFiles();
+ for (File file : files) {
+ out.putNextEntry(new ZipEntry(file.getName()));
+ Files.copy(Paths.get(file.getPath()), out);
+ out.closeEntry();
+ }
+ Utils.printMessage(logger, "Zip file was created " + zipFileName);
}
}
@@ -47,7 +62,7 @@ public class ZipUtils {
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
addDir(files[i], out, root, filterItem);
- String filePath = files[i].getAbsolutePath().replace(root + File.separator, "") + "/";
+ String filePath = files[i].getAbsolutePath().replace(root + File.separator, "") + File.separator;
out.putNextEntry(new ZipEntry(filePath));
continue;
}
@@ -57,7 +72,6 @@ public class ZipUtils {
out.putNextEntry(new ZipEntry(filePath));
try {
ByteStreams.copy(in, out);
-
} finally {
out.closeEntry();
}
@@ -71,7 +85,7 @@ public class ZipUtils {
if (zipFile == null || outputFolder == null) {
return;
}
- if (!Files.exists(outputFolder)) {
+ if (!outputFolder.toFile().exists()) {
Files.createDirectories(outputFolder);
}
@@ -83,7 +97,7 @@ public class ZipUtils {
File newFile = new File(outputFolder.toString() + File.separator + fileName);
if (ze.isDirectory()) {
Path path = newFile.toPath();
- if (!Files.exists(path)) {
+ if (!path.toFile().exists()) {
Files.createDirectories(path);
}
} else {
diff --git a/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml b/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml
index a13dc82e22..2461aed504 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml
+++ b/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml
@@ -1,5 +1,6 @@
<configuration>
+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
diff --git a/openecomp-be/tools/zusammen-tools/src/main/resources/queries.yaml b/openecomp-be/tools/zusammen-tools/src/main/resources/queries.yaml
new file mode 100644
index 0000000000..a93a5a46e8
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/resources/queries.yaml
@@ -0,0 +1,16 @@
+queries:
+ - select * from zusammen_dox.element;
+ - select * from zusammen_dox.element_namespace;
+ - select * from zusammen_dox.item;
+ - select * from zusammen_dox.version;
+ - select * from zusammen_dox.version_elements;
+ - select * from dox.item_permissions;
+ - select * from dox.vsp_merge_hint ;
+item_columns:
+ - item_id
+ - item_id
+ - item_id
+ - item_id
+ - item_id
+ - item_id
+ - item_id \ No newline at end of file
diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java
new file mode 100644
index 0000000000..7b43c4624f
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java
@@ -0,0 +1,48 @@
+package org.openecomp.core.tools.Commands.exportinfo.serialize;
+
+import org.openecomp.core.tools.exportinfo.ExportSerializer;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+public class VLMExtractTest {
+
+
+
+ @Test
+ public void extractVLM(){
+ String vlmId = "979a56c7b2fa41e6a5742137f53a5c1b";
+ String elemenet_info_string = "{\n" +
+ " \"name\": \"VendorSoftwareProduct\",\n" +
+ " \"properties\": {\n" +
+ " \"subCategory\": \"resourceNewCategory.dcae component.collector\",\n" +
+ " \"name\": \"vsp1\",\n" +
+ " \"icon\": \"icon\",\n" +
+ " \"onboardingMethod\": \"NetworkPackage\",\n" +
+ " \"description\": \"d\",\n" +
+ " \"vendorId\": \""+vlmId+"\",\n" +
+ " \"category\": \"resourceNewCategory.dcae component\",\n" +
+ " \"vendorName\": \"vlm1\",\n" +
+ " \"elementType\": \"VendorSoftwareProduct\"\n" +
+ " }\n" +
+ "}\n" ;
+ String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string);
+ assertNotNull(extractedVlmId);
+ assertEquals(extractedVlmId,vlmId);
+
+ }
+
+ @Test
+ public void failToExtractVLMBecauseJsonIsCorrupted(){
+ String elemenet_info_string = "gfhhhghgh";
+ String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string);
+ assertNull(extractedVlmId);
+ }
+
+ private static final class CustomExportSerializer extends ExportSerializer{
+ public String extractVlm(String injson) {
+ return super.extractVlm(injson);
+ }
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/test/resources/configuration.yaml b/openecomp-be/tools/zusammen-tools/src/test/resources/configuration.yaml
new file mode 100644
index 0000000000..6636e20726
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/test/resources/configuration.yaml
@@ -0,0 +1,251 @@
+identificationHeaderFields:
+ - HTTP_IV_USER
+ - HTTP_CSP_FIRSTNAME
+ - HTTP_CSP_LASTNAME
+ - HTTP_IV_REMOTE_ADDRESS
+ - HTTP_CSP_WSTYPE
+
+
+
+# catalog backend http port
+beHttpPort: 8080
+
+# catalog backend http context
+beContext: /sdc/rest/config/get
+
+# catalog backend protocol
+beProtocol: http
+
+# catalog backend ssl port
+beSslPort: 8443
+
+version: 1.0
+released: 2012-11-30
+
+titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties
+titanInMemoryGraph: false
+titanLockTimeout: 30
+titanReconnectIntervalInSeconds: 3
+titanHealthCheckReadTimeout: 1
+esReconnectIntervalInSeconds: 3
+uebHealthCheckReconnectIntervalInSeconds: 15
+uebHealthCheckReadTimeout: 4
+
+# Protocols
+protocols:
+ - http
+ - https
+
+# Users
+users:
+ tom: passwd
+ bob: passwd
+
+neo4j:
+ host: neo4jhost
+ port: 7474
+ user: neo4j
+ password: "12345"
+
+cassandraConfig:
+ cassandraHosts: ['localhost']
+ reconnectTimeout : 30000
+ authenticate: true
+ username: asdc_user
+ password: password
+ ssl: false
+ truststorePath : /path/path
+ truststorePassword : password
+ keySpaces:
+ - { name: dox, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
+ - { name: zusammen_dox, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
+ - { name: sdcartifact, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
+
+#Application-specific settings of ES
+elasticSearch:
+ # Mapping of index prefix to time-based frame. For example, if below is configured:
+ #
+ # - indexPrefix: auditingevents
+ # creationPeriod: minute
+ #
+ # then ES object of type which is mapped to "auditingevents-*" template, and created on 2015-12-23 13:24:54, will enter "auditingevents-2015-12-23-13-24" index.
+ # Another object created on 2015-12-23 13:25:54, will enter "auditingevents-2015-12-23-13-25" index.
+ # If creationPeriod: month, both of the above will enter "auditingevents-2015-12" index.
+ #
+ # PLEASE NOTE: the timestamps are created in UTC/GMT timezone! This is needed so that timestamps will be correctly presented in Kibana.
+ #
+ # Legal values for creationPeriod - year, month, day, hour, minute, none (meaning no time-based behaviour).
+ #
+ # If no creationPeriod is configured for indexPrefix, default behavour is creationPeriod: month.
+
+ indicesTimeFrequency:
+ - indexPrefix: auditingevents
+ creationPeriod: month
+ - indexPrefix: monitoring_events
+ creationPeriod: month
+
+artifactTypes:
+ - CHEF
+ - PUPPET
+ - SHELL
+ - YANG
+ - YANG_XML
+ - HEAT
+ - BPEL
+ - DG_XML
+ - MURANO_PKG
+ - OTHER
+
+licenseTypes:
+ - User
+ - Installation
+ - CPU
+
+#Deployment artifacts placeHolder
+deploymentResourceArtifacts:
+ heat:
+ displayName: "HEAT Template"
+ type: HEAT
+
+deploymentResourceInstanceArtifacts:
+ heatEnv:
+ displayName: "HEAT ENV"
+ type: HEAT_ENV
+ description: "Auto-generated HEAT Environment deployment artifact"
+ fileExtension: "env"
+
+#Informational artifacts placeHolder
+excludeResourceCategory:
+ - Generic
+informationalResourceArtifacts:
+ features:
+ displayName: Features
+ type: OTHER
+ capacity:
+ displayName: Capacity
+ type: OTHER
+ vendorTestResult:
+ displayName: Vendor Test Result
+ type: OTHER
+ testScripts:
+ displayName: Test Scripts
+ type: OTHER
+ cloudQuestionnaire:
+ displayName: Cloud Questionnaire (completed)
+ type: OTHER
+ HEATTemplateFromVendor:
+ displayName: HEAT Template from Vendor
+ type: HEAT
+
+excludeServiceCategory:
+
+informationalServiceArtifacts:
+ messageFlows:
+ displayName: Message Flows
+ type: OTHER
+ instantiationFlows:
+ displayName: Management Flows
+ type: OTHER
+ serviceArtifactPlan:
+ displayName: Service Artifact Plan
+ type: OTHER
+ summaryOfImpactsToECOMPElements:
+ displayName: Summary of impacts to OPENECOMP elements,OSSs, BSSs
+ type: OTHER
+ controlLoopFunctions:
+ displayName: Control Loop Functions
+ type: OTHER
+ dimensioningInfo:
+ displayName: Dimensioning Info
+ type: OTHER
+ affinityRules:
+ displayName: Affinity Rules
+ type: OTHER
+ operationalPolicies:
+ displayName: Operational Policies
+ type: OTHER
+ serviceSpecificPolicies:
+ displayName: Service-specific Policies
+ type: OTHER
+ engineeringRules:
+ displayName: Engineering Rules (ERD)
+ type: OTHER
+ distributionInstructions:
+ displayName: Distribution Instructions
+ type: OTHER
+ certificationTestResults:
+ displayName: TD Certification Test Results
+ type: OTHER
+ deploymentVotingRecord:
+ displayName: Deployment Voting Record
+ type: OTHER
+ serviceQuestionnaire:
+ displayName: Service Questionnaire
+ type: OTHER
+
+serviceApiArtifacts:
+ configuration:
+ displayName: Configuration
+ type: OTHER
+ instantiation:
+ displayName: Instantiation
+ type: OTHER
+ monitoring:
+ displayName: Monitoring
+ type: OTHER
+ reporting:
+ displayName: Reporting
+ type: OTHER
+ logging:
+ displayName: Logging
+ type: OTHER
+ testing:
+ displayName: Testing
+ type: OTHER
+
+
+additionalInformationMaxNumberOfKeys: 50
+
+systemMonitoring:
+ enabled: false
+ isProxy: false
+ probeIntervalInSeconds: 15
+
+defaultHeatArtifactTimeoutMinutes: 60
+
+serviceDeploymentArtifacts:
+
+resourceDeploymentArtifacts:
+ HEAT:
+ acceptedTypes:
+ - yaml
+ - yml
+
+resourceInformationalDeployedArtifacts:
+ YANG_XML:
+ acceptedTypes:
+ - xml
+
+
+unLoggedUrls:
+ - /sdc2/rest/healthCheck
+
+cleanComponentsConfiguration:
+ cleanIntervalInMinutes: 1440
+ componentsToClean:
+ - Resource
+
+artifactsIndex: resources
+
+heatEnvArtifactHeader:
+ " # _______________________________________________________________________________________________________________________________________\n
+ #| AT&T Proprietary (Restricted) |\n
+ #| Only for use by authorized individuals or any above-designated team(s) |\n
+ #| within the AT&T companies and not for general distribution |\n
+ #|_______________________________________________________________________________________________________________________________________|\n"
+heatEnvArtifactFooter:
+ " # _______________________________________________________________________________________________________________________________________\n
+ #| AT&T Proprietary (Restricted) |\n
+ #| Only for use by authorized individuals or any above-designated team(s) |\n
+ #| within the AT&T companies and not for general distribution |\n
+ #|_______________________________________________________________________________________________________________________________________|\n"
diff --git a/openecomp-be/tools/zusammen-tools/src/test/resources/queries.yaml b/openecomp-be/tools/zusammen-tools/src/test/resources/queries.yaml
new file mode 100644
index 0000000000..6ca8cd6efe
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/test/resources/queries.yaml
@@ -0,0 +1,16 @@
+queries:
+ - select * from zusammen_dox.element;
+ - select * from zusammen_dox.element_namespace;
+ - select * from zusammen_dox.item;
+ - select * from zusammen_dox.version;
+ - select * from zusammen_dox.version_elements;
+ - select * from dox.item_permissions;
+ - select * from dox.vsp_merge_hint;
+item_columns:
+ - item_id
+ - item_id
+ - item_id
+ - item_id
+ - item_id
+ - item_id
+ - item_id \ No newline at end of file