dialect_lookup 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/dialect_lookup.gemspec +22 -0
- data/lib/dialect_lookup.rb +111 -0
- data/lib/lookup/constructors/DockedGroupings2AppFunctions.rb +27 -0
- data/lib/lookup/constructors/Element2ModSend.rb +27 -0
- data/lib/lookup/constructors/ElementsInElements.rb +27 -0
- data/lib/lookup/data/1.ModReceive2GetData.rb +28 -0
- data/lib/lookup/data/2.GetData2Elements.rb +28 -0
- data/lib/lookup/data/3.GenData2Dest.rb +28 -0
- data/lib/lookup/data/4.Results2GenData.rb +28 -0
- data/lib/lookup/functional/1.Expect2Events.rb +27 -0
- data/lib/lookup/functional/2.1.Events2AppEvent.rb +27 -0
- data/lib/lookup/functional/2.2.1.Events2ModReceive.rb +27 -0
- data/lib/lookup/functional/2.2.2.ModReceive2AppEvent.rb +27 -0
- data/lib/lookup/functional/3.Appevent2EventBus.rb +27 -0
- data/lib/lookup/functional/4.1.AppEvent2Elements.rb +27 -0
- data/lib/lookup/functional/4.2.Elements2AppEvent.rb +27 -0
- data/lib/lookup/functional/5.1.Element2ModElements.rb +27 -0
- data/lib/lookup/functional/5.2.Element2ModSend.rb +26 -0
- data/lib/lookup/functional/6.ModElementsSpecs.rb +27 -0
- data/lib/lookup/functional/7.ElementChains.rb +27 -0
- data/lib/lookup.rb +149 -0
- data/lib/sql.rb +138 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c21001861f311995fb7349aa86d892adf16d9efe46997b91dcde3353eff38e85
|
4
|
+
data.tar.gz: 21bfee114f954b4566f4786e793dee6b7d5164663b4024d85bab53ce23190219
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7dfa96e3f85d0a76e95b6ae1fa68222467fa800c7afd480efe04b318e16bf8df5a32bd1e35beed25e5e9f921f2f62ab1c592425b7603b3db705bbc5b2b826d3b
|
7
|
+
data.tar.gz: c682c0dec5e7871473a6197cb86a890770c70e803f59ff5bd3cb7c849c1099aabc18f3f765429e5adbff72dacb3ca3c58fc445415c433563f6f0a19a6f943820
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'dialect_lookup'.freeze
|
7
|
+
s.version = '0.0.1'
|
8
|
+
s.authors = ['Eugene Istomin'.freeze]
|
9
|
+
s.email = ['info@innosense.org'.freeze]
|
10
|
+
|
11
|
+
s.homepage = 'https://github.com/ArchDelivery/Dialog'.freeze
|
12
|
+
s.description = 'Dialect lookup'.freeze
|
13
|
+
s.summary = 'Dialect lookup'.freeze
|
14
|
+
|
15
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
s.bindir = 'exe'
|
17
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
s.require_paths = ['lib'.freeze]
|
19
|
+
|
20
|
+
s.add_runtime_dependency 'sqlite3', '~> 0'
|
21
|
+
s.add_runtime_dependency 'oj', '~> 0'
|
22
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
#Gems
|
16
|
+
require 'sqlite3'
|
17
|
+
|
18
|
+
#Files
|
19
|
+
require 'sql'
|
20
|
+
require 'lookup'
|
21
|
+
Dir[File.join(__dir__, 'lookup/**', '*.rb')].each { |file| require_relative file }
|
22
|
+
|
23
|
+
def run(state)
|
24
|
+
|
25
|
+
args = {views: {}, con_views: {}, exec: {}, stages: {} }
|
26
|
+
state.has_key?(:sqlite) ? db = state[:sqlite] : db = "/tmp/dialect.sqlite"
|
27
|
+
state[:dbhandler] = SQLite3::Database.new db
|
28
|
+
|
29
|
+
###functional views
|
30
|
+
folderMain = state[:dbhandler].execute("select id from folders where name in ('#{state[:dialectFolder]}')")[0][0]
|
31
|
+
folderId = state[:dbhandler].execute("select folder_id from folders_in_model where parent_folder_id in ('#{folderMain}') and model_version = (select max(model_version) from folders_in_model where parent_folder_id in ('#{folderMain}')) and folder_version = (select max(folder_version) from folders_in_model where parent_folder_id in ('#{folderMain}'))").each do |conFolder|
|
32
|
+
folderDialog = state[:dbhandler].execute("select id from folders where name in ('Dialog') and id in ('#{conFolder[0]}')")[0]
|
33
|
+
if folderDialog.is_a?(Array)
|
34
|
+
state[:dbhandler].execute("select view_id as view_id2, view_version, model_version from views_in_model where parent_folder_id in ('#{folderDialog[0]}') and model_version = (select max(model_version) from views_in_model where view_id in (view_id2))") do |row|
|
35
|
+
viewAtr = state[:dbhandler].execute("select name, version from views where id in ('#{row[0]}') and version = (select max(version) from views where id in ('#{row[0]}'))")
|
36
|
+
if row[1] == viewAtr[0][1]
|
37
|
+
id = row[0].tr("-", "_")
|
38
|
+
|
39
|
+
args[:views][id] ||= {}
|
40
|
+
args[:views][id][:version] = row[1]
|
41
|
+
args[:views][id][:name] = state[:dialectFolder]
|
42
|
+
Dialog.logger.info "Dialect functional view '#{viewAtr[0][0]}' (id #{id}, view ver.#{row[1]}, model ver.#{row[2]}) of folder '#{Dialog.config.dialect.folder}' for bot '#{Dialog.config.naming.instance}' suits for me!"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
###_constructors views
|
51
|
+
folderId = state[:dbhandler].execute("select id from folders where name in ('_constructors')")[0][0]
|
52
|
+
constructorFolders = state[:dbhandler].execute("select folder_id, folder_version, model_version from folders_in_model where parent_folder_id in ('#{folderId}') and model_version = (select max(model_version) from folders_in_model where parent_folder_id in ('#{folderId}')) and folder_version = (select max(folder_version) from folders_in_model where parent_folder_id in ('#{folderId}'))").each do |conFolder|
|
53
|
+
|
54
|
+
state[:dbhandler].execute("select view_id as view_id2, view_version, model_version from views_in_model where parent_folder_id in ('#{conFolder[0]}') and model_version = (select max(model_version) from views_in_model where view_id in (view_id2))") do |row|
|
55
|
+
viewAtr = state[:dbhandler].execute("select name, version from views where id in ('#{row[0]}') and version = (select max(version) from views where id in ('#{row[0]}'))")
|
56
|
+
id = row[0].tr("-", "_")
|
57
|
+
|
58
|
+
args[:con_views][id] ||= {}
|
59
|
+
args[:con_views][id][:version] = row[1]
|
60
|
+
args[:con_views][id][:name] = state[:dialectFolder]
|
61
|
+
Dialog.logger.info "Dialect constructor view '#{viewAtr[0][0]}' (id #{id}, view ver.#{row[1]}, model ver.#{row[2]}) suits for me!"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
args[:stages][state[:dialectFolder]] = {}
|
67
|
+
args[:stages][state[:dialectFolder]] = {codegenGlobal: {}, codegenPerView: {}, x: {}, panView: {lookup: {}}, perView: {}, constructor: {}}
|
68
|
+
|
69
|
+
getObjects(args, state)
|
70
|
+
|
71
|
+
|
72
|
+
args[:con_views].each do |viewId, viewProps|
|
73
|
+
viewType = :constructors
|
74
|
+
lookup_constructors_DockedGroupings2AppFunctions(args, state, viewId, viewType)
|
75
|
+
lookup_constructors_Element2ModSend(args, state, viewId, viewType)
|
76
|
+
lookup_constructors_ElementsInElements(args, state, viewId, viewType)
|
77
|
+
end
|
78
|
+
|
79
|
+
args[:views].each do |viewId, viewProps|
|
80
|
+
viewType = :perView
|
81
|
+
fullName = "#{state[:dialectFolder]}_#{viewId}"
|
82
|
+
fullNameSym = fullName.to_sym
|
83
|
+
Dialog.logger.debug "#Dialect_lookup RUN instance #{state[:dialectFolder]}"
|
84
|
+
###functional
|
85
|
+
lookupStruct = {'functional' => [
|
86
|
+
'Expect2Events', 'Events2AppEvent', 'Events2ModReceive', 'ModReceive2AppEvent',
|
87
|
+
'Appevent2EventBus', 'AppEvent2Elements', 'Elements2AppEvent', 'Element2ModElements',
|
88
|
+
'Element2ModSend', 'ModElementsSpecs', 'ElementChains']}
|
89
|
+
#1
|
90
|
+
lookup_run(args, lookupStruct, state, viewId, viewType)
|
91
|
+
|
92
|
+
###data
|
93
|
+
lookupStruct = {'data' => [
|
94
|
+
'ModReceive2GetData', 'GetData2Elements', 'GenData2Dest', 'Results2GenData']}
|
95
|
+
#1
|
96
|
+
lookup_run(args, lookupStruct, state, viewId, viewType)
|
97
|
+
###
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
state[:dbhandler].close
|
102
|
+
json = Oj.dump(args)
|
103
|
+
# File.delete(db)
|
104
|
+
FileUtils.mkdir_p("#{state[:jsonFolder]}")
|
105
|
+
FileUtils.rm_rf(Dir.glob("#{state[:jsonFolder]}/*.json"))
|
106
|
+
jsonDump = "#{state[:jsonFolder]}/#{state[:dialectFolder]}_#{state[:myAppName]}.json"
|
107
|
+
File.open(jsonDump, 'w') { |file| file.write(json) }
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_constructors_DockedGroupings2AppFunctions(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_constructors_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'CompositionRelationship', fPropKey: :docked, fPropValue: "true",
|
19
|
+
fClass: 'Grouping', fFqn: "#{state[:myAppName]}Element*",
|
20
|
+
tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Element*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
# dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_constructors_Element2ModSend(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_constructors_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*",
|
20
|
+
tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModSend*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_constructors_ElementsInElements(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_constructors_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'SpecializationRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*",
|
20
|
+
tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Element*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
# dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_data_ModReceive2GetData(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_data_'; queryName.to_sym
|
18
|
+
|
19
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship',
|
20
|
+
fClass: 'ApplicationService', fFqn: "#{state[:myAppName]}ArchiGetdata*",
|
21
|
+
tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModReceiveData*" }
|
22
|
+
|
23
|
+
dialectLookup(args, state, viewId, viewType)
|
24
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_data_GetData2Elements(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_data_'; queryName.to_sym
|
18
|
+
|
19
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'TriggeringRelationship',
|
20
|
+
fClass: 'ApplicationService', fFqn: "#{state[:myAppName]}ArchiGetdata*",
|
21
|
+
tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Element*" }
|
22
|
+
|
23
|
+
dialectLookup(args, state, viewId, viewType)
|
24
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_data_GenData2Dest(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_data_'; queryName.to_sym
|
18
|
+
|
19
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'ServingRelationship',
|
20
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*",
|
21
|
+
tClass: 'ApplicationService', tFqn: "#{state[:myAppName]}ArchiGendata*" }
|
22
|
+
|
23
|
+
dialectLookup(args, state, viewId, viewType)
|
24
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_data_Results2GenData(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_data_'; queryName.to_sym
|
18
|
+
|
19
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'RealizationRelationship',
|
20
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*",
|
21
|
+
tClass: 'ApplicationService', tFqn: "#{state[:myAppName]}ArchiGendata*" }
|
22
|
+
|
23
|
+
dialectLookup(args, state, viewId, viewType)
|
24
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_Expect2Events(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AggregationRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}ArchiEventExpect",
|
20
|
+
tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Event*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_Events2AppEvent(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'FlowRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Event*",
|
20
|
+
tClass: 'ApplicationEvent', tFqn: "#{state[:myAppName]}ArchiAppevent*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_Events2ModReceive(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Event*",
|
20
|
+
tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModReceiveData*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_ModReceive2AppEvent(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship',
|
19
|
+
fClass: 'ApplicationEvent', fFqn: "#{state[:myAppName]}ArchiAppevent*",
|
20
|
+
tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModReceiveData*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_Appevent2EventBus(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'ServingRelationship',
|
19
|
+
fClass: 'ApplicationService', fFqn: "#{state[:myAppName]}ArchiEventBus",
|
20
|
+
tClass: 'ApplicationEvent', tFqn: "#{state[:myAppName]}ArchiAppevent*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_AppEvent2Elements(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'TriggeringRelationship',
|
19
|
+
fClass: 'ApplicationEvent', fFqn: "#{state[:myAppName]}ArchiAppevent*",
|
20
|
+
tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Element*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_Elements2AppEvent(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'ServingRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*",
|
20
|
+
tClass: 'ApplicationEvent', tFqn: "#{state[:myAppName]}ArchiAppevent*"}
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_Element2ModElements(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*",
|
20
|
+
tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModElement*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_Element2ModSend(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*",
|
20
|
+
tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModSend*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_ModElementsSpecs(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'SpecializationRelationship',
|
19
|
+
fClass: 'DataObject', fFqn: "#{state[:myAppName]}ModSend*",
|
20
|
+
tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModElement*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def lookup_functional_ElementChains(args, state, viewId, viewType)
|
17
|
+
queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym
|
18
|
+
args[:dialectLookupQuery] = {queryName: queryName, cClass: 'TriggeringRelationship',
|
19
|
+
fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}ElementSend*",
|
20
|
+
tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}ElementSend*" }
|
21
|
+
|
22
|
+
dialectLookup(args, state, viewId, viewType)
|
23
|
+
dialectRepack(args, state, viewId, viewType, queryName)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/lib/lookup.rb
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def dialectLookup(args,state,viewId,viewType)
|
17
|
+
queryName = args[:dialectLookupQuery][:queryName]
|
18
|
+
if args[:objects][viewId][:links][args[:dialectLookupQuery][:cClass]].is_a?(Hash)
|
19
|
+
args[:objects][viewId][:links][args[:dialectLookupQuery][:cClass]].each do |conPairId, conProp|
|
20
|
+
|
21
|
+
|
22
|
+
if conProp[:viewID] == viewId and
|
23
|
+
conProp[:fClass] =~ /^#{args[:dialectLookupQuery][:fClass]}/ and
|
24
|
+
conProp[:fFqn] =~ /^#{args[:dialectLookupQuery][:fFqn]}/ and
|
25
|
+
conProp[:tClass] =~ /^#{args[:dialectLookupQuery][:tClass]}/ and
|
26
|
+
conProp[:tFqn] =~ /^#{args[:dialectLookupQuery][:tFqn]}/
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
conProp[:cClass] = args[:dialectLookupQuery][:cClass]
|
31
|
+
prop = getProp(args,state,conProp,'from')
|
32
|
+
conProp[:fProp] = prop if not prop.nil?
|
33
|
+
prop = getProp(args,state,conProp,'to')
|
34
|
+
conProp[:tProp] = prop if not prop.nil?
|
35
|
+
|
36
|
+
if args[:dialectLookupQuery].has_key?(:fPropKey)
|
37
|
+
conProp[:fProp][args[:dialectLookupQuery][:fPropKey]] == args[:dialectLookupQuery][:fPropValue] ? store = true : store = false
|
38
|
+
else
|
39
|
+
store = true
|
40
|
+
end
|
41
|
+
|
42
|
+
if store == true
|
43
|
+
# Dialog.logger.debug "In view #{viewId} by query '#{queryName}' we have a #{args[:dialectLookupQuery][:cClass]} connection: CONNPARID #{conPairId} FROM fClass = #{conProp[:fClass]} fqn = #{conProp[:fFqn]} fId = #{conProp[:fId]} NAME #{conProp[:fName]} FPROP #{conProp[:fProp]} [[ TO ]] tClass = #{conProp[:tClass]} fqn = #{conProp[:tFqn]} tId = #{conProp[:tId]} NAME #{conProp[:tName]} TPROP #{conProp[:tProp]}\n"
|
44
|
+
|
45
|
+
hash_fName = Digest::SHA256.hexdigest("#{conProp[:fName]}")[0..20]
|
46
|
+
hash_tName = Digest::SHA256.hexdigest("#{conProp[:tName]}")[0..20]
|
47
|
+
hash_fName_fId_tId = Digest::SHA256.hexdigest("#{conProp[:fName]}#{conProp[:fOID]}#{conProp[:tOID]}")[0..20]
|
48
|
+
# puts conProp
|
49
|
+
args[:stages][state[:dialectFolder]][viewType] ||= {}
|
50
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]] ||= {}
|
51
|
+
case viewType
|
52
|
+
when :perView
|
53
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId] ||= {}
|
54
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName] ||= {}
|
55
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName][:lookup] ||= {}
|
56
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName][:lookup][hash_tName] ||= {}
|
57
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName][:lookup][hash_tName][hash_fName_fId_tId] = conProp
|
58
|
+
when :constructors
|
59
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]] ||= {}
|
60
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName] ||= {}
|
61
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName][:lookup] ||= {}
|
62
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName][:lookup][hash_tName] ||= {}
|
63
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName][:lookup][hash_tName][hash_fName_fId_tId] = conProp
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
def getProp(args,state,conProp,direction)
|
75
|
+
rows = {}
|
76
|
+
|
77
|
+
case direction
|
78
|
+
when 'from'
|
79
|
+
eID = conProp[:fEID]
|
80
|
+
eVer = conProp[:fEVer]
|
81
|
+
when 'to'
|
82
|
+
eID = conProp[:tEID]
|
83
|
+
eVer = conProp[:tEVer]
|
84
|
+
end
|
85
|
+
|
86
|
+
state[:dbhandler].execute( "
|
87
|
+
select name, value
|
88
|
+
from properties
|
89
|
+
where parent_id like '#{eID}' AND
|
90
|
+
parent_version = '#{eVer}' AND
|
91
|
+
name NOT LIKE 'fqn'
|
92
|
+
") do |row|
|
93
|
+
# Bot.logger.debug "### ROW #{eID} #: #{row}"
|
94
|
+
# rows[eID] ||= {}
|
95
|
+
rows[row[0].to_sym] = row[1]
|
96
|
+
end
|
97
|
+
return rows if not rows.empty?
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
def dialectRepack(args, state, viewId, viewType, queryName)
|
102
|
+
|
103
|
+
case viewType
|
104
|
+
when :perView
|
105
|
+
base = args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName]
|
106
|
+
when :constructors
|
107
|
+
base = args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName]
|
108
|
+
end
|
109
|
+
if base.is_a?(Hash)
|
110
|
+
repackNames = [:fFqn, :tFqn, :fOID, :tOID, :fEID, :tEID]
|
111
|
+
base[:repack] = {}
|
112
|
+
repackNames.each do |repackName|
|
113
|
+
res = {}
|
114
|
+
base[:repack][repackName] ||= {}
|
115
|
+
base[:lookup].each do |tName, hash_tNameProp|
|
116
|
+
hash_tNameProp.each do |fName, hash_fNameProp|
|
117
|
+
res[hash_fNameProp[repackName]] = hash_fNameProp
|
118
|
+
end
|
119
|
+
end
|
120
|
+
case viewType
|
121
|
+
when :perView
|
122
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName][:repack][repackName] = res
|
123
|
+
when :constructors
|
124
|
+
args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName][:repack][repackName] = res
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
def lookupDebug(name, prop)
|
132
|
+
Bot.logger.debug "### #{name} :: F:: '#{prop[:fName]}' fqn:#{prop[:fFqn]} o:#{prop[:fOID]} e:#{prop[:fEID]} p '#{prop[:fProp]}' :: T :: '#{prop[:tName]}' fqn:#{prop[:tFqn]} o:#{prop[:tOID]} e:#{prop[:tEID]} p '#{prop[:tProp]}'"
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
def lookup_run(args, lookupStruct, state, viewId, viewType)
|
137
|
+
lookupStruct.each do |type,lookups|
|
138
|
+
lookups.each do |lookup|
|
139
|
+
run = "lookup_#{type}_#{lookup}"
|
140
|
+
# Dialog.logger.debug "### Dialect_lookup call - #{run}"
|
141
|
+
send(run, args, state, viewId, viewType)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
data/lib/sql.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
######## ####### ######## ####### ######## ########
|
2
|
+
## / / / / License \ \ \ \
|
3
|
+
## Copyleft culture, Copyright (C) is prohibited here
|
4
|
+
## This work is licensed under a CC BY-SA 4.0
|
5
|
+
## Creative Commons Attribution-ShareAlike 4.0 License
|
6
|
+
## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
|
7
|
+
######## ####### ######## ####### ######## ########
|
8
|
+
## / / / / Code Climate \ \ \ \
|
9
|
+
## Language = ruby
|
10
|
+
## Indent = space; 4 chars;
|
11
|
+
######## ####### ######## ####### ######## ########
|
12
|
+
module Dialect
|
13
|
+
class Lookup
|
14
|
+
|
15
|
+
|
16
|
+
def getObjects(args, state)
|
17
|
+
args[:views].each do |viewId, viewProps|
|
18
|
+
getObjectsFromSQL(args, state, viewId, viewProps)
|
19
|
+
end
|
20
|
+
args[:con_views].each do |viewId, viewProps|
|
21
|
+
getObjectsFromSQL(args, state, viewId, viewProps)
|
22
|
+
end
|
23
|
+
return args
|
24
|
+
end
|
25
|
+
|
26
|
+
def getObjectsFromSQL(args, state, viewId, viewProps)
|
27
|
+
|
28
|
+
args[:x] = {}
|
29
|
+
viewIdOrig = viewId.to_s.tr("_", "-")
|
30
|
+
args[:objects] ||= {}
|
31
|
+
args[:objects][viewId] = {}
|
32
|
+
rows={}
|
33
|
+
links = {}
|
34
|
+
i = 1
|
35
|
+
|
36
|
+
# (views_objects.id in ('views_connections'.`source_object_id`) AND views_objects.id not in ('views_connections'.`target_object_id`))
|
37
|
+
|
38
|
+
state[:dbhandler].execute( "
|
39
|
+
select
|
40
|
+
views_objects.id,
|
41
|
+
elements.id,
|
42
|
+
elements.class,
|
43
|
+
relationships.class,
|
44
|
+
elements.name,
|
45
|
+
views_connections.source_object_id,
|
46
|
+
views_connections.target_object_id,
|
47
|
+
elements.documentation,
|
48
|
+
relationships.version,
|
49
|
+
elements.version,
|
50
|
+
views_objects.element_version,
|
51
|
+
properties.value
|
52
|
+
|
53
|
+
from views_connections_in_view
|
54
|
+
INNER JOIN views_connections ON views_connections_in_view.connection_id = views_connections.id
|
55
|
+
AND views_connections.version = (select max(views_connections.version) from views_connections where views_connections.id = views_connections_in_view.connection_id )
|
56
|
+
INNER JOIN relationships ON relationships.id = views_connections.relationship_id
|
57
|
+
|
58
|
+
INNER JOIN views_objects ON (views_objects.id = views_connections.source_object_id OR
|
59
|
+
views_objects.id = views_connections.target_object_id) AND
|
60
|
+
|
61
|
+
views_objects.version = (select max(views_objects.version) from views_objects where (
|
62
|
+
(views_objects.id in ('views_connections'.`target_object_id`) AND views_objects.id not in ('views_connections'.`source_object_id`))
|
63
|
+
))
|
64
|
+
|
65
|
+
INNER JOIN elements ON elements.id = views_objects.element_id AND elements.version = (select max(elements.version) from elements where elements.id in ('views_objects'.`element_id`))
|
66
|
+
LEFT JOIN properties ON properties.parent_id = elements.id AND
|
67
|
+
properties.parent_version = (select max(properties.parent_version) from properties where properties.parent_id in ('elements'.`id`)) AND
|
68
|
+
properties.name LIKE 'fqn'
|
69
|
+
|
70
|
+
|
71
|
+
where views_connections_in_view.view_id like '#{viewIdOrig}'
|
72
|
+
and views_connections_in_view.view_version = (select max(views_connections_in_view.view_version) from views_connections_in_view where views_connections_in_view.view_id like '#{viewIdOrig}')
|
73
|
+
and relationships.class in ('AggregationRelationship', 'TriggeringRelationship', 'FlowRelationship', 'AccessRelationship', 'SpecializationRelationship', 'CompositionRelationship', 'ServingRelationship', 'RealizationRelationship')
|
74
|
+
and (elements.class LIKE 'Application%' OR elements.class in ('DataObject', 'Grouping'))
|
75
|
+
and elements.version = (select max(elements.version) from elements where elements.id in ('views_objects'.`element_id`))
|
76
|
+
|
77
|
+
") do |row|
|
78
|
+
# Bot.logger.debug "### ROW ##{i}: #{row}"
|
79
|
+
|
80
|
+
# hash_tName_fId_tId = Digest::SHA256.hexdigest("#{row[0]}_#{row[4]}_#{row[5]}")[0..20]
|
81
|
+
hash_tName_fId_tId = Digest::SHA256.hexdigest("#{row[4]}_#{row[5]}")[0..20]
|
82
|
+
rows[row[0]] ||= {}
|
83
|
+
rows[row[0]][:e_id] = row[1]
|
84
|
+
rows[row[0]][:e_class] = row[2]
|
85
|
+
rows[row[0]][:o_name] = row[4]
|
86
|
+
rows[row[0]][:e_doc] = row[7]
|
87
|
+
rows[row[0]][:e_ver] = row[9]
|
88
|
+
rows[row[0]][:p_fqn] = row[11]
|
89
|
+
|
90
|
+
|
91
|
+
rows[row[0]][row[3]] ||= {}
|
92
|
+
rows[row[0]][row[3]][hash_tName_fId_tId] ||= {}
|
93
|
+
rows[row[0]][row[3]][hash_tName_fId_tId] = {from: row[5], to: row[6] }
|
94
|
+
i = i + 1
|
95
|
+
end
|
96
|
+
|
97
|
+
i = 1
|
98
|
+
rows.each do |objId, objProps|
|
99
|
+
objProps.each do |objProp, objVal|
|
100
|
+
if objProp.to_s =~ /Relationship/
|
101
|
+
links[objProp] ||= {}
|
102
|
+
objVal.each do |conPairId, conProps|
|
103
|
+
|
104
|
+
if ! rows[conProps[:from]].nil? and ! rows[conProps[:to]].nil?
|
105
|
+
links[objProp][conPairId] ||= {}
|
106
|
+
# Bot.logger.debug "### AAA #{i}: #{rows[conProps[:from]] }"
|
107
|
+
links[objProp][conPairId][:connUUID] = "#{conProps[:from]}#{conProps[:to]}".unpack("H8H4H4H4H12").join('-')
|
108
|
+
links[objProp][conPairId][:viewID] = viewId
|
109
|
+
links[objProp][conPairId][:fOID] = conProps[:from].tr("-", "_")
|
110
|
+
links[objProp][conPairId][:fEID] = rows[conProps[:from]][:e_id].tr("-", "_")
|
111
|
+
links[objProp][conPairId][:fEVer] = rows[conProps[:from]][:e_ver]
|
112
|
+
links[objProp][conPairId][:fDoc] = rows[conProps[:from]][:e_doc] == "" ? 0 : rows[conProps[:from]][:e_doc]
|
113
|
+
links[objProp][conPairId][:fName] = rows[conProps[:from]][:o_name]
|
114
|
+
links[objProp][conPairId][:fClass] = rows[conProps[:from]][:e_class]
|
115
|
+
links[objProp][conPairId][:fFqn] = rows[conProps[:from]][:p_fqn]
|
116
|
+
|
117
|
+
|
118
|
+
links[objProp][conPairId][:tOID] = conProps[:to].tr("-", "_")
|
119
|
+
links[objProp][conPairId][:tEID] = rows[conProps[:to]][:e_id].tr("-", "_")
|
120
|
+
links[objProp][conPairId][:tEVer] = rows[conProps[:to]][:e_ver]
|
121
|
+
links[objProp][conPairId][:tDoc] = rows[conProps[:to]][:e_doc] == "" ? 0 : rows[conProps[:to]][:e_doc]
|
122
|
+
links[objProp][conPairId][:tName] = rows[conProps[:to]][:o_name]
|
123
|
+
links[objProp][conPairId][:tClass] = rows[conProps[:to]][:e_class]
|
124
|
+
links[objProp][conPairId][:tFqn] = rows[conProps[:to]][:p_fqn]
|
125
|
+
# Bot.logger.debug "### AAA #{i}: #{links[objProp][conPairId]}"
|
126
|
+
i = i + 1
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
args[:objects][viewId][:objects] = rows
|
134
|
+
args[:objects][viewId][:links] = links
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dialect_lookup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eugene Istomin
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-10-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sqlite3
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: oj
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Dialect lookup
|
42
|
+
email:
|
43
|
+
- info@innosense.org
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- dialect_lookup.gemspec
|
49
|
+
- lib/dialect_lookup.rb
|
50
|
+
- lib/lookup.rb
|
51
|
+
- lib/lookup/constructors/DockedGroupings2AppFunctions.rb
|
52
|
+
- lib/lookup/constructors/Element2ModSend.rb
|
53
|
+
- lib/lookup/constructors/ElementsInElements.rb
|
54
|
+
- lib/lookup/data/1.ModReceive2GetData.rb
|
55
|
+
- lib/lookup/data/2.GetData2Elements.rb
|
56
|
+
- lib/lookup/data/3.GenData2Dest.rb
|
57
|
+
- lib/lookup/data/4.Results2GenData.rb
|
58
|
+
- lib/lookup/functional/1.Expect2Events.rb
|
59
|
+
- lib/lookup/functional/2.1.Events2AppEvent.rb
|
60
|
+
- lib/lookup/functional/2.2.1.Events2ModReceive.rb
|
61
|
+
- lib/lookup/functional/2.2.2.ModReceive2AppEvent.rb
|
62
|
+
- lib/lookup/functional/3.Appevent2EventBus.rb
|
63
|
+
- lib/lookup/functional/4.1.AppEvent2Elements.rb
|
64
|
+
- lib/lookup/functional/4.2.Elements2AppEvent.rb
|
65
|
+
- lib/lookup/functional/5.1.Element2ModElements.rb
|
66
|
+
- lib/lookup/functional/5.2.Element2ModSend.rb
|
67
|
+
- lib/lookup/functional/6.ModElementsSpecs.rb
|
68
|
+
- lib/lookup/functional/7.ElementChains.rb
|
69
|
+
- lib/sql.rb
|
70
|
+
homepage: https://github.com/ArchDelivery/Dialog
|
71
|
+
licenses: []
|
72
|
+
metadata: {}
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 2.7.3
|
90
|
+
signing_key:
|
91
|
+
specification_version: 4
|
92
|
+
summary: Dialect lookup
|
93
|
+
test_files: []
|