gd_bam 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bam/version.rb +1 -1
- data/lib/generators/downloaders.rb +13 -19
- metadata +1 -1
data/lib/bam/version.rb
CHANGED
@@ -364,30 +364,25 @@ HEREDOC
|
|
364
364
|
timestamp_field = Tap.find_output_field(tap, "Timestamp")
|
365
365
|
id_field = Tap.find_output_field(tap, "Id")
|
366
366
|
tap = Tap.prepare_for_sf_downloader(tap)
|
367
|
-
builder.Phase(:number => phase += 1) do
|
368
|
-
# Core::build_node2(builder, Nodes.es_truncate2({:guiName => dataset, :store => store, :entity => dataset, :timestamp => "${#{dataset}_TRUNCATE_DATE}", :name => "#{module_name} es truncate", :id => "#{module_name}_es_truncate"}))
|
369
|
-
end
|
370
367
|
|
371
368
|
fields = tap[:fields]
|
372
|
-
|
373
|
-
puts tap[:object]
|
369
|
+
|
370
|
+
# puts tap[:object]
|
374
371
|
sf_object = tap[:object]
|
375
372
|
id_field = Tap.find_output_field(tap, "Id")
|
376
373
|
timestamp_field = Tap.find_output_field(tap, "Timestamp")
|
377
|
-
|
378
|
-
|
374
|
+
|
379
375
|
objects_to_get = Helpers.objects_for_history(client, tap)
|
380
|
-
|
376
|
+
|
381
377
|
(tap[:fields] - [id_field, timestamp_field]).each_with_index do |field, i|
|
382
378
|
builder.Phase(:number => phase += 1) do
|
383
|
-
|
384
|
-
f = field[:name]
|
385
379
|
|
380
|
+
f = field[:name]
|
386
381
|
selects = objects_to_get.reduce([]) do |memo, o|
|
387
382
|
fields = client.fields(o)
|
388
|
-
generic_field_history = ["NewValue", "OldValue", "ParentId"].all? {|
|
389
|
-
specific_field_history = ["NewValue", "OldValue", "#{sf_object}Id"].all? {|
|
390
|
-
specific_history = ["SystemModstamp", "#{sf_object}Id"].all? {|
|
383
|
+
generic_field_history = ["NewValue", "OldValue", "ParentId"].all? {|fl| fields.include?(fl)}
|
384
|
+
specific_field_history = ["NewValue", "OldValue", "#{sf_object}Id"].all? {|fl| fields.include?(fl)}
|
385
|
+
specific_history = ["SystemModstamp", "#{sf_object}Id"].all? {|fl| fields.include?(fl)}
|
391
386
|
|
392
387
|
select, mapping, mandatory = if generic_field_history
|
393
388
|
[
|
@@ -401,7 +396,6 @@ HEREDOC
|
|
401
396
|
]
|
402
397
|
elsif specific_field_history
|
403
398
|
[
|
404
|
-
|
405
399
|
"SELECT NewValue, CreatedDate, #{sf_object}Id FROM #{o} WHERE Field = '#{f}'",
|
406
400
|
"{\"xmlFieldsMapping\":{\"xmlFields\":[
|
407
401
|
{\"xmlFieldMapping\":{\"name\":\"NewValue\",\"label\":\"NewValue\",\"xmlPath\":\"NewValue\",\"metadataField\":\"Value\"}},
|
@@ -452,14 +446,14 @@ HEREDOC
|
|
452
446
|
:mandatory => ["Id", f, "SystemModstamp"]
|
453
447
|
}])
|
454
448
|
selects.each_with_index do |obj, i|
|
455
|
-
|
449
|
+
|
456
450
|
o = obj[:object]
|
457
451
|
mapping = obj[:mapping]
|
458
452
|
select = obj[:query]
|
459
453
|
mandatory = obj[:mandatory]
|
454
|
+
# puts "#{f}_#{o}_reader:0 -> #{f}_#{sf_object}_gather:#{i}"
|
460
455
|
|
461
456
|
Core::build_node2(builder, Nodes.sfdc_reader2({:name => "#{o} SF Reader #{i}", :id => "#{f}_#{o}_reader", :soql => select, :sfdcConnection => "SFDC", :fieldsMapping => mapping, :mandatoryFields => mandatory.join(';')}))
|
462
|
-
puts "#{f}_#{o}_reader:0 -> #{f}_#{sf_object}_gather:#{i}"
|
463
457
|
Core::build_node2(builder, Nodes.edge2({:toNode => "#{f}_#{sf_object}_gather:#{i}", :fromNode => "#{f}_#{o}_reader:0", :metadata => "data_metadata"}))
|
464
458
|
end
|
465
459
|
Core::build_node2(builder, Nodes.gather2({:name => "#{f} Gather", :id => "#{f}_#{sf_object}_gather"}))
|
@@ -488,10 +482,10 @@ HEREDOC
|
|
488
482
|
end
|
489
483
|
end
|
490
484
|
taps_with_history.each do |tap|
|
491
|
-
puts "#{tap[:id]}_LAST_RUN"
|
485
|
+
# puts "#{tap[:id]}_LAST_RUN"
|
492
486
|
builder.Phase(:number => phase += 1) do
|
493
|
-
|
494
|
-
|
487
|
+
generate_func = <<HEREDOC
|
488
|
+
function integer generate() {
|
495
489
|
date time_end = jodaStr2date("${#{tap[:id]}_END}",["yyyy-MM-dd'T'HH:mm:ss.SSSZZ"], 'en_US', 'UTC', 'UTC');
|
496
490
|
$out.0.key = "#{tap[:id]}_LAST_RUN";
|
497
491
|
$out.0.value = jodaDate2str(time_end,"yyyy-MM-dd'T'HH:mm:ss.SSSZZ", 'en_US', 'UTC');
|