@@ -41,9 +41,9 @@ public boolean initialize(PropertyHelper propertyHelper) {
41
41
propertyHelper .getStringList (KnownProperties .TARGET_PRIMARY_KEY ));
42
42
putMigrateDataTypeList (Property .TARGET_PRIMARY_TYPES_WITHOUT_CONSTANT , targetPrimaryKeyTypesWithoutConstantColumns );
43
43
44
+ isInitialized = true ;
44
45
if (!isValid (propertyHelper )) return false ;
45
46
isEnabled = null !=columnNames && !columnNames .isEmpty ();
46
- isInitialized = true ;
47
47
return true ;
48
48
}
49
49
@@ -82,28 +82,31 @@ private List<MigrateDataType> targetPrimaryKeyTypesWithoutConstantColumns(List<S
82
82
}
83
83
84
84
private boolean isValid (PropertyHelper propertyHelper ) {
85
- List <String > columnNames = getStringList (Property .COLUMN_NAMES );
86
- List <MigrateDataType > columnTypes = getMigrateDataTypeList (Property .COLUMN_TYPES );
87
- List <String > columnValues = getStringList (Property .COLUMN_VALUES );
88
- List <MigrateDataType > targetPrimaryKeyTypesWithoutConstantColumns = getMigrateDataTypeList (Property .TARGET_PRIMARY_TYPES_WITHOUT_CONSTANT );
85
+ List <String > columnNames = getRawStringList (Property .COLUMN_NAMES );
86
+ List <MigrateDataType > columnTypes = getRawMigrateDataTypeList (Property .COLUMN_TYPES );
87
+ List <String > columnValues = getRawStringList (Property .COLUMN_VALUES );
88
+ List <MigrateDataType > targetPrimaryKeyTypesWithoutConstantColumns = getRawMigrateDataTypeList (Property .TARGET_PRIMARY_TYPES_WITHOUT_CONSTANT );
89
+
90
+ boolean haveColumnNames = null !=columnNames && !columnNames .isEmpty ();
91
+ boolean haveColumnTypes = null !=columnTypes && !columnTypes .isEmpty ();
92
+ boolean haveColumnValues = null !=columnValues && !columnValues .isEmpty ();
89
93
90
94
boolean valid = true ;
91
- if (!(columnNames == null || columnNames .isEmpty ()) &&
92
- (columnTypes == null || columnTypes .isEmpty ()) &&
93
- (columnValues == null || columnValues .isEmpty ())
94
- && !(columnNames != null && !columnNames .isEmpty () &&
95
- columnTypes != null && !columnTypes .isEmpty () &&
96
- columnValues != null && !columnValues .isEmpty ())) {
95
+ if ((!haveColumnNames && !haveColumnTypes && !haveColumnValues ) ||
96
+ ( haveColumnNames && haveColumnTypes && haveColumnValues )) {
97
+ // These are the valid conditions...anything else is not valid
98
+ }
99
+ else {
97
100
logger .error ("Properties must all be empty, or all not empty: {}={}, {}={}, {}={} (split by {}={})" ,
98
- KnownProperties .CONSTANT_COLUMN_NAMES , columnNames ,
99
- KnownProperties .CONSTANT_COLUMN_TYPES , columnTypes ,
100
- KnownProperties .CONSTANT_COLUMN_VALUES , columnValues ,
101
- KnownProperties .CONSTANT_COLUMN_SPLIT_REGEX , propertyHelper .getAsString (KnownProperties .CONSTANT_COLUMN_SPLIT_REGEX ));
101
+ KnownProperties .CONSTANT_COLUMN_NAMES , columnNames ,
102
+ KnownProperties .CONSTANT_COLUMN_TYPES , columnTypes ,
103
+ KnownProperties .CONSTANT_COLUMN_VALUES , columnValues ,
104
+ KnownProperties .CONSTANT_COLUMN_SPLIT_REGEX , propertyHelper .getAsString (KnownProperties .CONSTANT_COLUMN_SPLIT_REGEX ));
102
105
valid = false ;
103
106
}
104
107
105
- if (null != columnNames &&
106
- (columnNames .size () != columnTypes .size () ||
108
+ if (haveColumnNames && haveColumnTypes && haveColumnValues &&
109
+ (columnNames .size () != columnTypes .size () ||
107
110
columnNames .size () != columnValues .size ())) {
108
111
logger .error ("Values must have the same number of elements: {}={}, {}={}, {}={} (split by {}={})" ,
109
112
KnownProperties .CONSTANT_COLUMN_NAMES , columnNames ,
0 commit comments