ZCRMSDK 2.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/ZCRMSDK.rb +87 -2
- data/src/com/zoho/api/authenticator/oauth_token.rb +86 -31
- data/src/com/zoho/api/authenticator/store/db_store.rb +71 -29
- data/src/com/zoho/api/authenticator/store/file_store.rb +91 -21
- data/src/com/zoho/api/authenticator/store/token_store.rb +7 -0
- data/src/com/zoho/api/logger/sdk_logger.rb +18 -9
- data/src/com/zoho/crm/api/assignment_rules/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/assignment_rules/assignment_rule.rb +215 -0
- data/src/com/zoho/crm/api/assignment_rules/assignment_rules_operations.rb +61 -0
- data/src/com/zoho/crm/api/assignment_rules/default_user.rb +80 -0
- data/src/com/zoho/crm/api/assignment_rules/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/assignment_rules/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/attachments/attachment.rb +42 -4
- data/src/com/zoho/crm/api/attachments/attachments_operations.rb +6 -6
- data/src/com/zoho/crm/api/blue_print/blue_print_operations.rb +2 -2
- data/src/com/zoho/crm/api/blue_print/escalation.rb +80 -0
- data/src/com/zoho/crm/api/blue_print/field.rb +1127 -0
- data/src/com/zoho/crm/api/blue_print/next_transition.rb +38 -0
- data/src/com/zoho/crm/api/blue_print/process_info.rb +4 -4
- data/src/com/zoho/crm/api/blue_print/transition.rb +19 -1
- data/src/com/zoho/crm/api/blue_print/validation_error.rb +57 -0
- data/src/com/zoho/crm/api/bulk_read/bulk_read_operations.rb +3 -3
- data/src/com/zoho/crm/api/bulk_read/criteria.rb +20 -0
- data/src/com/zoho/crm/api/bulk_read/query.rb +5 -4
- data/src/com/zoho/crm/api/bulk_write/bulk_write_operations.rb +3 -3
- data/src/com/zoho/crm/api/bulk_write/resource.rb +24 -4
- data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +7 -7
- data/src/com/zoho/crm/api/currencies/currencies_operations.rb +7 -7
- data/src/com/zoho/crm/api/custom_views/criteria.rb +5 -4
- data/src/com/zoho/crm/api/custom_views/custom_view.rb +100 -41
- data/src/com/zoho/crm/api/custom_views/custom_views_operations.rb +2 -2
- data/src/com/zoho/crm/api/custom_views/{shared_details.rb → shared_to.rb} +2 -2
- data/src/com/zoho/crm/api/dc/au_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/cn_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/datacenter.rb +3 -2
- data/src/com/zoho/crm/api/dc/eu_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/in_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/us_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/email_templates/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/email_templates/attachment.rb +118 -0
- data/src/com/zoho/crm/api/email_templates/email_template.rb +390 -0
- data/src/com/zoho/crm/api/email_templates/email_templates_operations.rb +61 -0
- data/src/com/zoho/crm/api/email_templates/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/email_templates/response_wrapper.rb +83 -0
- data/src/com/zoho/crm/api/field_attachments/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/field_attachments/body_wrapper.rb +62 -0
- data/src/com/zoho/crm/api/field_attachments/field_attachments_operations.rb +52 -0
- data/src/com/zoho/crm/api/field_attachments/file_body_wrapper.rb +64 -0
- data/src/com/zoho/crm/api/field_attachments/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/fields/external.rb +99 -0
- data/src/com/zoho/crm/api/fields/field.rb +215 -61
- data/src/com/zoho/crm/api/fields/fields_operations.rb +2 -2
- data/src/com/zoho/crm/api/fields/history_tracking.rb +80 -0
- data/src/com/zoho/crm/api/fields/maps.rb +80 -0
- data/src/com/zoho/crm/api/fields/multi_module_lookup.rb +99 -0
- data/src/com/zoho/crm/api/fields/multi_select_lookup.rb +19 -0
- data/src/com/zoho/crm/api/fields/multi_user_lookup.rb +175 -0
- data/src/com/zoho/crm/api/fields/pick_list_value.rb +19 -0
- data/src/com/zoho/crm/api/fields/related_details.rb +19 -0
- data/src/com/zoho/crm/api/files/file_operations.rb +2 -2
- data/src/com/zoho/crm/api/initializer.rb +45 -17
- data/src/com/zoho/crm/api/inventory_templates/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/inventory_templates/inventory_template.rb +352 -0
- data/src/com/zoho/crm/api/inventory_templates/inventory_templates_operations.rb +82 -0
- data/src/com/zoho/crm/api/inventory_templates/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/inventory_templates/response_wrapper.rb +83 -0
- data/src/com/zoho/crm/api/layouts/layout.rb +38 -0
- data/src/com/zoho/crm/api/layouts/layouts_operations.rb +2 -2
- data/src/com/zoho/crm/api/layouts/section.rb +19 -0
- data/src/com/zoho/crm/api/modules/module.rb +57 -0
- data/src/com/zoho/crm/api/modules/modules_operations.rb +4 -4
- data/src/com/zoho/crm/api/notes/note.rb +19 -0
- data/src/com/zoho/crm/api/notes/notes_operations.rb +7 -7
- data/src/com/zoho/crm/api/notification/notification_operations.rb +6 -6
- data/src/com/zoho/crm/api/org/hierarchy_preference.rb +61 -0
- data/src/com/zoho/crm/api/org/org.rb +38 -0
- data/src/com/zoho/crm/api/org/org_operations.rb +2 -2
- data/src/com/zoho/crm/api/pipeline/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/action_response.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/api_exception.rb +129 -0
- data/src/com/zoho/crm/api/pipeline/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/pipeline/forecast_category.rb +80 -0
- data/src/com/zoho/crm/api/pipeline/pick_list_value.rb +175 -0
- data/src/com/zoho/crm/api/pipeline/pipeline.rb +213 -0
- data/src/com/zoho/crm/api/pipeline/pipeline_operations.rb +165 -0
- data/src/com/zoho/crm/api/pipeline/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/stage.rb +80 -0
- data/src/com/zoho/crm/api/pipeline/success_response.rb +123 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_response.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/transfer_and_delete_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/pipeline/transfer_pipe_line.rb +80 -0
- data/src/com/zoho/crm/api/profiles/category.rb +19 -0
- data/src/com/zoho/crm/api/profiles/default_view.rb +99 -0
- data/src/com/zoho/crm/api/profiles/profile.rb +49 -11
- data/src/com/zoho/crm/api/profiles/profiles_operations.rb +2 -2
- data/src/com/zoho/crm/api/query/query_operations.rb +1 -1
- data/src/com/zoho/crm/api/record/api_exception.rb +2 -0
- data/src/com/zoho/crm/api/record/body_wrapper.rb +0 -19
- data/src/com/zoho/crm/api/record/count_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/count_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/record/field.rb +17 -17
- data/src/com/zoho/crm/api/record/image_upload.rb +213 -0
- data/src/com/zoho/crm/api/record/line_tax.rb +19 -0
- data/src/com/zoho/crm/api/record/mass_update_body_wrapper.rb +4 -4
- data/src/com/zoho/crm/api/record/mass_update_territory.rb +80 -0
- data/src/com/zoho/crm/api/record/multi_select_lookup.rb +99 -0
- data/src/com/zoho/crm/api/record/multi_select_picklist.rb +80 -0
- data/src/com/zoho/crm/api/record/price_book.rb +31 -0
- data/src/com/zoho/crm/api/record/record_operations.rb +196 -26
- data/src/com/zoho/crm/api/record/tax.rb +80 -0
- data/src/com/zoho/crm/api/record/territory.rb +70 -12
- data/src/com/zoho/crm/api/record/widget.rb +80 -0
- data/src/com/zoho/crm/api/record/wizard.rb +80 -0
- data/src/com/zoho/crm/api/related_lists/related_lists_operations.rb +2 -2
- data/src/com/zoho/crm/api/related_records/related_records_operations.rb +6 -6
- data/src/com/zoho/crm/api/request_proxy.rb +3 -4
- data/src/com/zoho/crm/api/roles/roles_operations.rb +2 -2
- data/src/com/zoho/crm/api/sdk_config.rb +2 -68
- data/src/com/zoho/crm/api/send_mail/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/action_response.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/send_mail/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/send_mail/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/send_mail/data_subject_request.rb +80 -0
- data/src/com/zoho/crm/api/send_mail/inventory_details.rb +100 -0
- data/src/com/zoho/crm/api/send_mail/mail.rb +423 -0
- data/src/com/zoho/crm/api/send_mail/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/send_mail/send_mail_operations.rb +61 -0
- data/src/com/zoho/crm/api/send_mail/success_response.rb +121 -0
- data/src/com/zoho/crm/api/send_mail/template.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/user_address.rb +137 -0
- data/src/com/zoho/crm/api/share_records/share_records_operations.rb +4 -4
- data/src/com/zoho/crm/api/tags/tag.rb +19 -0
- data/src/com/zoho/crm/api/tags/tags_operations.rb +11 -11
- data/src/com/zoho/crm/api/taxes/taxes_operations.rb +6 -6
- data/src/com/zoho/crm/api/territories/response_wrapper.rb +20 -0
- data/src/com/zoho/crm/api/territories/territories_operations.rb +2 -2
- data/src/com/zoho/crm/api/territories/territory.rb +61 -23
- data/src/com/zoho/crm/api/users/user.rb +34 -0
- data/src/com/zoho/crm/api/users/users_operations.rb +6 -6
- data/src/com/zoho/crm/api/util/api_http_connector.rb +6 -5
- data/src/com/zoho/crm/api/util/common_api_handler.rb +5 -3
- data/src/com/zoho/crm/api/util/constants.rb +140 -15
- data/src/com/zoho/crm/api/util/converter.rb +30 -7
- data/src/com/zoho/crm/api/util/data_type_converter.rb +8 -2
- data/src/com/zoho/crm/api/util/form_data_converter.rb +4 -15
- data/src/com/zoho/crm/api/util/json_converter.rb +7 -9
- data/src/com/zoho/crm/api/util/module_fields_handler.rb +1 -1
- data/src/com/zoho/crm/api/util/utility.rb +274 -87
- data/src/com/zoho/crm/api/variable_groups/variable_groups_operations.rb +3 -3
- data/src/com/zoho/crm/api/variables/variables_operations.rb +9 -9
- data/src/com/zoho/crm/api/wizards/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/wizards/button.rb +252 -0
- data/src/com/zoho/crm/api/wizards/chart_data.rb +118 -0
- data/src/com/zoho/crm/api/wizards/connection.rb +80 -0
- data/src/com/zoho/crm/api/wizards/container.rb +119 -0
- data/src/com/zoho/crm/api/wizards/node.rb +118 -0
- data/src/com/zoho/crm/api/wizards/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/wizards/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/wizards/screen.rb +99 -0
- data/src/com/zoho/crm/api/wizards/segment.rb +176 -0
- data/src/com/zoho/crm/api/wizards/transition.rb +80 -0
- data/src/com/zoho/crm/api/wizards/wizard.rb +273 -0
- data/src/com/zoho/crm/api/wizards/wizards_operations.rb +61 -0
- data/src/resources/JSONDetails.json +1 -1
- data/src/version.rb +1 -1
- metadata +92 -7
- data/src/com/zoho/crm/api/record/inventory_line_items.rb +0 -235
@@ -56,7 +56,23 @@ module Util
|
|
56
56
|
check = true
|
57
57
|
|
58
58
|
unless value.nil?
|
59
|
-
|
59
|
+
if key_details.key? Constants::INTERFACE and key_details[Constants::INTERFACE] == true
|
60
|
+
json_details = Initializer.json_details
|
61
|
+
interface_details = json_details[key_details[Constants::STRUCTURE_NAME]]
|
62
|
+
classes = interface_details[Constants::CLASSES]
|
63
|
+
check = false
|
64
|
+
classes.each do |each_class_name|
|
65
|
+
class_name_lower = each_class_name.to_s.downcase
|
66
|
+
value_class_name = Util::Utility.path_to_package(value.class.name).downcase
|
67
|
+
|
68
|
+
if class_name_lower.downcase == value_class_name
|
69
|
+
check = true
|
70
|
+
break
|
71
|
+
end
|
72
|
+
end
|
73
|
+
else
|
74
|
+
var_type = value.class.name
|
75
|
+
end
|
60
76
|
end
|
61
77
|
|
62
78
|
if Constants::DATA_TYPE.key? type
|
@@ -70,7 +86,6 @@ module Util
|
|
70
86
|
instance_number = index
|
71
87
|
type = Constants::LIST_NAMESPACE + '(' + structure_name + ')'
|
72
88
|
var_type = Constants::LIST_NAMESPACE + '(' + class_name + ')'
|
73
|
-
expected_list_type = false
|
74
89
|
check = false
|
75
90
|
|
76
91
|
break
|
@@ -81,9 +96,15 @@ module Util
|
|
81
96
|
elsif !value.nil?
|
82
97
|
check = Util::Utility.check_data_type(value,type)
|
83
98
|
end
|
84
|
-
elsif (type.downcase
|
85
|
-
if type.downcase
|
86
|
-
check =
|
99
|
+
elsif (type.downcase == Constants::OBJECT.downcase || (!var_type.nil? && var_type.downcase == Constants::OBJECT.downcase))
|
100
|
+
if type.downcase == Constants::OBJECT.downcase
|
101
|
+
check = true
|
102
|
+
else
|
103
|
+
class_name1 = value.class.name
|
104
|
+
if type.downcase != Util::Utility.path_to_package(class_name1).downcase
|
105
|
+
check = false
|
106
|
+
end
|
107
|
+
var_type = class_name1
|
87
108
|
end
|
88
109
|
end
|
89
110
|
if !check
|
@@ -108,7 +129,9 @@ module Util
|
|
108
129
|
|
109
130
|
if key_details.key?(Constants::VALUES) && (!key_details.key?(Constants::PICKLIST) || (key_details[Constants::PICKLIST] && Initializer.get_initializer.sdk_config.pick_list_validation))
|
110
131
|
value = value.value if value.is_a? Util::Choice
|
111
|
-
|
132
|
+
|
133
|
+
values_ja = key_details[Constants::VALUES]
|
134
|
+
unless values_ja.include? value
|
112
135
|
|
113
136
|
unless instance_number.nil?
|
114
137
|
error[Constants::INDEX] = instance_number
|
@@ -120,7 +143,7 @@ module Util
|
|
120
143
|
|
121
144
|
error[Constants::ERROR_HASH_FIELD] = member_name
|
122
145
|
|
123
|
-
error[Constants::ACCEPTED_VALUES] =
|
146
|
+
error[Constants::ACCEPTED_VALUES] = values_ja
|
124
147
|
|
125
148
|
raise SDKException.new(Constants::UNACCEPTED_VALUES_ERROR, nil, error, nil)
|
126
149
|
end
|
@@ -108,7 +108,10 @@ module Util
|
|
108
108
|
# @raise Exception
|
109
109
|
def self.pre_convert(obj, type)
|
110
110
|
init
|
111
|
-
@@pre_converter_map
|
111
|
+
if @@pre_converter_map.key? type
|
112
|
+
return @@pre_converter_map[type].call(obj)
|
113
|
+
end
|
114
|
+
obj
|
112
115
|
end
|
113
116
|
|
114
117
|
# This method is to convert Java data to JSON data value.
|
@@ -118,7 +121,10 @@ module Util
|
|
118
121
|
# @raise Exception
|
119
122
|
def self.post_convert(obj, type)
|
120
123
|
init
|
121
|
-
@@post_converter_map
|
124
|
+
if @@post_converter_map.key? type
|
125
|
+
return @@post_converter_map[type].call(obj)
|
126
|
+
end
|
127
|
+
obj
|
122
128
|
end
|
123
129
|
|
124
130
|
def self.pre_convert_object_data(obj)
|
@@ -13,10 +13,10 @@ module Util
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def append_to_request(request_base, request_object)
|
16
|
-
request_base.set_form(
|
16
|
+
request_base.set_form(set_file_body(request_object), Constants::MULTIPART_FORM_DATA) if request_object.is_a?(Hash)
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def set_file_body(request_object)
|
20
20
|
data = []
|
21
21
|
request_object.each do |key, value|
|
22
22
|
if value.is_a? Array
|
@@ -38,18 +38,7 @@ module Util
|
|
38
38
|
|
39
39
|
def form_request(request_instance, class_path, instance_no, member_json_details = nil)
|
40
40
|
require_relative '../initializer'
|
41
|
-
|
42
|
-
path = @common_api_handler.api_path.split("/")
|
43
|
-
if path.length == 6
|
44
|
-
module_api_name = path[3].downcase
|
45
|
-
if path[1].downcase == Constants::CRM && path[2].downcase == Constants::API_VERSION && path[5].downcase == Constants::PHOTO && !(Constants::PHOTO_SUPPORTED_MODULES.include? module_api_name)
|
46
|
-
api_supported_module = Utility::api_supported_module
|
47
|
-
if api_supported_module.key?(module_api_name) && api_supported_module[module_api_name].downcase != "custom"
|
48
|
-
raise SDKException.new(Constants::INVALID_MODULE, Constants::PHOTO_UPLOAD_ERROR_MESSAGE)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
41
|
+
|
53
42
|
package_name = Utility.path_to_package(class_path)
|
54
43
|
class_details = Initializer.json_details[package_name]
|
55
44
|
request_hash = {}
|
@@ -72,7 +61,7 @@ module Util
|
|
72
61
|
|
73
62
|
member_data = request_instance.instance_variable_get(Constants::AT + member_name)
|
74
63
|
|
75
|
-
if !modified.nil? && (modified != 0) && value_checker(request_instance.class.name, member_name, member_details, member_data, @unique_hash, instance_no)
|
64
|
+
if !modified.nil? && (modified != 0) && !member_data.nil? && value_checker(request_instance.class.name, member_name, member_details, member_data, @unique_hash, instance_no)
|
76
65
|
key_name = member_details[Constants::NAME]
|
77
66
|
type = member_details[Constants::TYPE]
|
78
67
|
if type.downcase == Constants::LIST_NAMESPACE.downcase
|
@@ -106,13 +106,11 @@ module Util
|
|
106
106
|
|
107
107
|
if request_instance.is_a? Record::FileDetails
|
108
108
|
lower_case_key_name = key_name.downcase
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
field_value
|
115
|
-
end
|
109
|
+
if field_value.nil? || (field_value.is_a? (String) && field_value.downcase == "null")
|
110
|
+
request_json[lower_case_key_name] = nil
|
111
|
+
else
|
112
|
+
request_json[lower_case_key_name] = field_value
|
113
|
+
end
|
116
114
|
else
|
117
115
|
request_json[key_name] = set_data(member_detail, field_value)
|
118
116
|
end
|
@@ -706,9 +704,9 @@ module Util
|
|
706
704
|
member_value
|
707
705
|
end
|
708
706
|
|
709
|
-
def build_name(
|
707
|
+
def build_name(key_name)
|
710
708
|
sdk_name = ''
|
711
|
-
name_split =
|
709
|
+
name_split = key_name.to_s.split('_')
|
712
710
|
sdk_name = name_split[0].to_s.downcase
|
713
711
|
index = 1
|
714
712
|
|
@@ -51,7 +51,7 @@ module Util
|
|
51
51
|
def self.refresh_fields(module_api_name)
|
52
52
|
@@sync_lock.synchronize do
|
53
53
|
delete_fields(module_api_name)
|
54
|
-
Utility.
|
54
|
+
Utility.get_fields_info(module_api_name)
|
55
55
|
end
|
56
56
|
rescue SDKException => e
|
57
57
|
SDKLog::SDKLogger.severe(Constants::REFRESH_SINGLE_MODULE_FIELDS_ERROR + module_api_name, e)
|
@@ -22,17 +22,89 @@ module Util
|
|
22
22
|
|
23
23
|
@@apitype_vs_structurename = {}
|
24
24
|
|
25
|
-
@@api_supported_module ={}
|
26
|
-
|
27
25
|
@@new_file = false
|
28
26
|
|
29
27
|
@@get_modified_modules = false
|
30
28
|
|
29
|
+
@@api_supported_module = {}
|
30
|
+
|
31
|
+
@@module_api_name = nil
|
32
|
+
|
31
33
|
@@force_refresh = false
|
32
|
-
def self.
|
33
|
-
|
34
|
+
def self.set_handler_api_path(module_api_name, handler_instance)
|
35
|
+
if handler_instance.nil?
|
36
|
+
return
|
37
|
+
end
|
38
|
+
api_path = handler_instance.api_path
|
39
|
+
if module_api_name.downcase == api_path.downcase
|
40
|
+
api_path_split = api_path.split('/')
|
41
|
+
api_path_split.each do |api_path_split|
|
42
|
+
split_lower = api_path_split[i].downcase
|
43
|
+
if split_lower == module_api_name.downcase
|
44
|
+
api_path_splits[i] = module_api_name
|
45
|
+
elsif Constants::DEFAULT_MODULENAME_VS_APINAME.key? split_lower && !Constants::DEFAULT_MODULENAME_VS_APINAME[split_lower].nil?
|
46
|
+
api_path_splits[i] = Constants::DEFAULT_MODULENAME_VS_APINAME[split_lower]
|
47
|
+
end
|
48
|
+
api_path = api_path_splits.join("/")
|
49
|
+
handler_instance.api_path = api_path
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.file_exists_flow(module_api_name,record_field_details_path,last_modified_time)
|
55
|
+
@@sync_lock.synchronize do
|
56
|
+
initializer = Initializer.get_initializer
|
57
|
+
record_field_details_json = JSON.parse(File.read(record_field_details_path))
|
58
|
+
last_modified_time_exists = false
|
59
|
+
if record_field_details_json.key?(Constants::FIELDS_LAST_MODIFIED_TIME) && !record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME].nil?
|
60
|
+
if get_current_time_in_millis - record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] > 3_600_000
|
61
|
+
last_modified_time_exists = true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
if !record_field_details_json.key?(Constants::FIELDS_LAST_MODIFIED_TIME) || @@force_refresh
|
65
|
+
last_modified_time_exists = true
|
66
|
+
end
|
67
|
+
|
68
|
+
if initializer.sdk_config.auto_refresh_fields && !@@new_file && !@@get_modified_modules && last_modified_time_exists
|
69
|
+
@@get_modified_modules = true
|
70
|
+
last_modified_time = (record_field_details_json.key? Constants::FIELDS_LAST_MODIFIED_TIME) ? record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] : nil
|
71
|
+
modify_fields(record_field_details_path, last_modified_time)
|
72
|
+
@@get_modified_modules = false
|
73
|
+
elsif !initializer.sdk_config.auto_refresh_fields && @@force_refresh && !@@get_modified_modules
|
74
|
+
@@get_modified_modules = true
|
75
|
+
modify_fields(record_field_details_path, last_modified_time)
|
76
|
+
@@get_modified_modules = false
|
77
|
+
end
|
78
|
+
|
79
|
+
record_field_details_json = JSON.parse(File.read(record_field_details_path))
|
80
|
+
return if module_api_name.nil? || record_field_details_json.key?(module_api_name.downcase)
|
81
|
+
|
82
|
+
fill_data_type()
|
83
|
+
|
84
|
+
record_field_details_json[module_api_name.downcase] = {}
|
85
|
+
|
86
|
+
File.open(record_field_details_path, 'w') do |f|
|
87
|
+
f.write(record_field_details_json.to_json)
|
88
|
+
end
|
89
|
+
field_details = get_fields_details(module_api_name)
|
90
|
+
record_field_details_json = JSON.parse(File.read(record_field_details_path))
|
91
|
+
|
92
|
+
record_field_details_json[module_api_name.downcase] = field_details
|
93
|
+
|
94
|
+
File.open(record_field_details_path, 'w') do |f|
|
95
|
+
f.write(record_field_details_json.to_json)
|
96
|
+
end
|
97
|
+
end
|
34
98
|
end
|
35
|
-
|
99
|
+
|
100
|
+
def self.get_fields(module_api_name, handler_instance=nil)
|
101
|
+
@@sync_lock.synchronize do
|
102
|
+
@@module_api_name = module_api_name
|
103
|
+
get_fields_info(module_api_name,handler_instance)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.get_fields_info(module_api_name, handler_instance=nil)
|
36
108
|
require_relative '../initializer'
|
37
109
|
initializer = Initializer.get_initializer
|
38
110
|
record_field_details_path = nil
|
@@ -45,54 +117,18 @@ module Util
|
|
45
117
|
resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
|
46
118
|
|
47
119
|
Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
|
48
|
-
record_field_details_path = get_record_json_file_path
|
49
|
-
|
120
|
+
record_field_details_path = get_record_json_file_path()
|
121
|
+
module_api_name = verify_module_api_name(module_api_name)
|
122
|
+
set_handler_api_path(module_api_name,handler_instance)
|
123
|
+
|
50
124
|
if File.exist? record_field_details_path
|
51
|
-
|
52
|
-
last_modified_time_exists = false
|
53
|
-
if @@force_refresh
|
54
|
-
if record_field_details_json.key?(Constants::FIELDS_LAST_MODIFIED_TIME) && !record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME].nil?
|
55
|
-
if get_current_time_in_millis - record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] > 3_600_000
|
56
|
-
last_modified_time_exists = true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
if initializer.sdk_config.auto_refresh_fields && !@@new_file && !@@get_modified_modules && last_modified_time_exists
|
61
|
-
@@get_modified_modules = true
|
62
|
-
last_modified_time = (record_field_details_json.key? Constants::FIELDS_LAST_MODIFIED_TIME) ? record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] : nil
|
63
|
-
modify_fields(record_field_details_path, last_modified_time)
|
64
|
-
@@get_modified_modules = false
|
65
|
-
elsif !initializer.sdk_config.auto_refresh_fields && @@force_refresh && !@@get_modified_modules
|
66
|
-
@@get_modified_modules = true
|
67
|
-
modify_fields(record_field_details_path, last_modified_time)
|
68
|
-
@@get_modified_modules = false
|
69
|
-
end
|
70
|
-
|
71
|
-
record_field_details_json = JSON.parse(File.read(record_field_details_path))
|
72
|
-
return if module_api_name.nil? || record_field_details_json.key?(module_api_name.downcase)
|
73
|
-
|
74
|
-
fill_data_type
|
75
|
-
|
76
|
-
record_field_details_json[module_api_name.downcase] = {}
|
77
|
-
|
78
|
-
File.open(record_field_details_path, 'w') do |f|
|
79
|
-
f.write(record_field_details_json.to_json)
|
80
|
-
end
|
81
|
-
field_details = get_fields_details(module_api_name)
|
82
|
-
record_field_details_json = JSON.parse(File.read(record_field_details_path))
|
83
|
-
|
84
|
-
record_field_details_json[module_api_name.downcase] = field_details
|
85
|
-
|
86
|
-
File.open(record_field_details_path, 'w') do |f|
|
87
|
-
f.write(record_field_details_json.to_json)
|
88
|
-
end
|
89
|
-
|
125
|
+
file_exists_flow(module_api_name,record_field_details_path,last_modified_time)
|
90
126
|
elsif initializer.sdk_config.auto_refresh_fields
|
91
127
|
@@new_file = true
|
92
|
-
fill_data_type
|
93
|
-
|
94
|
-
|
95
|
-
|
128
|
+
fill_data_type()
|
129
|
+
@@api_supported_module = @@api_supported_module.length == 0 ? get_modules(nil) : @@api_supported_module
|
130
|
+
|
131
|
+
record_field_details_json = File.exist? record_field_details_path ? JSON.parse(File.read(record_field_details_path)) : {}
|
96
132
|
|
97
133
|
record_field_details_json = { Constants::FIELDS_LAST_MODIFIED_TIME => get_current_time_in_millis }
|
98
134
|
@@api_supported_module.each_key do |module_name|
|
@@ -101,7 +137,7 @@ module Util
|
|
101
137
|
File.open(record_field_details_path, 'w') do |f|
|
102
138
|
f.write(record_field_details_json.to_json)
|
103
139
|
end
|
104
|
-
field_details = get_fields_details(module_name)
|
140
|
+
field_details = get_fields_details( @@api_supported_module[module_name][Constants::API_NAME])
|
105
141
|
record_field_details_json = JSON.parse(File.read(record_field_details_path))
|
106
142
|
record_field_details_json[module_name.downcase] = field_details
|
107
143
|
File.open(record_field_details_path, 'w') do |f|
|
@@ -119,7 +155,7 @@ module Util
|
|
119
155
|
modify_fields(record_field_details_path, last_modified_time)
|
120
156
|
@@get_modified_modules = false
|
121
157
|
else
|
122
|
-
fill_data_type
|
158
|
+
fill_data_type()
|
123
159
|
|
124
160
|
record_field_details_json = { module_api_name.downcase => {} }
|
125
161
|
|
@@ -171,9 +207,9 @@ module Util
|
|
171
207
|
end
|
172
208
|
|
173
209
|
def self.modify_fields(record_field_details_path, modified_time)
|
174
|
-
modified_modules =
|
210
|
+
modified_modules = get_modules(modified_time)
|
175
211
|
record_field_details_json = JSON.parse(File.open(record_field_details_path).read)
|
176
|
-
record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] = get_current_time_in_millis
|
212
|
+
record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] = get_current_time_in_millis()
|
177
213
|
File.open(record_field_details_path, 'w') do |f|
|
178
214
|
f.write(record_field_details_json.to_json)
|
179
215
|
end
|
@@ -189,10 +225,30 @@ module Util
|
|
189
225
|
f.write(record_field_details_json.to_json)
|
190
226
|
end
|
191
227
|
modified_modules.each_key do |module_api_name|
|
192
|
-
|
228
|
+
module_data = modified_modules[module_api_name]
|
229
|
+
get_fields_info(module_data[Constants::API_NAME])
|
193
230
|
end
|
194
231
|
end
|
195
232
|
|
233
|
+
def self.verify_module_api_name(module_api_name)
|
234
|
+
|
235
|
+
if !module_api_name.nil?
|
236
|
+
if Constants::DEFAULT_MODULENAME_VS_APINAME.key? (module_api_name.downcase) && !Constants::DEFAULT_MODULENAME_VS_APINAME[module_api_name.downcase].nil?
|
237
|
+
return Constants::DEFAULT_MODULENAME_VS_APINAME[module_api_name.downcase]
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
record_field_details_path = get_record_json_file_path()
|
242
|
+
|
243
|
+
if File.exist? record_field_details_path
|
244
|
+
fields_json = JSON.parse(File.open(record_field_details_path).read)
|
245
|
+
if fields_json.key? Constants::SDK_MODULE_METADATA and fields_json[Constants::SDK_MODULE_METADATA].key? module_api_name.downcase
|
246
|
+
return fields_json[Constants::SDK_MODULE_METADATA][module_api_name.downcase][Constants::API_NAME]
|
247
|
+
end
|
248
|
+
end
|
249
|
+
return module_api_name
|
250
|
+
end
|
251
|
+
|
196
252
|
def self.delete_fields(record_field_details_json, module_api_name)
|
197
253
|
subform_modules = []
|
198
254
|
|
@@ -212,8 +268,8 @@ module Util
|
|
212
268
|
end
|
213
269
|
end
|
214
270
|
|
215
|
-
def self.get_record_json_file_path
|
216
|
-
Converter.new(nil).get_record_json_file_path
|
271
|
+
def self.get_record_json_file_path()
|
272
|
+
Converter.new(nil).get_record_json_file_path()
|
217
273
|
end
|
218
274
|
|
219
275
|
def self.get_related_lists(related_module_name, module_api_name, common_api_handler)
|
@@ -229,13 +285,14 @@ module Util
|
|
229
285
|
resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
|
230
286
|
Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
|
231
287
|
|
232
|
-
record_field_details_path = get_record_json_file_path
|
288
|
+
record_field_details_path = get_record_json_file_path()
|
233
289
|
if !File.exist?(record_field_details_path) || (File.exist?(record_field_details_path) && !(JSON.parse(File.read(record_field_details_path)).key? key))
|
234
290
|
is_new_data = true
|
235
291
|
related_list_values = get_related_list_details(module_api_name)
|
236
|
-
|
237
|
-
if File.exist? record_field_details_path
|
292
|
+
if File.exist? (record_field_details_path)
|
238
293
|
record_field_details_json = JSON.parse(File.read(record_field_details_path))
|
294
|
+
else
|
295
|
+
record_field_details_json = {}
|
239
296
|
end
|
240
297
|
record_field_details_json[key] = related_list_values
|
241
298
|
File.open(record_field_details_path, 'w') do |f|
|
@@ -253,6 +310,7 @@ module Util
|
|
253
310
|
end
|
254
311
|
rescue SDKException => e
|
255
312
|
SDKLog::SDKLogger.severe(Constants::EXCEPTION, e)
|
313
|
+
raise e
|
256
314
|
rescue StandardError => e
|
257
315
|
ex = SDKException.new(nil, Constants::EXCEPTION, nil, e)
|
258
316
|
SDKLog::SDKLogger.severe(Constants::EXCEPTION, ex)
|
@@ -347,12 +405,11 @@ module Util
|
|
347
405
|
def self.fill_data_type
|
348
406
|
return unless @@apitype_vs_datatype.empty?
|
349
407
|
|
350
|
-
field_api_names_string = %w[autonumber textarea text website email phone mediumtext
|
408
|
+
field_api_names_string = %w[autonumber textarea text website email phone mediumtext profileimage]
|
351
409
|
field_api_names_integer = %w[integer]
|
352
410
|
field_api_names_boolean = %w[boolean]
|
353
411
|
field_api_names_long = %w[bigint long]
|
354
412
|
field_api_names_double = %w[double percent lookup currency]
|
355
|
-
field_api_names_file = %w[imageupload]
|
356
413
|
field_api_names_field_file = %w[fileupload]
|
357
414
|
field_api_names_datetime = %w[datetime event_reminder]
|
358
415
|
field_api_names_date = %w[date]
|
@@ -367,6 +424,9 @@ module Util
|
|
367
424
|
field_api_names_recurring_activity = %w[RRULE]
|
368
425
|
field_api_names_reminder = %w[multireminder]
|
369
426
|
field_api_names_consent_look_up = %w[consent_lookup]
|
427
|
+
field_api_name_image_upload = %w[imageupload]
|
428
|
+
field_api_name_multiselect_lookup = %w[multiselectlookup]
|
429
|
+
field_api_name_line_tax = %w[linetax]
|
370
430
|
|
371
431
|
field_api_names_string.each do |field_api_name|
|
372
432
|
@@apitype_vs_datatype[field_api_name] = Constants::STRING
|
@@ -388,10 +448,6 @@ module Util
|
|
388
448
|
@@apitype_vs_datatype[field_api_name] = Constants::LONG
|
389
449
|
end
|
390
450
|
|
391
|
-
field_api_names_file.each do |field_api_name|
|
392
|
-
@@apitype_vs_datatype[field_api_name] = Constants::FILE_NAMESPACE
|
393
|
-
end
|
394
|
-
|
395
451
|
field_api_names_field_file.each do |field_api_name|
|
396
452
|
@@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
|
397
453
|
@@apitype_vs_structurename[field_api_name] = Constants::FIELD_FILE_NAMESPACE
|
@@ -435,7 +491,7 @@ module Util
|
|
435
491
|
field_api_names_multiuser_lookup.each do |field_api_name|
|
436
492
|
@@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
|
437
493
|
|
438
|
-
@@apitype_vs_structurename[field_api_name] = Constants::
|
494
|
+
@@apitype_vs_structurename[field_api_name] = Constants::RECORD_NAMESPACE
|
439
495
|
end
|
440
496
|
|
441
497
|
field_api_names_multimodule_lookup.each do |field_api_name|
|
@@ -465,6 +521,24 @@ module Util
|
|
465
521
|
|
466
522
|
@@apitype_vs_structurename[field_api_name] = Constants::CONSENT_NAMESPACE
|
467
523
|
end
|
524
|
+
|
525
|
+
field_api_name_image_upload.each do |field_api_name|
|
526
|
+
@@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
|
527
|
+
|
528
|
+
@@apitype_vs_structurename[field_api_name] = Constants::IMAGEUPLOAD_NAMESPACE
|
529
|
+
end
|
530
|
+
|
531
|
+
field_api_name_multiselect_lookup.each do |field_api_name|
|
532
|
+
@@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
|
533
|
+
|
534
|
+
@@apitype_vs_structurename[field_api_name] = Constants::RECORD_NAMESPACE
|
535
|
+
end
|
536
|
+
|
537
|
+
field_api_name_line_tax.each do |field_api_name|
|
538
|
+
@@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
|
539
|
+
|
540
|
+
@@apitype_vs_structurename[field_api_name] = Constants::LINE_TAX_NAMESPACE
|
541
|
+
end
|
468
542
|
end
|
469
543
|
|
470
544
|
def self.set_data_type(field_detail, field_instance, module_api_name)
|
@@ -478,13 +552,8 @@ module Util
|
|
478
552
|
if !field_instance.system_mandatory.nil? && field_instance.system_mandatory && !((module_api_name == Constants::CALLS.downcase) && (key_name.downcase == Constants::CALL_DURATION.downcase))
|
479
553
|
field_detail[Constants::REQUIRED] = true
|
480
554
|
end
|
481
|
-
|
482
|
-
|
483
|
-
field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
|
484
|
-
field_detail[Constants::STRUCTURE_NAME] = Constants::INVENTORY_LINE_ITEMS
|
485
|
-
field_detail[Constants::SKIP_MANDATORY] = true
|
486
|
-
return
|
487
|
-
elsif (key_name.downcase == Constants::PRICING_DETAILS.downcase) && (module_api_name == Constants::PRICE_BOOKS.downcase)
|
555
|
+
|
556
|
+
if (key_name.downcase == Constants::PRICING_DETAILS.downcase) && (module_api_name == Constants::PRICE_BOOKS.downcase)
|
488
557
|
field_detail[Constants::NAME] = key_name
|
489
558
|
field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
|
490
559
|
field_detail[Constants::STRUCTURE_NAME] = Constants::PRICINGDETAILS
|
@@ -498,7 +567,7 @@ module Util
|
|
498
567
|
return
|
499
568
|
elsif (key_name.downcase == Constants::COMMENTS.downcase) && ((module_api_name == Constants::SOLUTIONS.downcase) || (module_api_name == Constants::CASES.downcase))
|
500
569
|
field_detail[Constants::NAME] = key_name
|
501
|
-
field_detail[Constants::TYPE] = Constants::
|
570
|
+
field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
|
502
571
|
field_detail[Constants::STRUCTURE_NAME] = Constants::COMMENTS_NAMESPACE
|
503
572
|
field_detail[Constants::LOOKUP] = true
|
504
573
|
return
|
@@ -508,6 +577,27 @@ module Util
|
|
508
577
|
field_detail[Constants::LOOKUP] = true
|
509
578
|
field_detail[Constants::STRUCTURE_NAME] = Constants::LAYOUT_NAMESPACE
|
510
579
|
return
|
580
|
+
elsif (key_name.downcase() == Constants::TERRITORIES.downcase or key_name.downcase() == Constants::TERRITORY.downcase) and !field_instance.custom_field.nil? and !field_instance.custom_field
|
581
|
+
field_detail[Constants::NAME] = key_name
|
582
|
+
field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
|
583
|
+
field_detail[Constants::STRUCTURE_NAME] = Constants::TERRITORY_NAMESPACE
|
584
|
+
field_detail[Constants::LOOKUP] = true
|
585
|
+
return
|
586
|
+
elsif key_name.downcase() == Constants::PRODUCT_NAME.downcase and Constants::INVENTORY_MODULES_ITEMS.include? module_api_name.downcase
|
587
|
+
field_detail[Constants::NAME] = key_name
|
588
|
+
field_detail[Constants::TYPE] = Constants::LINEITEM_PRODUCT
|
589
|
+
field_detail[Constants::STRUCTURE_NAME] = Constants::LINEITEM_PRODUCT
|
590
|
+
field_detail[Constants::LOOKUP] = true
|
591
|
+
return
|
592
|
+
elsif key_name.downcase() == Constants::DISCOUNT.downcase and Constants::INVENTORY_MODULES_ITEMS.include? module_api_name.downcase
|
593
|
+
field_detail[Constants::NAME] = key_name
|
594
|
+
field_detail[Constants::TYPE] = Constants::STRING
|
595
|
+
return
|
596
|
+
elsif key_name.downcase() == Constants::TAX.downcase and module_api_name.downcase() == Constants::PRODUCTS.downcase
|
597
|
+
field_detail[Constants::NAME] = key_name
|
598
|
+
field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
|
599
|
+
field_detail[Constants::STRUCTURE_NAME] = Constants::TAX_NAMESPACE
|
600
|
+
return
|
511
601
|
elsif @@apitype_vs_datatype.include? data_type
|
512
602
|
field_detail[Constants::TYPE] = @@apitype_vs_datatype[data_type]
|
513
603
|
elsif data_type.downcase == Constants::FORMULA.downcase
|
@@ -524,6 +614,30 @@ module Util
|
|
524
614
|
field_detail[Constants::LOOKUP] = true if data_type.downcase.include? Constants::LOOKUP
|
525
615
|
field_detail[Constants::SKIP_MANDATORY] = true if data_type.downcase.include? Constants::CONSENT_LOOKUP
|
526
616
|
|
617
|
+
if data_type.downcase.include? Constants::MULTI_SELECT_LOOKUP
|
618
|
+
field_detail[Constants::SKIP_MANDATORY] = true
|
619
|
+
if !field_instance.multiselectlookup.nil?
|
620
|
+
if !field_instance.multiselectlookup.linking_module.nil?
|
621
|
+
linking_module = field_instance.multiselectlookup.linking_module
|
622
|
+
field_detail[Constants::MODULE] = linking_module
|
623
|
+
module_name = linking_module
|
624
|
+
end
|
625
|
+
end
|
626
|
+
field_detail[Constants::SUBFORM] = true
|
627
|
+
end
|
628
|
+
|
629
|
+
if data_type.downcase.include? Constants::MULTI_USER_LOOKUP
|
630
|
+
field_detail[Constants::SKIP_MANDATORY] = true
|
631
|
+
if !field_instance.multiuserlookup.nil?
|
632
|
+
if !field_instance.multiuserlookup.linking_module.nil?
|
633
|
+
linking_module = field_instance.multiuserlookup.linking_module
|
634
|
+
field_detail[Constants::MODULE] = linking_module
|
635
|
+
module_name = linking_module
|
636
|
+
end
|
637
|
+
end
|
638
|
+
field_detail[Constants::SUBFORM] = true
|
639
|
+
end
|
640
|
+
|
527
641
|
if @@apitype_vs_structurename.include? data_type
|
528
642
|
field_detail[Constants::STRUCTURE_NAME] = @@apitype_vs_structurename[data_type]
|
529
643
|
end
|
@@ -545,7 +659,7 @@ module Util
|
|
545
659
|
field_detail[Constants::MODULE] = module_name
|
546
660
|
end
|
547
661
|
|
548
|
-
if data_type.downcase == Constants::LOOKUP.downcase
|
662
|
+
if data_type.downcase == Constants::LOOKUP.downcase && !field_instance.lookup.nil?
|
549
663
|
module_name = field_instance.lookup.module
|
550
664
|
if !module_name.nil? && (module_name.downcase != Constants::SE_MODULE.downcase)
|
551
665
|
field_detail[Constants::MODULE] = module_name
|
@@ -557,16 +671,11 @@ module Util
|
|
557
671
|
end
|
558
672
|
field_detail[Constants::LOOKUP] = true
|
559
673
|
end
|
560
|
-
|
674
|
+
get_fields_info(module_name) if !module_name.nil? && !module_name.empty?
|
561
675
|
field_detail[Constants::NAME] = key_name
|
562
676
|
end
|
563
|
-
|
564
|
-
def self.get_modules
|
565
|
-
@@sync_lock.synchronize do
|
566
|
-
@@api_supported_module = get_modules_api_names(nil)
|
567
|
-
end
|
568
|
-
end
|
569
|
-
def self.get_modules_api_names(header)
|
677
|
+
|
678
|
+
def self.get_modules(header)
|
570
679
|
api_names = {}
|
571
680
|
header_map = HeaderMap.new
|
572
681
|
unless header.nil?
|
@@ -585,7 +694,12 @@ module Util
|
|
585
694
|
if response_object.is_a? Modules::ResponseWrapper
|
586
695
|
modules = response_object.modules
|
587
696
|
modules.each do |module_ins|
|
588
|
-
|
697
|
+
if module_ins.api_supported
|
698
|
+
module_details = {}
|
699
|
+
module_details[Constants::API_NAME]=module_ins.api_name
|
700
|
+
module_details[Constants::GENERATED_TYPE]=module_ins.generated_type.value
|
701
|
+
api_names[module_ins.api_name.downcase] =module_details
|
702
|
+
end
|
589
703
|
end
|
590
704
|
elsif response_object.is_a? Modules::APIException
|
591
705
|
error_response = {}
|
@@ -596,6 +710,15 @@ module Util
|
|
596
710
|
end
|
597
711
|
end
|
598
712
|
end
|
713
|
+
if header.nil?
|
714
|
+
begin
|
715
|
+
initializer = Initializer.get_initializer
|
716
|
+
resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
|
717
|
+
Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
|
718
|
+
record_field_details_path = get_record_json_file_path()
|
719
|
+
write_module_meta_data(record_field_details_path, api_names)
|
720
|
+
end
|
721
|
+
end
|
599
722
|
api_names
|
600
723
|
end
|
601
724
|
|
@@ -609,7 +732,7 @@ module Util
|
|
609
732
|
|
610
733
|
if related_list_jo[Constants::MODULE] != Constants::NULL_VALUE
|
611
734
|
common_api_handler.module_api_name = related_list_jo[Constants::MODULE]
|
612
|
-
|
735
|
+
get_fields_info(related_list_jo[Constants::MODULE])
|
613
736
|
end
|
614
737
|
return true
|
615
738
|
end
|
@@ -617,6 +740,70 @@ module Util
|
|
617
740
|
false
|
618
741
|
end
|
619
742
|
|
743
|
+
def self.verify_photo_support(module_api_name)
|
744
|
+
@@sync_lock.synchronize do
|
745
|
+
begin
|
746
|
+
module_api_name = verify_module_api_name(module_api_name)
|
747
|
+
if Constants::PHOTO_SUPPORTED_MODULES.include? module_api_name.downcase
|
748
|
+
return true
|
749
|
+
end
|
750
|
+
modules = get_module_names()
|
751
|
+
|
752
|
+
if modules.key? module_api_name.downcase || !modules[module_api_name.downcase].nil?
|
753
|
+
module_meta_data = modules[module_api_name.downcase]
|
754
|
+
|
755
|
+
if module_meta_data.key? Constants::GENERATED_TYPE && module_meta_data[Constants::GENERATED_TYPE] != Constants::GENERATED_TYPE_CUSTOM
|
756
|
+
raise SDKException.new(Constants::UPLOAD_PHOTO_UNSUPPORTED_ERROR,Constants::UPLOAD_PHOTO_UNSUPPORTED_MESSAGE + module_api_name)
|
757
|
+
end
|
758
|
+
end
|
759
|
+
rescue SDKException => e
|
760
|
+
raise e
|
761
|
+
rescue StandardError => e
|
762
|
+
ex = SDKException.new(nil, Constants::EXCEPTION, nil, e)
|
763
|
+
SDKLog::SDKLogger.severe(Constants::EXCEPTION, ex)
|
764
|
+
raise ex
|
765
|
+
end
|
766
|
+
return true
|
767
|
+
end
|
768
|
+
end
|
769
|
+
|
770
|
+
def self.get_module_names()
|
771
|
+
module_data = {}
|
772
|
+
initializer = Initializer.get_initializer
|
773
|
+
resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
|
774
|
+
Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
|
775
|
+
|
776
|
+
record_field_details_path = get_record_json_file_path()
|
777
|
+
|
778
|
+
call_get_modules = false
|
779
|
+
if File.exists? record_field_details_path
|
780
|
+
json = JSON.parse(File.read(record_field_details_path))
|
781
|
+
if !json.key? Constants::SDK_MODULE_METADATA
|
782
|
+
call_get_modules = true
|
783
|
+
elsif json[Constants::SDK_MODULE_METADATA].nil? || json[Constants::SDK_MODULE_METADATA].length == 0
|
784
|
+
call_get_modules = true
|
785
|
+
end
|
786
|
+
else
|
787
|
+
call_get_modules = true
|
788
|
+
end
|
789
|
+
if call_get_modules
|
790
|
+
module_data = get_modules(nil)
|
791
|
+
write_module_meta_data(record_field_details_path, module_data)
|
792
|
+
return module_data
|
793
|
+
end
|
794
|
+
record_field_details_json = JSON.parse(File.read(record_field_details_path))
|
795
|
+
module_data = record_field_details_json[Constants::SDK_MODULE_METADATA]
|
796
|
+
return module_data
|
797
|
+
end
|
798
|
+
|
799
|
+
def self.write_module_meta_data(record_field_details_path, module_data)
|
800
|
+
field_details_json = (File.exist? record_field_details_path) ? JSON.parse(File.read(record_field_details_path)):{}
|
801
|
+
field_details_json[Constants::SDK_MODULE_METADATA] = module_data
|
802
|
+
File.open(record_field_details_path, 'w') do |f|
|
803
|
+
f.write(field_details_json.to_json)
|
804
|
+
end
|
805
|
+
end
|
806
|
+
|
620
807
|
def self.get_related_list_details(module_api_name)
|
621
808
|
rlo = RelatedLists::RelatedListsOperations.new(module_api_name)
|
622
809
|
response = rlo.get_related_lists
|
@@ -660,7 +847,7 @@ module Util
|
|
660
847
|
|
661
848
|
def self.refresh_modules
|
662
849
|
@@force_refresh = true
|
663
|
-
|
850
|
+
get_fields_info(nil)
|
664
851
|
@@force_refresh = false
|
665
852
|
end
|
666
853
|
|