@@ -18,75 +18,13 @@ def initialize(current_authentication, flow, node, reference_value)
1818 @reference_value = reference_value
1919 end
2020
21- def find_primary_nodes ( search_node , curr_primary , primary_level )
22- found_node = nil
23- search_node . node_parameters . each do |param |
24- next if param . function_value . blank?
25-
26- curr_primary += 1
27- if curr_primary == primary_level
28- found_node = param . function_value
29- break
30- end
31- find_node = find_primary_nodes ( param . function_value , curr_primary , primary_level )
32- found_node = find_node [ :found_node ]
33- break if found_node . present?
34- end
35- {
36- found_node : found_node ,
37- new_primary : curr_primary ,
38- }
39- end
40-
4121 def execute
4222 errors = [ ]
43- errors += Namespaces ::Projects ::Flows ::Validation ::DataType ::DataTypeIdentifierValidationService . new (
44- current_authentication ,
45- flow ,
46- node ,
47- reference_value . data_type_identifier
48- ) . execute
49-
50- primary_level = reference_value . primary_level
51- curr_primary = 0
52- node = flow . starting_node
53-
54- while curr_primary < primary_level
55- if node . nil?
56- errors << ValidationResult . error ( :primary_level_not_found )
57- return errors
58- end
59- nodes = find_primary_nodes ( node , curr_primary , primary_level )
60- if nodes [ :found_node ] . nil?
61- curr_primary = nodes [ :new_primary ]
62- else
63- node = nodes [ :found_node ]
64- break
65- end
66-
67- next_node = node . next_node
68- node = next_node
69- end
70-
71- secondary_level = reference_value . secondary_level
72-
73- curr_secondary = 0
74-
75- while curr_secondary != secondary_level
76- errors << ValidationResult . error ( :secondary_level_not_found ) if node . next_node . nil?
77- next_node = node . next_node
78- node = next_node
7923
80- curr_secondary += 1
24+ unless reference_value . valid?
25+ errors << ValidationResult . error ( :reference_value_invalid , reference_value . errors )
8126 end
8227
83- return errors if reference_value . tertiary_level . nil?
84-
85- tertiary_level = reference_value . tertiary_level
86-
87- if tertiary_level >= node . node_parameters . count
88- errors << ValidationResult . error ( :tertiary_level_exceeds_parameters )
89- end
9028 # https://github.com/code0-tech/sagittarius/issues/508 Validate the usage and datatypes
9129 errors
9230 end
0 commit comments