|
@@ -14,6 +14,7 @@ import com.rthoni.intellij.codefromds.dbo.template.ColumnDataSourceDbo;
|
14
|
14
|
import com.rthoni.intellij.codefromds.dbo.template.DataSourceDbo;
|
15
|
15
|
import com.rthoni.intellij.codefromds.dbo.template.ForeignKeyDbo;
|
16
|
16
|
import com.rthoni.intellij.codefromds.dbo.template.TableDataSourceDbo;
|
|
17
|
+import org.json.JSONArray;
|
17
|
18
|
import org.json.JSONObject;
|
18
|
19
|
import org.jtwig.JtwigModel;
|
19
|
20
|
import org.jtwig.JtwigTemplate;
|
|
@@ -79,7 +80,7 @@ public abstract class Generator {
|
79
|
80
|
|
80
|
81
|
return dbo;
|
81
|
82
|
}
|
82
|
|
-
|
|
83
|
+
|
83
|
84
|
public static String convertSqlType(DataType type, TypesCastOptions options)
|
84
|
85
|
{
|
85
|
86
|
boolean isArray = type.typeName.endsWith("[]");
|
|
@@ -108,7 +109,9 @@ public abstract class Generator {
|
108
|
109
|
dbo.setName(columnSelection.getColumn().getName());
|
109
|
110
|
dbo.setPrimary(DasUtil.isPrimary(columnSelection.getColumn()));
|
110
|
111
|
dbo.setSelected(columnSelection.isSelected());
|
|
112
|
+ dbo.setNotNull(columnSelection.getColumn().isNotNull());
|
111
|
113
|
dbo.setType(convertSqlType(columnSelection.getColumn().getDataType(), options));
|
|
114
|
+ dbo.setTypeNotNull(options.getNonNullableTypes().contains(dbo.getType()));
|
112
|
115
|
|
113
|
116
|
return dbo;
|
114
|
117
|
}
|
|
@@ -167,6 +170,13 @@ public abstract class Generator {
|
167
|
170
|
}
|
168
|
171
|
dbo.setTypes(map);
|
169
|
172
|
|
|
173
|
+ List<String> nonNullableTypes = new Vector<>();
|
|
174
|
+ JSONArray array = obj.getJSONArray("non-nullable-types");
|
|
175
|
+ for (int i = 0; i < array.length(); ++i) {
|
|
176
|
+ nonNullableTypes.add(array.getString(i));
|
|
177
|
+ }
|
|
178
|
+ dbo.setNonNullableTypes(nonNullableTypes);
|
|
179
|
+
|
170
|
180
|
dbo.setArrayTemplate(obj.getString("arrayTemplate"));
|
171
|
181
|
|
172
|
182
|
return dbo;
|