Skip to content

Commit

Permalink
Merge pull request #965 from ashitsalesforce/master
Browse files Browse the repository at this point in the history
remove the limit on the number of parent object types for a polymorph…
  • Loading branch information
ashitsalesforce authored Feb 6, 2024
2 parents d74d114 + a7e1ea9 commit ca919f1
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions src/main/java/com/salesforce/dataloader/client/PartnerClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import com.sforce.soap.partner.DescribeSObjectResult;
import com.sforce.soap.partner.Error;
import com.sforce.soap.partner.Field;
import com.sforce.soap.partner.FieldType;
import com.sforce.soap.partner.GetUserInfoResult;
import com.sforce.soap.partner.LimitInfo;
import com.sforce.soap.partner.LimitInfoHeader_element;
Expand Down Expand Up @@ -793,12 +792,7 @@ public void setFieldReferenceDescribes() throws ConnectionException {
// it is neither modifiable nor updateable.
continue;
}

if (parentObjectNames.length >= DescribeRefObject.MAX_PARENT_OBJECTS_IN_REFERENCING_FIELD) {
childObjectField.setLabel(childObjectField.getLabel() + " (Id)");
} else {
processParentObjectArrayForLookupReferences(parentObjectNames, childObjectField);
}
processParentObjectArrayForLookupReferences(parentObjectNames, childObjectField);
}
}
}
Expand Down Expand Up @@ -826,25 +820,8 @@ private void processParentFieldForLookupReference(Field parentField, Field child
if (!parentField.isIdLookup()) {
return;
}
if (parentField.getType() == FieldType.id) {
updateChildFieldLabelWithParentIdLabels(parentField, childObjectField, parentObjectIndex, totalParentObjects);
} else if (numParentTypes <= DescribeRefObject.MAX_PARENT_OBJECTS_IN_REFERENCING_FIELD) {
parentIdLookupFieldMap.put(parentField.getName(), parentField);
}
}

private void updateChildFieldLabelWithParentIdLabels(Field parentField, Field childObjectField, int parentObjectIndex, int totalParentObjects) {
String childFieldLabel = childObjectField.getLabel().split(" \\(.+\\)$")[0];
if (parentObjectIndex == 0) {
childFieldLabel += " (";
} else {
childFieldLabel += ", ";
}
childFieldLabel += parentField.getLabel();
if (parentObjectIndex == totalParentObjects - 1) {
childFieldLabel += ")";
}
childObjectField.setLabel(childFieldLabel);
parentIdLookupFieldMap.put(parentField.getName(), parentField);

}

/**
Expand Down

0 comments on commit ca919f1

Please sign in to comment.