@@ -107,18 +107,18 @@ public static Schema getSchema(AuthenticatorCredentials credentials, SObjectDesc
107
107
*
108
108
* @param credentials connection credentials
109
109
* @param sObjectDescriptor sObject descriptor
110
- * @param setAllCustomFieldsNullable set all custom fields nullable by default
110
+ * @param setAllFieldsNullable set all fields nullable by default
111
111
* @return CDAP schema
112
112
* @throws ConnectionException if unable to connect to Salesforce
113
113
*/
114
114
public static Schema getSchema (AuthenticatorCredentials credentials , SObjectDescriptor sObjectDescriptor ,
115
- boolean setAllCustomFieldsNullable )
115
+ boolean setAllFieldsNullable )
116
116
throws ConnectionException {
117
117
PartnerConnection partnerConnection = SalesforceConnectionUtil .getPartnerConnection (credentials );
118
118
SObjectsDescribeResult describeResult = SObjectsDescribeResult .of (partnerConnection ,
119
119
sObjectDescriptor .getName (), sObjectDescriptor .getFeaturedSObjects ());
120
120
121
- return getSchemaWithFields (sObjectDescriptor , describeResult , setAllCustomFieldsNullable );
121
+ return getSchemaWithFields (sObjectDescriptor , describeResult , setAllFieldsNullable );
122
122
}
123
123
124
124
/**
@@ -211,15 +211,15 @@ public static Schema getSchemaWithFields(SObjectDescriptor sObjectDescriptor,
211
211
212
212
public static Schema getSchemaWithFields (SObjectDescriptor sObjectDescriptor ,
213
213
SObjectsDescribeResult describeResult ,
214
- boolean setAllCustomFieldsNullable ) {
214
+ boolean setAllFieldsNullable ) {
215
215
return getSchemaWithFields (sObjectDescriptor , describeResult ,
216
- Collections .emptyList (), setAllCustomFieldsNullable );
216
+ Collections .emptyList (), setAllFieldsNullable );
217
217
}
218
218
219
219
public static Schema getSchemaWithFields (SObjectDescriptor sObjectDescriptor ,
220
220
SObjectsDescribeResult describeResult ,
221
221
List <String > topLevelParents ,
222
- boolean setAllCustomFieldsNullable ) {
222
+ boolean setAllFieldsNullable ) {
223
223
List <Schema .Field > schemaFields = new ArrayList <>();
224
224
225
225
for (SObjectDescriptor .FieldDescriptor fieldDescriptor : sObjectDescriptor .getFields ()) {
@@ -238,7 +238,7 @@ public static Schema getSchemaWithFields(SObjectDescriptor sObjectDescriptor,
238
238
fieldDescriptor .getFullName (), parentsPath ));
239
239
}
240
240
241
- fieldSchema = createFieldSchema (field , fieldDescriptor .hasParents (), setAllCustomFieldsNullable );
241
+ fieldSchema = createFieldSchema (field , fieldDescriptor .hasParents (), setAllFieldsNullable );
242
242
}
243
243
244
244
Schema queryFieldSchema = functionType .getSchema (fieldSchema );
@@ -274,7 +274,7 @@ public static Schema getSchemaWithFields(SObjectDescriptor sObjectDescriptor,
274
274
*/
275
275
for (SObjectDescriptor childSObject : sObjectDescriptor .getChildSObjects ()) {
276
276
Schema childSchema = getSchemaWithFields (childSObject , describeResult ,
277
- Collections .singletonList (sObjectDescriptor .getName ()), setAllCustomFieldsNullable );
277
+ Collections .singletonList (sObjectDescriptor .getName ()), setAllFieldsNullable );
278
278
279
279
String childName = normalizeAvroName (childSObject .getName ());
280
280
Schema .Field childField = Schema .Field .of (childName ,
@@ -288,9 +288,9 @@ public static Schema getSchemaWithFields(SObjectDescriptor sObjectDescriptor,
288
288
289
289
// Setting all the child columns as Nullable as in child object these fields can be mandatory but its reference
290
290
// object in parent class can be null.
291
- private static Schema createFieldSchema (Field field , boolean isChild , boolean setAllCustomFieldsNullable ) {
291
+ private static Schema createFieldSchema (Field field , boolean isChild , boolean setAllFieldsNullable ) {
292
292
Schema fieldSchema = SALESFORCE_TYPE_TO_CDAP_SCHEMA .getOrDefault (field .getType (), DEFAULT_SCHEMA );
293
- return field .isNillable () || isChild || ( setAllCustomFieldsNullable && field . isCustom ()) ?
293
+ return field .isNillable () || isChild || setAllFieldsNullable ?
294
294
Schema .nullableOf (fieldSchema ) : fieldSchema ;
295
295
}
296
296
}
0 commit comments