Bladeren bron

added default column value

tags/v1.1.0
Robin Thoni 8 jaren geleden
bovenliggende
commit
a4783c942c

+ 2
- 0
.gitignore Bestand weergeven

@@ -1,3 +1,5 @@
1
+*.zip
2
+
1 3
 # Created by .ignore support plugin (hsz.mobi)
2 4
 ### Java template
3 5
 *.class

+ 1
- 0
src/com/rthoni/intellij/codefromds/business/Generator.java Bestand weergeven

@@ -112,6 +112,7 @@ public abstract class Generator {
112 112
         dbo.setNotNull(columnSelection.getColumn().isNotNull());
113 113
         dbo.setType(convertSqlType(columnSelection.getColumn().getDataType(), options));
114 114
         dbo.setTypeNotNull(options.getNonNullableTypes().contains(dbo.getType()));
115
+        dbo.setDefaultValue(columnSelection.getColumn().getDefault());
115 116
 
116 117
         return dbo;
117 118
     }

+ 21
- 0
src/com/rthoni/intellij/codefromds/dbo/template/ColumnDataSourceDbo.java Bestand weergeven

@@ -1,5 +1,7 @@
1 1
 package com.rthoni.intellij.codefromds.dbo.template;
2 2
 
3
+import org.apache.commons.lang.StringEscapeUtils;
4
+
3 5
 /**
4 6
  * Created by robin on 11/18/16.
5 7
  */
@@ -17,6 +19,8 @@ public class ColumnDataSourceDbo {
17 19
 
18 20
     private boolean _typeNotNull;
19 21
 
22
+    private String _defaultValue;
23
+
20 24
     public String getName() {
21 25
         return _name;
22 26
     }
@@ -64,4 +68,21 @@ public class ColumnDataSourceDbo {
64 68
     public void setTypeNotNull(boolean typeNotNull) {
65 69
         _typeNotNull = typeNotNull;
66 70
     }
71
+
72
+    public String getDefaultValue() {
73
+        return _defaultValue;
74
+    }
75
+
76
+    public String getDefaultValueEscaped() {
77
+        return StringEscapeUtils.escapeJava(_defaultValue);
78
+    }
79
+
80
+    public boolean hasDefaultValue()
81
+    {
82
+        return _defaultValue != null && !_defaultValue.equals("");
83
+    }
84
+
85
+    public void setDefaultValue(String defaultValue) {
86
+        _defaultValue = defaultValue;
87
+    }
67 88
 }

Laden…
Annuleren
Opslaan