@@ -70,33 +70,43 @@ class DASSalesforce(options: Map[String, String]) extends DASSdk with StrictLogg
70
70
contentDocumentLinkTable,
71
71
contentVersionTable)
72
72
73
+ private val maybeDatedConversionRateTable : Option [DASSalesforceDatedConversionRateTable ] = {
74
+ try {
75
+ val description = connector.describeSObject(" DatedConversionRate" )
76
+ logger.info(s " Found DatedConversionRate ( ${description.getName}) " )
77
+ Some (new DASSalesforceDatedConversionRateTable (connector))
78
+ } catch {
79
+ case e : ApiException =>
80
+ logger.warn(" DatedConversionRate not found" , e)
81
+ None
82
+ }
83
+ }
84
+
73
85
private val dynamicTableNames = {
74
86
options.get(" dynamic_objects" ) match {
75
87
case Some (objectNames) =>
76
88
val objs = objectNames.strip()
77
89
if (objs.isEmpty) {
78
90
Seq .empty
79
91
} else {
80
- objs.split(" ," ).map(_.strip).filter(_.nonEmpty).toSeq
92
+ // Get the names of the static tables to avoid duplicates
93
+ val staticNames = staticTables.map(_.salesforceObjectName).toSet ++ maybeDatedConversionRateTable
94
+ .map(_.salesforceObjectName)
95
+ .toSet
96
+ objs
97
+ .split(" ," )
98
+ .map(_.strip)
99
+ .filter(_.nonEmpty)
100
+ .distinct // Remove duplicates
101
+ .filterNot(staticNames.contains) // Ignore duplicates of static tables
102
+ .toSeq
81
103
}
82
104
case None => Seq .empty
83
105
}
84
106
}
85
107
86
108
logger.debug(s " Dynamic tables: $dynamicTableNames" )
87
109
88
- private val maybeDatedConversionRateTable : Option [DASSalesforceDatedConversionRateTable ] = {
89
- try {
90
- val description = connector.describeSObject(" DatedConversionRate" )
91
- logger.info(s " Found DatedConversionRate ( ${description.getName}) " )
92
- Some (new DASSalesforceDatedConversionRateTable (connector))
93
- } catch {
94
- case e : ApiException =>
95
- logger.warn(" DatedConversionRate not found" , e)
96
- None
97
- }
98
- }
99
-
100
110
private val dynamicTables = dynamicTableNames.map(name => new DASSalesforceDynamicTable (connector, name))
101
111
102
112
private val allTables = staticTables ++ dynamicTables ++ maybeDatedConversionRateTable
0 commit comments