Skip to content

Commit 4e9be57

Browse files
Merge branch 'release/0.6.4.4' into release/0.6.4
# Conflicts: # fj-core/pom.xml # fj-ext/pom.xml # fj-test/pom.xml # fj-tool/pom.xml # pom.xml
2 parents d6762aa + eacb37d commit 4e9be57

File tree

10 files changed

+74
-10
lines changed

10 files changed

+74
-10
lines changed

fj-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-lib</artifactId>
10-
<version>0.6.4</version>
10+
<version>0.6.4.4</version>
1111
</parent>
1212

1313
<name>fj-core</name>

fj-core/src/main/java/org/fugerit/java/core/cfg/xml/GenericListCatalogConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ protected Collection<T> newCollection( Object typeSample, String listType, Eleme
248248
return c;
249249
}
250250

251-
protected T customEntryHandling( T current ) {
251+
protected T customEntryHandling( T current, Element element ) throws ConfigException {
252252
return current;
253253
}
254254

@@ -326,13 +326,13 @@ public void configure(Element tag) throws ConfigException {
326326
} else {
327327
@SuppressWarnings("unchecked")
328328
T id = ((T)idSchema);
329-
id = this.customEntryHandling( id );
329+
id = this.customEntryHandling( id, currentSchemaTag );
330330
listCurrent.add( id );
331331
}
332332
} else {
333333
try {
334334
T t = XmlBeanHelper.setFromElement( type, currentSchemaTag, beanMode );
335-
t = this.customEntryHandling( t );
335+
t = this.customEntryHandling( t, currentSchemaTag );
336336
listCurrent.add( t );
337337
} catch (Exception e) {
338338
throw new ConfigException( "Error configuring type : "+e, e );

fj-core/src/main/java/org/fugerit/java/core/db/dao/FieldFactory.java

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import java.sql.SQLException;
2525
import java.sql.Types;
2626

27+
import org.fugerit.java.core.db.daogen.ByteArrayDataHandler;
28+
import org.fugerit.java.core.db.daogen.CharArrayDataHandler;
2729
import org.fugerit.java.core.db.helpers.BlobData;
2830
import org.fugerit.java.core.db.helpers.DAOID;
2931

@@ -97,10 +99,22 @@ public Field newField(int value) {
9799
return (new IntField(value));
98100
}
99101

102+
public Field newField(ByteArrayDataHandler value) {
103+
return new BlobDataField( BlobData.valueOf( (ByteArrayDataHandler)value ) );
104+
}
105+
106+
public Field newField(CharArrayDataHandler value) {
107+
return new ClobDataField( value );
108+
}
109+
100110
public Field newField(Object value) {
101111
Field field = null;
102112
if ( value instanceof BlobData ) {
103113
field = new BlobDataField( (BlobData)value );
114+
} else if( value instanceof CharArrayDataHandler ) {
115+
field = newField( ((CharArrayDataHandler)value) );
116+
} else if( value instanceof ByteArrayDataHandler ) {
117+
field = newField( ((ByteArrayDataHandler)value) );
104118
} else if (value instanceof DAOID) {
105119
field = this.newField( (DAOID)value );
106120
} else {
@@ -155,7 +169,17 @@ public ObjectField(Object value) {
155169
* @see it.finanze.secin.shared.dao.Field#setField(java.sql.PreparedStatement, int)
156170
*/
157171
public void setField(PreparedStatement ps, int index) throws SQLException {
158-
ps.setObject(index, this.value);
172+
if ( this.value == null ) {
173+
ps.setObject(index, this.value);
174+
} else if ( this.value instanceof java.sql.Date ) {
175+
ps.setDate(index, ((java.sql.Date)this.value));
176+
} else if ( this.value instanceof java.sql.Timestamp ) {
177+
ps.setTimestamp(index, ((java.sql.Timestamp)this.value));
178+
} else if ( this.value instanceof java.util.Date ) {
179+
ps.setTimestamp(index, new java.sql.Timestamp( ((java.util.Date)this.value).getTime() ) );
180+
} else {
181+
ps.setObject(index, this.value);
182+
}
159183
}
160184

161185
private Object value;
@@ -183,6 +207,27 @@ public void setField(PreparedStatement ps, int index) throws SQLException {
183207

184208
}
185209

210+
class ClobDataField extends Field {
211+
212+
public String toString() {
213+
return this.getClass().getName()+"[value:"+this.value+"]";
214+
}
215+
216+
public ClobDataField( CharArrayDataHandler value ) {
217+
this.value = value;
218+
}
219+
220+
/* (non-Javadoc)
221+
* @see it.finanze.secin.shared.dao.Field#setField(java.sql.PreparedStatement, int)
222+
*/
223+
public void setField(PreparedStatement ps, int index) throws SQLException {
224+
ps.setCharacterStream(index, this.value.toReader() );
225+
}
226+
227+
private CharArrayDataHandler value;
228+
229+
}
230+
186231
class StringField extends Field {
187232

188233
public String toString() {

fj-core/src/main/java/org/fugerit/java/core/db/dao/FieldList.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import java.util.ArrayList;
2424
import java.util.List;
2525

26+
import org.fugerit.java.core.db.daogen.ByteArrayDataHandler;
27+
import org.fugerit.java.core.db.daogen.CharArrayDataHandler;
28+
import org.fugerit.java.core.db.helpers.BlobData;
2629
import org.fugerit.java.core.db.helpers.DAOID;
2730

2831
/**
@@ -101,5 +104,13 @@ public void addField(String value) {
101104
public void addNullField(int type) {
102105
this.addField( fieldFactory.nullField(type) );
103106
}
107+
108+
public void addField( ByteArrayDataHandler value) {
109+
this.addField( fieldFactory.newField( BlobData.valueOf( value) ) );
110+
}
111+
112+
public void addField( CharArrayDataHandler value) {
113+
this.addField( fieldFactory.newField( (CharArrayDataHandler)value ) );
114+
}
104115

105116
}

fj-core/src/main/java/org/fugerit/java/core/db/daogen/SelectHelper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class SelectHelper extends QueryHelper {
2525

2626
public static final String COMPARE_LT_EQUAL = " <= ";
2727

28+
public static final String COMPARE_GT_EQUAL = " >= ";
29+
2830
public static final String ORDER_ASC = "ASC";
2931

3032
public static final String ORDER_DESC = "DESC";

fj-core/src/main/java/org/fugerit/java/core/db/helpers/BlobData.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.sql.Blob;
77
import java.sql.SQLException;
88

9+
import org.fugerit.java.core.db.daogen.ByteArrayDataHandler;
910
import org.fugerit.java.core.io.StreamIO;
1011

1112
/**
@@ -30,12 +31,17 @@ public static BlobData valueOf( Blob b ) throws SQLException {
3031
is.close();
3132
blobData.setData( baos.toByteArray() );
3233
} catch (Exception e) {
33-
e.printStackTrace();
3434
throw ( new SQLException( e.toString() ) );
3535
}
3636
return blobData;
3737
}
3838

39+
public static BlobData valueOf( ByteArrayDataHandler b ) {
40+
BlobData blobData = new BlobData();
41+
blobData.setData( b.getData() );
42+
return blobData;
43+
}
44+
3945
private byte[] data;
4046

4147
/*

fj-ext/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-lib</artifactId>
10-
<version>0.6.4</version>
10+
<version>0.6.4.4</version>
1111
</parent>
1212

1313
<name>fj-ext</name>

fj-test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-lib</artifactId>
10-
<version>0.6.4</version>
10+
<version>0.6.4.4</version>
1111
</parent>
1212

1313
<name>fj-test</name>

fj-tool/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-lib</artifactId>
10-
<version>0.6.4</version>
10+
<version>0.6.4.4</version>
1111
</parent>
1212

1313
<name>fj-tool</name>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>org.fugerit.java</groupId>
66
<artifactId>fj-lib</artifactId>
77

8-
<version>0.6.4</version>
8+
<version>0.6.4.4</version>
99
<packaging>pom</packaging>
1010

1111
<name>fj-lib</name>

0 commit comments

Comments
 (0)