Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 178897
Collapse All | Expand All

(-)src/org/eclipse/birt/core/data/DataType.java (-22 / +26 lines)
Lines 8-16 Link Here
8
 *
8
 *
9
 * Contributors:
9
 * Contributors:
10
 *  Actuate Corporation  - initial API and implementation
10
 *  Actuate Corporation  - initial API and implementation
11
 *  
11
 *
12
 *************************************************************************
12
 *************************************************************************
13
 */ 
13
 */
14
package org.eclipse.birt.core.data;
14
package org.eclipse.birt.core.data;
15
15
16
import java.math.BigDecimal;
16
import java.math.BigDecimal;
Lines 25-42 Link Here
25
	public static final int UNKNOWN_TYPE = -1;
25
	public static final int UNKNOWN_TYPE = -1;
26
	public static final int ANY_TYPE = 0;
26
	public static final int ANY_TYPE = 0;
27
	public static final int BOOLEAN_TYPE = 1;
27
	public static final int BOOLEAN_TYPE = 1;
28
	public static final int INTEGER_TYPE = 2;	
28
	public static final int INTEGER_TYPE = 2;
29
	public static final int DOUBLE_TYPE = 3;
29
	public static final int DOUBLE_TYPE = 3;
30
	public static final int DECIMAL_TYPE = 4;	
30
	public static final int DECIMAL_TYPE = 4;
31
	public static final int STRING_TYPE = 5;
31
	public static final int STRING_TYPE = 5;
32
	public static final int DATE_TYPE = 6;	
32
	public static final int DATE_TYPE = 6;
33
	public static final int BLOB_TYPE = 7;
33
	public static final int BLOB_TYPE = 7;
34
	public static final int BINARY_TYPE = 8;
34
	public static final int BINARY_TYPE = 8;
35
	public static final int SQL_DATE_TYPE = 9;
35
	public static final int SQL_DATE_TYPE = 9;
36
	public static final int SQL_TIME_TYPE = 10;
36
	public static final int SQL_TIME_TYPE = 10;
37
		
37
	public static final int OBJECT_TYPE = 11;
38
	private static final String[] names = 
38
39
	{ 
39
	private static final String[] names =
40
	{
40
			"Any",
41
			"Any",
41
			"Boolean",
42
			"Boolean",
42
			"Integer",
43
			"Integer",
Lines 47-55 Link Here
47
			"Blob",
48
			"Blob",
48
			"Binary",
49
			"Binary",
49
			"Date",
50
			"Date",
50
			"Time"
51
			"Time",
52
			"Java Object"
51
	};
53
	};
52
	
54
53
	public static final String ANY_TYPE_NAME = names[0];
55
	public static final String ANY_TYPE_NAME = names[0];
54
	public static final String BOOLEAN_TYPE_NAME = names[1];
56
	public static final String BOOLEAN_TYPE_NAME = names[1];
55
	public static final String INTEGER_TYPE_NAME = names[2];
57
	public static final String INTEGER_TYPE_NAME = names[2];
Lines 61-69 Link Here
61
	public static final String BINARY_TYPE_NAME = names[8];
63
	public static final String BINARY_TYPE_NAME = names[8];
62
	public static final String SQL_DATE_TYPE_NAME = names[9];
64
	public static final String SQL_DATE_TYPE_NAME = names[9];
63
	public static final String SQL_TIME_TYPE_NAME = names[10];
65
	public static final String SQL_TIME_TYPE_NAME = names[10];
64
	
66
	public static final String JAVA_OBJECT_TYPE_NAME = names[11];
65
	private static final Class[] classes = 
67
66
	{ 
68
	private static final Class[] classes =
69
	{
67
			AnyType.class,
70
			AnyType.class,
68
			Boolean.class,
71
			Boolean.class,
69
			Integer.class,
72
			Integer.class,
Lines 75-82 Link Here
75
			byte[].class,
78
			byte[].class,
76
			java.sql.Date.class,
79
			java.sql.Date.class,
77
			java.sql.Time.class,
80
			java.sql.Time.class,
81
			Object.class
78
	};
82
	};
79
	
83
80
	/**
84
	/**
81
	 * Gets the description of a data type.
85
	 * Gets the description of a data type.
82
	 * @param typeCode Data type enumeration value
86
	 * @param typeCode Data type enumeration value
Lines 89-99 Link Here
89
	        return new String( "Unknown" );
93
	        return new String( "Unknown" );
90
		}
94
		}
91
		return names[typeCode];
95
		return names[typeCode];
92
	} 
96
	}
93
	
97
94
	/**
98
	/**
95
	 * Gets the Java class used to represent the specified data type.
99
	 * Gets the Java class used to represent the specified data type.
96
	 * @return Class for the specified data type. If data type is unknown or ANY, returns null. 
100
	 * @return Class for the specified data type. If data type is unknown or ANY, returns null.
97
	 */
101
	 */
98
	public static Class getClass( int typeCode )
102
	public static Class getClass( int typeCode )
99
	{
103
	{
Lines 103-111 Link Here
103
		}
107
		}
104
		return classes[typeCode];
108
		return classes[typeCode];
105
	}
109
	}
106
	
110
107
	/**
111
	/**
108
	 * 
112
	 *
109
	 * @param objClass
113
	 * @param objClass
110
	 * @return
114
	 * @return
111
	 */
115
	 */
Lines 120-132 Link Here
120
		}
124
		}
121
		return false;
125
		return false;
122
	}
126
	}
123
	
127
124
	/**
128
	/**
125
	 * Other type can be found in JDK, such as Integer and String, but AnyType
129
	 * Other type can be found in JDK, such as Integer and String, but AnyType
126
	 * have to be manually created to make it correspond to "Any" name. 
130
	 * have to be manually created to make it correspond to "Any" name.
127
	 */
131
	 */
128
	public static final class AnyType
132
	public static final class AnyType
129
	{
133
	{
130
	};
134
	};
131
	
135
132
}
136
}
(-)src/org/eclipse/birt/core/data/DataTypeUtil.java (-82 / +86 lines)
Lines 53-70 Link Here
53
	// we will try to parse it for Locale.US
53
	// we will try to parse it for Locale.US
54
	private static ULocale DEFAULT_LOCALE = ULocale.US;
54
	private static ULocale DEFAULT_LOCALE = ULocale.US;
55
	private static ULocale JRE_DEFAULT_LOCALE = ULocale.getDefault( );
55
	private static ULocale JRE_DEFAULT_LOCALE = ULocale.getDefault( );
56
	
56
57
	// cache DateFormatter of ICU
57
	// cache DateFormatter of ICU
58
	private static Map dfMap = new HashMap( );
58
	private static Map dfMap = new HashMap( );
59
	private static Map nfMap = new HashMap( );
59
	private static Map nfMap = new HashMap( );
60
	// Default Date/Time Style
60
	// Default Date/Time Style
61
	private static int DEFAULT_DATE_STYLE = DateFormat.FULL;
61
	private static int DEFAULT_DATE_STYLE = DateFormat.FULL;
62
62
63
	// resource bundle for exception messages 
63
	// resource bundle for exception messages
64
	public static ResourceBundle resourceBundle = ( new ResourceHandle( JRE_DEFAULT_LOCALE ) ).getUResourceBundle( );
64
	public static ResourceBundle resourceBundle = ( new ResourceHandle( JRE_DEFAULT_LOCALE ) ).getUResourceBundle( );
65
65
66
	public static long count = 0;
66
	public static long count = 0;
67
	
67
68
	/**
68
	/**
69
	 * convert an object to given type
69
	 * convert an object to given type
70
	 * Types supported:
70
	 * Types supported:
Lines 77-82 Link Here
77
	 * 		DataType.BLOB_TYPE
77
	 * 		DataType.BLOB_TYPE
78
	 *		DataType.SQL_DATE_TYPE
78
	 *		DataType.SQL_DATE_TYPE
79
	 *		DataType.SQL_TIME_TYPE
79
	 *		DataType.SQL_TIME_TYPE
80
	 *      DataType.OBJECT_TYPE
80
	 * @param source
81
	 * @param source
81
	 * @param toType
82
	 * @param toType
82
	 * @return
83
	 * @return
Lines 86-92 Link Here
86
			throws BirtException
87
			throws BirtException
87
	{
88
	{
88
		source = JavascriptEvalUtil.convertJavascriptValue( source );
89
		source = JavascriptEvalUtil.convertJavascriptValue( source );
89
		
90
90
		// here we assume the efficiency of if else is higher than switch case
91
		// here we assume the efficiency of if else is higher than switch case
91
		if ( toType == DataType.UNKNOWN_TYPE || toType == DataType.ANY_TYPE )
92
		if ( toType == DataType.UNKNOWN_TYPE || toType == DataType.ANY_TYPE )
92
			return source;
93
			return source;
Lines 106-118 Link Here
106
			case DataType.STRING_TYPE :
107
			case DataType.STRING_TYPE :
107
				return toString( source );
108
				return toString( source );
108
			case DataType.BLOB_TYPE :
109
			case DataType.BLOB_TYPE :
109
				return toBytes( source );
110
				 return toBytes( source );
110
			case DataType.BINARY_TYPE :
111
			case DataType.BINARY_TYPE :
111
				return toBytes( source );
112
				return toBytes( source );
112
			case DataType.SQL_DATE_TYPE:
113
			case DataType.SQL_DATE_TYPE:
113
				return toSqlDate( source );
114
				return toSqlDate( source );
114
			case DataType.SQL_TIME_TYPE:
115
			case DataType.SQL_TIME_TYPE:
115
				return toSqlTime( source );
116
				return toSqlTime( source );
117
			case DataType.OBJECT_TYPE:
118
			    return source;
116
			default :
119
			default :
117
				throw new CoreException( ResourceConstants.INVALID_TYPE,
120
				throw new CoreException( ResourceConstants.INVALID_TYPE,
118
						resourceBundle );
121
						resourceBundle );
Lines 142-148 Link Here
142
		{
145
		{
143
			return source;
146
			return source;
144
		}
147
		}
145
		
148
146
		if ( toTypeClass == DataType.getClass( DataType.ANY_TYPE ) )
149
		if ( toTypeClass == DataType.getClass( DataType.ANY_TYPE ) )
147
			return source;
150
			return source;
148
		if ( toTypeClass == Integer.class )
151
		if ( toTypeClass == Integer.class )
Lines 155-163 Link Here
155
            return toSqlTime( source );
158
            return toSqlTime( source );
156
        if ( toTypeClass == java.sql.Date.class)
159
        if ( toTypeClass == java.sql.Date.class)
157
           	return toSqlDate( source );
160
           	return toSqlDate( source );
158
        if ( toTypeClass == java.sql.Timestamp.class ) 
161
        if ( toTypeClass == java.sql.Timestamp.class )
159
			return toTimestamp( source );
162
			return toTimestamp( source );
160
		if ( toTypeClass == Date.class ) 
163
		if ( toTypeClass == Date.class )
161
			return toDate( source );
164
			return toDate( source );
162
		if ( toTypeClass == Double.class )
165
		if ( toTypeClass == Double.class )
163
			return toDouble( source );
166
			return toDouble( source );
Lines 168-176 Link Here
168
			if ( source instanceof byte[] )
171
			if ( source instanceof byte[] )
169
				return source;
172
				return source;
170
			else
173
			else
171
				return toBlob( source );				
174
				return toBlob( source );
172
		}
175
		}
173
		if ( toTypeClass == byte[].class )
176
		if ( toTypeClass == byte[].class ||
177
		     toTypeClass == Object.class )
174
			return source;
178
			return source;
175
179
176
		throw new CoreException( ResourceConstants.INVALID_TYPE,
180
		throw new CoreException( ResourceConstants.INVALID_TYPE,
Lines 180-186 Link Here
180
	/**
184
	/**
181
	 * Boolean -> Integer
185
	 * Boolean -> Integer
182
	 * 		true 	-> 1
186
	 * 		true 	-> 1
183
	 * 		others 	-> 0 
187
	 * 		others 	-> 0
184
	 * Date -> Integer
188
	 * Date -> Integer
185
	 * 		Date.getTime();
189
	 * 		Date.getTime();
186
	 * String -> Integer
190
	 * String -> Integer
Lines 200-206 Link Here
200
		}
204
		}
201
		else if ( source instanceof Number )
205
		else if ( source instanceof Number )
202
		{
206
		{
203
			// This takes care of BigDecimal, BigInteger, Byte, Double, 
207
			// This takes care of BigDecimal, BigInteger, Byte, Double,
204
			// Float, Long, Short
208
			// Float, Long, Short
205
			if ( !isConvertableToInteger( (Number) source ) )
209
			if ( !isConvertableToInteger( (Number) source ) )
206
			{
210
			{
Lines 252-258 Link Here
252
						}
256
						}
253
						return new Integer( number.intValue( ));
257
						return new Integer( number.intValue( ));
254
					}
258
					}
255
					
259
256
					throw new CoreException( ResourceConstants.CONVERT_FAILS,
260
					throw new CoreException( ResourceConstants.CONVERT_FAILS,
257
							new Object[]{
261
							new Object[]{
258
									source.toString( ), "Integer"
262
									source.toString( ), "Integer"
Lines 279-285 Link Here
279
	/**
283
	/**
280
	 * Boolean -> BigDecimal
284
	 * Boolean -> BigDecimal
281
	 * 		true 	-> 1
285
	 * 		true 	-> 1
282
	 * 		others 	-> 0 
286
	 * 		others 	-> 0
283
	 * Date -> BigDecimal
287
	 * Date -> BigDecimal
284
	 * 		Date.getTime();
288
	 * 		Date.getTime();
285
	 * String -> BigDecimal
289
	 * String -> BigDecimal
Lines 299-305 Link Here
299
		}
303
		}
300
		else if ( source instanceof Number )
304
		else if ( source instanceof Number )
301
		{
305
		{
302
			// This takes care of BigDecimal, BigInteger, Byte, Double, 
306
			// This takes care of BigDecimal, BigInteger, Byte, Double,
303
			// Float, Long, Short, Integer
307
			// Float, Long, Short, Integer
304
			// An intermediate conversion using String is preferrable per JavaDoc
308
			// An intermediate conversion using String is preferrable per JavaDoc
305
			// comment in BigDecimal(String) constructor
309
			// comment in BigDecimal(String) constructor
Lines 310-316 Link Here
310
			}
314
			}
311
			catch ( NumberFormatException e )
315
			catch ( NumberFormatException e )
312
			{
316
			{
313
				throw new CoreException( 
317
				throw new CoreException(
314
						ResourceConstants.CONVERT_FAILS,
318
						ResourceConstants.CONVERT_FAILS,
315
						new Object[]{
319
						new Object[]{
316
								str, "BigDecimal"
320
								str, "BigDecimal"
Lines 342-348 Link Here
342
							.parse( (String) source );
346
							.parse( (String) source );
343
					if( number != null )
347
					if( number != null )
344
						return new BigDecimal( number.toString( ) );
348
						return new BigDecimal( number.toString( ) );
345
					
349
346
					throw new CoreException( ResourceConstants.CONVERT_FAILS,
350
					throw new CoreException( ResourceConstants.CONVERT_FAILS,
347
							new Object[]{
351
							new Object[]{
348
									source.toString( ), "BigDecimal"
352
									source.toString( ), "BigDecimal"
Lines 424-430 Link Here
424
		}
428
		}
425
		else
429
		else
426
		{
430
		{
427
			throw new CoreException( 
431
			throw new CoreException(
428
					ResourceConstants.CONVERT_FAILS,
432
					ResourceConstants.CONVERT_FAILS,
429
					new Object[]{
433
					new Object[]{
430
							source.toString( ), "Boolean"
434
							source.toString( ), "Boolean"
Lines 436-442 Link Here
436
	 * Number -> Date
440
	 * Number -> Date
437
	 * 		new Date((long)Number)
441
	 * 		new Date((long)Number)
438
	 * String -> Date
442
	 * String -> Date
439
	 * 		toDate(String)  
443
	 * 		toDate(String)
440
	 * @param source
444
	 * @param source
441
	 * @return
445
	 * @return
442
	 * @throws BirtException
446
	 * @throws BirtException
Lines 463-471 Link Here
463
					});
467
					});
464
		}
468
		}
465
	}
469
	}
466
    
470
467
	/**
471
	/**
468
	 * 
472
	 *
469
	 * @param source
473
	 * @param source
470
	 * @return
474
	 * @return
471
	 * @throws BirtException
475
	 * @throws BirtException
Lines 477-483 Link Here
477
			return null;
481
			return null;
478
		return new Timestamp( date.getTime( ));
482
		return new Timestamp( date.getTime( ));
479
	}
483
	}
480
	
484
481
    /**
485
    /**
482
     * Date -> Time
486
     * Date -> Time
483
     * String -> Time
487
     * String -> Time
Lines 508-514 Link Here
508
                }
512
                }
509
                catch ( Exception e1 )
513
                catch ( Exception e1 )
510
                {
514
                {
511
                	
515
512
                }
516
                }
513
            }
517
            }
514
        }
518
        }
Lines 521-527 Link Here
521
    }
525
    }
522
526
523
    /**
527
    /**
524
     * 
528
     *
525
     * @param value
529
     * @param value
526
     * @return
530
     * @return
527
     */
531
     */
Lines 534-540 Link Here
534
		int firstColon;
538
		int firstColon;
535
		int secondColon;
539
		int secondColon;
536
		int marker;
540
		int marker;
537
		
541
538
		if ( s == null )
542
		if ( s == null )
539
			throw new java.lang.IllegalArgumentException( );
543
			throw new java.lang.IllegalArgumentException( );
540
544
Lines 584-595 Link Here
584
			second = Integer.parseInt( s.substring( secondColon + 1 ) );
588
			second = Integer.parseInt( s.substring( secondColon + 1 ) );
585
		if( second < 0 || second > 60 )
589
		if( second < 0 || second > 60 )
586
			throw new java.lang.IllegalArgumentException( );
590
			throw new java.lang.IllegalArgumentException( );
587
		
591
588
		return toSqlTime( hour, minute, second );
592
		return toSqlTime( hour, minute, second );
589
	}
593
	}
590
    
594
591
    /**
595
    /**
592
     * 
596
     *
593
     * @param hour
597
     * @param hour
594
     * @param minute
598
     * @param minute
595
     * @param second
599
     * @param second
Lines 604-612 Link Here
604
		calendar.set( Calendar.SECOND, second );
608
		calendar.set( Calendar.SECOND, second );
605
		return new java.sql.Time( calendar.getTimeInMillis( ) );
609
		return new java.sql.Time( calendar.getTimeInMillis( ) );
606
    }
610
    }
607
    
611
608
    /**
612
    /**
609
     * 
613
     *
610
     * @param c
614
     * @param c
611
     * @return
615
     * @return
612
     */
616
     */
Lines 616-624 Link Here
616
			return true;
620
			return true;
617
		return false;
621
		return false;
618
	}
622
	}
619
    
623
620
    /**
624
    /**
621
	 * 
625
	 *
622
	 * @param date
626
	 * @param date
623
	 * @return
627
	 * @return
624
	 */
628
	 */
Lines 632-638 Link Here
632
		calendar.set( Calendar.DAY_OF_MONTH, 1 );
636
		calendar.set( Calendar.DAY_OF_MONTH, 1 );
633
		return new java.sql.Time( calendar.getTimeInMillis( ) );
637
		return new java.sql.Time( calendar.getTimeInMillis( ) );
634
    }
638
    }
635
    
639
636
    /**
640
    /**
637
     * Date -> Time
641
     * Date -> Time
638
     * String -> Time
642
     * String -> Time
Lines 663-669 Link Here
663
                }
667
                }
664
                catch ( Exception e1 )
668
                catch ( Exception e1 )
665
                {
669
                {
666
                	
670
667
                }
671
                }
668
            }
672
            }
669
        }
673
        }
Lines 674-682 Link Here
674
                            source.toString( ), "java.sql.Date"
678
                            source.toString( ), "java.sql.Date"
675
                    } );
679
                    } );
676
    }
680
    }
677
    
681
678
    /**
682
    /**
679
     * 
683
     *
680
     * @param date
684
     * @param date
681
     * @return
685
     * @return
682
     */
686
     */
Lines 688-701 Link Here
688
		calendar.set( Calendar.HOUR_OF_DAY, 0 );
692
		calendar.set( Calendar.HOUR_OF_DAY, 0 );
689
		calendar.set( Calendar.MINUTE, 0 );
693
		calendar.set( Calendar.MINUTE, 0 );
690
		calendar.set( Calendar.SECOND, 0 );
694
		calendar.set( Calendar.SECOND, 0 );
691
		calendar.set( Calendar.MILLISECOND, 0 );		
695
		calendar.set( Calendar.MILLISECOND, 0 );
692
		return new java.sql.Date( calendar.getTimeInMillis( ) );
696
		return new java.sql.Date( calendar.getTimeInMillis( ) );
693
    }
697
    }
694
    
698
695
    /**
699
    /**
696
	 * A temp solution to the adoption of ICU4J to BIRT. Simply delegate
700
	 * A temp solution to the adoption of ICU4J to BIRT. Simply delegate
697
	 * toDate( String, Locale) method.
701
	 * toDate( String, Locale) method.
698
	 * 
702
	 *
699
	 * @param source
703
	 * @param source
700
	 *            the String to be convert
704
	 *            the String to be convert
701
	 * @param locate
705
	 * @param locate
Lines 710-716 Link Here
710
714
711
	/**
715
	/**
712
	 * convert String with the specified locale to java.util.Date
716
	 * convert String with the specified locale to java.util.Date
713
	 * 
717
	 *
714
	 * @param source
718
	 * @param source
715
	 *            the String to be convert
719
	 *            the String to be convert
716
	 * @param locate
720
	 * @param locate
Lines 722-730 Link Here
722
	{
726
	{
723
		return toDate( source, locale, null );
727
		return toDate( source, locale, null );
724
	}
728
	}
725
	
729
726
	/**
730
	/**
727
	 * 
731
	 *
728
	 * @param source
732
	 * @param source
729
	 * @param locale
733
	 * @param locale
730
	 * @param timeZone
734
	 * @param timeZone
Lines 739-745 Link Here
739
743
740
		DateFormat dateFormat = null;
744
		DateFormat dateFormat = null;
741
		Date resultDate = null;
745
		Date resultDate = null;
742
		
746
743
		boolean existTime = source.matches( ".*[0-9]+:[0-9]+:[0-9]+.*" )
747
		boolean existTime = source.matches( ".*[0-9]+:[0-9]+:[0-9]+.*" )
744
				|| source.matches( ".*[0-9]+:[0-9]+.*" );
748
				|| source.matches( ".*[0-9]+:[0-9]+.*" );
745
749
Lines 748-754 Link Here
748
			for ( int j = DEFAULT_DATE_STYLE; j <= DateFormat.SHORT; j++ )
752
			for ( int j = DEFAULT_DATE_STYLE; j <= DateFormat.SHORT; j++ )
749
			{
753
			{
750
				dateFormat = DateFormatFactory.getDateTimeInstance( i, j, locale );
754
				dateFormat = DateFormatFactory.getDateTimeInstance( i, j, locale );
751
				TimeZone savedTimeZone = null; 
755
				TimeZone savedTimeZone = null;
752
				if( timeZone != null )
756
				if( timeZone != null )
753
				{
757
				{
754
					savedTimeZone = dateFormat.getTimeZone( );
758
					savedTimeZone = dateFormat.getTimeZone( );
Lines 762-779 Link Here
762
				catch ( ParseException e1 )
766
				catch ( ParseException e1 )
763
				{
767
				{
764
				}
768
				}
765
				finally 
769
				finally
766
				{
770
				{
767
					if( savedTimeZone != null )
771
					if( savedTimeZone != null )
768
						dateFormat.setTimeZone( savedTimeZone );
772
						dateFormat.setTimeZone( savedTimeZone );
769
				}
773
				}
770
			}
774
			}
771
775
772
			// only Date, no Time 
776
			// only Date, no Time
773
			if ( !existTime )
777
			if ( !existTime )
774
			{
778
			{
775
				dateFormat = DateFormatFactory.getDateInstance( i, locale );
779
				dateFormat = DateFormatFactory.getDateInstance( i, locale );
776
				TimeZone savedTimeZone = null; 
780
				TimeZone savedTimeZone = null;
777
				if( timeZone != null )
781
				if( timeZone != null )
778
				{
782
				{
779
					savedTimeZone = dateFormat.getTimeZone( );
783
					savedTimeZone = dateFormat.getTimeZone( );
Lines 787-793 Link Here
787
				catch ( ParseException e1 )
791
				catch ( ParseException e1 )
788
				{
792
				{
789
				}
793
				}
790
				finally 
794
				finally
791
				{
795
				{
792
					if( savedTimeZone != null )
796
					if( savedTimeZone != null )
793
						dateFormat.setTimeZone( savedTimeZone );
797
						dateFormat.setTimeZone( savedTimeZone );
Lines 798-804 Link Here
798
		// for the String can not be parsed, throws a BirtException
802
		// for the String can not be parsed, throws a BirtException
799
		if ( resultDate == null )
803
		if ( resultDate == null )
800
		{
804
		{
801
			throw new CoreException( 
805
			throw new CoreException(
802
					ResourceConstants.CONVERT_FAILS,
806
					ResourceConstants.CONVERT_FAILS,
803
					new Object[]{
807
					new Object[]{
804
							source.toString( ), "Date"
808
							source.toString( ), "Date"
Lines 811-817 Link Here
811
815
812
	/**
816
	/**
813
	 * Convert a string to a Date instance according to the TimeZone value
817
	 * Convert a string to a Date instance according to the TimeZone value
814
	 * 
818
	 *
815
	 * @param source
819
	 * @param source
816
	 * @param timeZone
820
	 * @param timeZone
817
	 * @return
821
	 * @return
Lines 838-848 Link Here
838
			}
842
			}
839
		}
843
		}
840
	}
844
	}
841
	
845
842
	/**
846
	/**
843
	 * A temp solution to the adoption of ICU4J in BIRT. It is a simple
847
	 * A temp solution to the adoption of ICU4J in BIRT. It is a simple
844
	 * delegation to toDateWithCheck( String, Locale ).
848
	 * delegation to toDateWithCheck( String, Locale ).
845
	 * 
849
	 *
846
	 * @param source
850
	 * @param source
847
	 * @param locale
851
	 * @param locale
848
	 * @return Date
852
	 * @return Date
Lines 863-869 Link Here
863
	 * in DateFormat.SHORT case instead of all cases.
867
	 * in DateFormat.SHORT case instead of all cases.
864
	 * 		Year is not lower than 0.
868
	 * 		Year is not lower than 0.
865
	 * 		Month is from 1 to 12.
869
	 * 		Month is from 1 to 12.
866
	 * 		Day is from 1 to 31.  
870
	 * 		Day is from 1 to 31.
867
	 * @param source
871
	 * @param source
868
	 * @param locale
872
	 * @param locale
869
	 * @return Date
873
	 * @return Date
Lines 887-893 Link Here
887
		// check whether conversion is correct
891
		// check whether conversion is correct
888
		if ( DateUtil.checkValid( dateFormat, source ) == false )
892
		if ( DateUtil.checkValid( dateFormat, source ) == false )
889
		{
893
		{
890
			throw new CoreException( 
894
			throw new CoreException(
891
					ResourceConstants.CONVERT_FAILS,
895
					ResourceConstants.CONVERT_FAILS,
892
					new Object[]{
896
					new Object[]{
893
							source.toString( ), "Date"
897
							source.toString( ), "Date"
Lines 900-906 Link Here
900
	/**
904
	/**
901
	 * Boolean -> Double
905
	 * Boolean -> Double
902
	 * 		true 	-> 1
906
	 * 		true 	-> 1
903
	 * 		others 	-> 0 
907
	 * 		others 	-> 0
904
	 * Date -> Double
908
	 * Date -> Double
905
	 * 		Date.getTime();
909
	 * 		Date.getTime();
906
	 * String -> Double
910
	 * String -> Double
Lines 964-970 Link Here
964
						}
968
						}
965
						return new Double( number.doubleValue( ));
969
						return new Double( number.doubleValue( ));
966
					}
970
					}
967
					
971
968
					throw new CoreException( ResourceConstants.CONVERT_FAILS,
972
					throw new CoreException( ResourceConstants.CONVERT_FAILS,
969
							new Object[]{
973
							new Object[]{
970
									source.toString( ), "Double"
974
									source.toString( ), "Double"
Lines 989-995 Link Here
989
		}
993
		}
990
	}
994
	}
991
995
992
	
996
993
	/**
997
	/**
994
	 * Number -> String
998
	 * Number -> String
995
	 * 		Number.toString()
999
	 * 		Number.toString()
Lines 1021-1027 Link Here
1021
1025
1022
	/**
1026
	/**
1023
	 * Convert an object to an locale neutral String value. For Date values we will convert to ISO8601 format.
1027
	 * Convert an object to an locale neutral String value. For Date values we will convert to ISO8601 format.
1024
	 * 
1028
	 *
1025
	 * @param source
1029
	 * @param source
1026
	 * @return
1030
	 * @return
1027
	 * @throws BirtException
1031
	 * @throws BirtException
Lines 1050-1061 Link Here
1050
		{
1054
		{
1051
			return ((Number) source).toString( );
1055
			return ((Number) source).toString( );
1052
		}
1056
		}
1053
		else 
1057
		else
1054
		{
1058
		{
1055
		return toLimitedSizeString( source );
1059
		return toLimitedSizeString( source );
1056
		}
1060
		}
1057
	}
1061
	}
1058
	
1062
1059
	/**
1063
	/**
1060
	 * Number -> String
1064
	 * Number -> String
1061
	 * 		Number.toString()
1065
	 * 		Number.toString()
Lines 1092-1105 Link Here
1092
		{
1096
		{
1093
			return toString( (Number) source, locale );
1097
			return toString( (Number) source, locale );
1094
		}
1098
		}
1095
		else 
1099
		else
1096
		{
1100
		{
1097
			return toLimitedSizeString( source );
1101
			return toLimitedSizeString( source );
1098
		}
1102
		}
1099
	}
1103
	}
1100
1104
1101
	/**
1105
	/**
1102
	 * 
1106
	 *
1103
	 * @param source
1107
	 * @param source
1104
	 * @return
1108
	 * @return
1105
	 */
1109
	 */
Lines 1131-1137 Link Here
1131
	}
1135
	}
1132
1136
1133
	/**
1137
	/**
1134
	 * 
1138
	 *
1135
	 * @param source
1139
	 * @param source
1136
	 * @param locale
1140
	 * @param locale
1137
	 * @return
1141
	 * @return
Lines 1153-1159 Link Here
1153
		}
1157
		}
1154
		return nf.format( source );
1158
		return nf.format( source );
1155
	}
1159
	}
1156
	
1160
1157
	/**
1161
	/**
1158
	 * Converting Blob to/from other types is not currently supported
1162
	 * Converting Blob to/from other types is not currently supported
1159
	 * @param source
1163
	 * @param source
Lines 1227-1233 Link Here
1227
1231
1228
	/**
1232
	/**
1229
	 * Converts a Java class to its corresponding data type constant
1233
	 * Converts a Java class to its corresponding data type constant
1230
	 * defined in DataType 
1234
	 * defined in DataType
1231
	 */
1235
	 */
1232
	public static int toApiDataType( Class clazz )
1236
	public static int toApiDataType( Class clazz )
1233
	{
1237
	{
Lines 1263-1276 Link Here
1263
		else if ( clazz == Boolean.class )
1267
		else if ( clazz == Boolean.class )
1264
			return DataType.BOOLEAN_TYPE;
1268
			return DataType.BOOLEAN_TYPE;
1265
        else if ( clazz == Object.class )
1269
        else if ( clazz == Object.class )
1266
            return DataType.STRING_TYPE;
1270
            return DataType.OBJECT_TYPE;
1267
1271
1268
		// any other types are not recognized nor supported;
1272
		// any other types are not recognized nor supported;
1269
		return DataType.UNKNOWN_TYPE;
1273
		return DataType.UNKNOWN_TYPE;
1270
	}
1274
	}
1271
1275
1272
	/**
1276
	/**
1273
	 * Converts an ODA data type code to its 
1277
	 * Converts an ODA data type code to its
1274
	 * corresponding Data Engine API data type constant
1278
	 * corresponding Data Engine API data type constant
1275
	 * defined in DataType.
1279
	 * defined in DataType.
1276
	 * @param odaDataTypeCode   an ODA data type code
1280
	 * @param odaDataTypeCode   an ODA data type code
Lines 1284-1290 Link Here
1284
	}
1288
	}
1285
1289
1286
	/**
1290
	/**
1287
	 * Convert object to a suitable type from its value 
1291
	 * Convert object to a suitable type from its value
1288
	 * Object -> Integer -> Double -> BigDecimal -> Date -> String
1292
	 * Object -> Integer -> Double -> BigDecimal -> Date -> String
1289
	 */
1293
	 */
1290
	public static Object toAutoValue( Object evaValue )
1294
	public static Object toAutoValue( Object evaValue )
Lines 1331-1337 Link Here
1331
	}
1335
	}
1332
1336
1333
	/**
1337
	/**
1334
	 * convert object to Integer. If fails, return null. 
1338
	 * convert object to Integer. If fails, return null.
1335
	 * Object -> Integer
1339
	 * Object -> Integer
1336
	 */
1340
	 */
1337
	public static Integer toIntegerValue( Object evaValue )
1341
	public static Integer toIntegerValue( Object evaValue )
Lines 1376-1382 Link Here
1376
	/**
1380
	/**
1377
	 * Convert String without specified locale to java.util.Date
1381
	 * Convert String without specified locale to java.util.Date
1378
	 * Try to format the given String for JRE default Locale,
1382
	 * Try to format the given String for JRE default Locale,
1379
	 * if it fails, try to format the String for Locale.US 
1383
	 * if it fails, try to format the String for Locale.US
1380
	 * @param source
1384
	 * @param source
1381
	 *            the String to be convert
1385
	 *            the String to be convert
1382
	 * @param locate
1386
	 * @param locate
Lines 1406-1412 Link Here
1406
1410
1407
	/**
1411
	/**
1408
	 * convert String with ISO8601 date format to java.util.Date
1412
	 * convert String with ISO8601 date format to java.util.Date
1409
	 * 
1413
	 *
1410
	 * @param source
1414
	 * @param source
1411
	 *            the String to be convert
1415
	 *            the String to be convert
1412
	 * @param locate
1416
	 * @param locate
Lines 1424-1430 Link Here
1424
		}
1428
		}
1425
		catch ( ParseException e1 )
1429
		catch ( ParseException e1 )
1426
		{
1430
		{
1427
			throw new CoreException( 
1431
			throw new CoreException(
1428
					ResourceConstants.CONVERT_FAILS,
1432
					ResourceConstants.CONVERT_FAILS,
1429
					new Object[]{
1433
					new Object[]{
1430
							source.toString( ), "Date"
1434
							source.toString( ), "Date"
Lines 1434-1440 Link Here
1434
1438
1435
	/**
1439
	/**
1436
	 * Call org.eclipse.birt.core.format.DateFormatter
1440
	 * Call org.eclipse.birt.core.format.DateFormatter
1437
	 * 
1441
	 *
1438
	 * @param source
1442
	 * @param source
1439
	 * @return
1443
	 * @return
1440
	 */
1444
	 */
Lines 1477-1483 Link Here
1477
     * JavaObject -> java.lang.Object<br>
1481
     * JavaObject -> java.lang.Object<br>
1478
     * </i>
1482
     * </i>
1479
	 * @param odaDataTypeCode   an ODA data type code
1483
	 * @param odaDataTypeCode   an ODA data type code
1480
	 * @return  the ODI type class that corresponds with 
1484
	 * @return  the ODI type class that corresponds with
1481
	 *          the specified ODA data type
1485
	 *          the specified ODA data type
1482
	 * @throws BirtException if the specified ODA data type is not a supported type
1486
	 * @throws BirtException if the specified ODA data type is not a supported type
1483
	 */
1487
	 */
Lines 1556-1562 Link Here
1556
	}
1560
	}
1557
1561
1558
	/**
1562
	/**
1559
	 * Converts an ODI type class to its corresponding 
1563
	 * Converts an ODI type class to its corresponding
1560
	 * ODA data type code. <br>
1564
	 * ODA data type code. <br>
1561
	 * <b>ODI Type Class -> ODA Data Type</b><br>
1565
	 * <b>ODI Type Class -> ODA Data Type</b><br>
1562
	 * <i>java.lang.Integer -> Integer<br>
1566
	 * <i>java.lang.Integer -> Integer<br>
Lines 1597-1603 Link Here
1597
        else if ( odiTypeClass == java.sql.Date.class )
1601
        else if ( odiTypeClass == java.sql.Date.class )
1598
            odaType = Types.DATE;
1602
            odaType = Types.DATE;
1599
        else if ( odiTypeClass == java.util.Date.class )
1603
        else if ( odiTypeClass == java.util.Date.class )
1600
            odaType = Types.TIMESTAMP;        
1604
            odaType = Types.TIMESTAMP;
1601
		else if ( odiTypeClass == Blob.class )
1605
		else if ( odiTypeClass == Blob.class )
1602
			odaType = Types.BLOB;
1606
			odaType = Types.BLOB;
1603
		else if ( odiTypeClass == Clob.class )
1607
		else if ( odiTypeClass == Clob.class )
Lines 1609-1631 Link Here
1609
1613
1610
		return odaType;
1614
		return odaType;
1611
	}
1615
	}
1612
	
1616
1613
	private static boolean isConvertableToInteger( Number n )
1617
	private static boolean isConvertableToInteger( Number n )
1614
	{
1618
	{
1615
		assert n != null;
1619
		assert n != null;
1616
		
1620
1617
		long longValue = n.longValue( );
1621
		long longValue = n.longValue( );
1618
		return longValue >= Integer.MIN_VALUE && longValue <= Integer.MAX_VALUE;
1622
		return longValue >= Integer.MIN_VALUE && longValue <= Integer.MAX_VALUE;
1619
		
1623
1620
	}
1624
	}
1621
	
1625
1622
	private static boolean isConvertableToDouble( Number n )
1626
	private static boolean isConvertableToDouble( Number n )
1623
	{
1627
	{
1624
		assert n != null;
1628
		assert n != null;
1625
		
1629
1626
		double doubleValue = n.doubleValue( );
1630
		double doubleValue = n.doubleValue( );
1627
		return !Double.isInfinite( doubleValue );
1631
		return !Double.isInfinite( doubleValue );
1628
		
1632
1629
	}
1633
	}
1630
}
1634
}
1631
1635
(-)src/org/eclipse/birt/report/model/api/util/DataTypeConvertUtil.java (-7 / +10 lines)
Lines 25-31 Link Here
25
	 * Returns the corresponding parameter type choice with the given column
25
	 * Returns the corresponding parameter type choice with the given column
26
	 * data type. The column data type values are defined in
26
	 * data type. The column data type values are defined in
27
	 * <code>DesignChoiceConstants</code> can be one of the followings:
27
	 * <code>DesignChoiceConstants</code> can be one of the followings:
28
	 * 
28
	 *
29
	 * <ul>
29
	 * <ul>
30
	 * <li><code>COLUMN_DATA_TYPE_BOOLEAN</code>
30
	 * <li><code>COLUMN_DATA_TYPE_BOOLEAN</code>
31
	 * <li><code>COLUMN_DATA_TYPE_DATETIME</code>
31
	 * <li><code>COLUMN_DATA_TYPE_DATETIME</code>
Lines 36-43 Link Here
36
	 * <li><code>COLUMN_DATA_TYPE_INTEGER</code>
36
	 * <li><code>COLUMN_DATA_TYPE_INTEGER</code>
37
	 * <li><code>COLUMN_DATA_TYPE_STRING</code>
37
	 * <li><code>COLUMN_DATA_TYPE_STRING</code>
38
	 * </ul>
38
	 * </ul>
39
	 * 
39
	 *
40
	 * 
40
	 *
41
	 * @param columnType
41
	 * @param columnType
42
	 *            the column data type
42
	 *            the column data type
43
	 * @return the parameter type
43
	 * @return the parameter type
Lines 62-68 Link Here
62
				|| DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER
62
				|| DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER
63
						.equals( columnType )
63
						.equals( columnType )
64
				|| DesignChoiceConstants.COLUMN_DATA_TYPE_STRING
64
				|| DesignChoiceConstants.COLUMN_DATA_TYPE_STRING
65
						.equals( columnType ) )
65
						.equals( columnType )
66
		        || DesignChoiceConstants.COLUMN_DATA_TYPE_OBJECT
67
		                .equals( columnType ) )
66
			return DataTypeConversionUtil.converToParamType( columnType );
68
			return DataTypeConversionUtil.converToParamType( columnType );
67
69
68
		return columnType;
70
		return columnType;
Lines 72-78 Link Here
72
	 * Returns the corresponding column data type choice with the given
74
	 * Returns the corresponding column data type choice with the given
73
	 * parameter type. The column data type values are defined in
75
	 * parameter type. The column data type values are defined in
74
	 * <code>DesignChoiceConstants</code> can be one of the followings:
76
	 * <code>DesignChoiceConstants</code> can be one of the followings:
75
	 * 
77
	 *
76
	 * <ul>
78
	 * <ul>
77
	 * <li><code>PARAM_TYPE_BOOLEAN</code>
79
	 * <li><code>PARAM_TYPE_BOOLEAN</code>
78
	 * <li><code>PARAM_TYPE_DATETIME</code>
80
	 * <li><code>PARAM_TYPE_DATETIME</code>
Lines 83-89 Link Here
83
	 * <li><code>PARAM_TYPE_INTEGER</code>
85
	 * <li><code>PARAM_TYPE_INTEGER</code>
84
	 * <li><code>PARAM_TYPE_STRING</code>
86
	 * <li><code>PARAM_TYPE_STRING</code>
85
	 * </ul>
87
	 * </ul>
86
	 * 
88
	 *
87
	 * @param paramType
89
	 * @param paramType
88
	 *            the parameter type
90
	 *            the parameter type
89
	 * @return the column data type
91
	 * @return the column data type
Lines 101-107 Link Here
101
				|| DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals( paramType )
103
				|| DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals( paramType )
102
				|| DesignChoiceConstants.PARAM_TYPE_FLOAT.equals( paramType )
104
				|| DesignChoiceConstants.PARAM_TYPE_FLOAT.equals( paramType )
103
				|| DesignChoiceConstants.PARAM_TYPE_INTEGER.equals( paramType )
105
				|| DesignChoiceConstants.PARAM_TYPE_INTEGER.equals( paramType )
104
				|| DesignChoiceConstants.PARAM_TYPE_STRING.equals( paramType ) )
106
				|| DesignChoiceConstants.PARAM_TYPE_STRING.equals( paramType )
107
				|| DesignChoiceConstants.PARAM_TYPE_OBJECT.equals( paramType ))
105
			return DataTypeConversionUtil.converToColumnDataType( paramType );
108
			return DataTypeConversionUtil.converToColumnDataType( paramType );
106
109
107
		return paramType;
110
		return paramType;
(-)src/org/eclipse/birt/report/model/elements/rom.def (+3 lines)
Lines 187-192 Link Here
187
    <Choice displayNameID="Choices.paramType.integer" name="integer"/>	
187
    <Choice displayNameID="Choices.paramType.integer" name="integer"/>	
188
    <Choice displayNameID="Choices.paramType.date" name="date"/>
188
    <Choice displayNameID="Choices.paramType.date" name="date"/>
189
    <Choice displayNameID="Choices.paramType.time" name="time"/>	  
189
    <Choice displayNameID="Choices.paramType.time" name="time"/>	  
190
    <Choice displayNameID="Choices.paramType.javaObject" name="javaObject"/>
190
  </ChoiceType>
191
  </ChoiceType>
191
  <ChoiceType name="paramValueType">
192
  <ChoiceType name="paramValueType">
192
    <Choice displayNameID="Choices.paramValueType.static" name="static"/>
193
    <Choice displayNameID="Choices.paramValueType.static" name="static"/>
Lines 394-399 Link Here
394
	<Choice displayNameID="Choices.columnDataType.date" name="date"/>
395
	<Choice displayNameID="Choices.columnDataType.date" name="date"/>
395
	<Choice displayNameID="Choices.columnDataType.time" name="time"/> 
396
	<Choice displayNameID="Choices.columnDataType.time" name="time"/> 
396
	<Choice displayNameID="Choices.columnDataType.blob" name="blob"/>
397
	<Choice displayNameID="Choices.columnDataType.blob" name="blob"/>
398
	<Choice displayNameID="Choices.columnDataType.javaObject" name="javaObject"/>
399
	
397
    <!-- not supported now
400
    <!-- not supported now
398
    <Choice displayNameID="Choices.columnDataType.structure" name="structure"/>
401
    <Choice displayNameID="Choices.columnDataType.structure" name="structure"/>
399
    <Choice displayNameID="Choices.columnDataType.table" name="table"/>
402
    <Choice displayNameID="Choices.columnDataType.table" name="table"/>
(-)src/org/eclipse/birt/report/model/i18n/Messages.properties (-1 / +3 lines)
Lines 118-123 Link Here
118
Choices.paramType.any=Any
118
Choices.paramType.any=Any
119
Choices.paramType.date=Date
119
Choices.paramType.date=Date
120
Choices.paramType.time=Time
120
Choices.paramType.time=Time
121
Choices.paramType.javaObject=Java Object
121
122
122
#6.paramControl
123
#6.paramControl
123
Choices.paramControl.text-box=Text Box
124
Choices.paramControl.text-box=Text Box
Lines 429-434 Link Here
429
Choices.columnDataType.time=Time
430
Choices.columnDataType.time=Time
430
Choices.columnDataType.date=Date
431
Choices.columnDataType.date=Date
431
Choices.columnDataType.blob=Blob
432
Choices.columnDataType.blob=Blob
433
Choices.columnDataType.javaObject=Java Object
432
434
433
#54. searchType
435
#54. searchType
434
Choices.searchType.any=Any
436
Choices.searchType.any=Any
Lines 1871-1877 Link Here
1871
Structure.HighlightRule.border.right.color=Color
1873
Structure.HighlightRule.border.right.color=Color
1872
Structure.HighlightRule.background.color=Background Color
1874
Structure.HighlightRule.background.color=Background Color
1873
Structure.HighlightRule.format.dateTime=Date Time Format
1875
Structure.HighlightRule.format.dateTime=Date Time Format
1874
Structure.HighlightRule.format.number= NumbervFormat
1876
Structure.HighlightRule.format.number=Number Format
1875
Structure.HighlightRule.format.number.align=Number Alignment  
1877
Structure.HighlightRule.format.number.align=Number Alignment  
1876
Structure.HighlightRule.format.string=String Format
1878
Structure.HighlightRule.format.string=String Format
1877
Structure.HighlightRule.font.family=Font
1879
Structure.HighlightRule.font.family=Font
(-)src/org/eclipse/birt/report/model/util/DataTypeConversionUtil.java (-3 / +7 lines)
Lines 17-23 Link Here
17
/**
17
/**
18
 * The utility class to convert values between parameter type choices and column
18
 * The utility class to convert values between parameter type choices and column
19
 * data type choices.
19
 * data type choices.
20
 * 
20
 *
21
 */
21
 */
22
22
23
public class DataTypeConversionUtil
23
public class DataTypeConversionUtil
Lines 26-32 Link Here
26
	/**
26
	/**
27
	 * Returns the corresponding parameter type choice with the given column
27
	 * Returns the corresponding parameter type choice with the given column
28
	 * data type.
28
	 * data type.
29
	 * 
29
	 *
30
	 * @param columnType
30
	 * @param columnType
31
	 *            the column data type
31
	 *            the column data type
32
	 * @return the parameter type
32
	 * @return the parameter type
Lines 58-63 Link Here
58
			return DesignChoiceConstants.PARAM_TYPE_STRING;
58
			return DesignChoiceConstants.PARAM_TYPE_STRING;
59
		if ( DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB.equals( columnType ) )
59
		if ( DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB.equals( columnType ) )
60
			return DesignChoiceConstants.PARAM_TYPE_ANY;
60
			return DesignChoiceConstants.PARAM_TYPE_ANY;
61
        if ( DesignChoiceConstants.COLUMN_DATA_TYPE_OBJECT.equals( columnType ) )
62
            return DesignChoiceConstants.PARAM_TYPE_OBJECT;
61
63
62
		return columnType;
64
		return columnType;
63
	}
65
	}
Lines 65-71 Link Here
65
	/**
67
	/**
66
	 * Returns the corresponding column data type choice with the given
68
	 * Returns the corresponding column data type choice with the given
67
	 * parameter type.
69
	 * parameter type.
68
	 * 
70
	 *
69
	 * @param paramType
71
	 * @param paramType
70
	 *            the parameter type
72
	 *            the parameter type
71
	 * @return the column data type
73
	 * @return the column data type
Lines 94-99 Link Here
94
			return DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER;
96
			return DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER;
95
		if ( DesignChoiceConstants.PARAM_TYPE_STRING.equals( paramType ) )
97
		if ( DesignChoiceConstants.PARAM_TYPE_STRING.equals( paramType ) )
96
			return DesignChoiceConstants.COLUMN_DATA_TYPE_STRING;
98
			return DesignChoiceConstants.COLUMN_DATA_TYPE_STRING;
99
		if ( DesignChoiceConstants.PARAM_TYPE_OBJECT.equals( paramType ) )
100
		    return DesignChoiceConstants.COLUMN_DATA_TYPE_OBJECT;
97
101
98
		return paramType;
102
		return paramType;
99
	}
103
	}
(-)src/org/eclipse/birt/report/model/api/elements/DesignChoiceConstants.java (-10 / +12 lines)
Lines 14-20 Link Here
14
/**
14
/**
15
 * This class collects commonly-used choice constants. These constants define
15
 * This class collects commonly-used choice constants. These constants define
16
 * the internal value of choices for several property choice constants.
16
 * the internal value of choices for several property choice constants.
17
 * 
17
 *
18
 * @see ReportDesignConstants
18
 * @see ReportDesignConstants
19
 */
19
 */
20
20
Lines 24-32 Link Here
24
	// fontFamily
24
	// fontFamily
25
25
26
	public static final String CHOICE_FONT_FAMILY = "fontFamily"; //$NON-NLS-1$
26
	public static final String CHOICE_FONT_FAMILY = "fontFamily"; //$NON-NLS-1$
27
	public static final String FONT_FAMILY_SERIF = "serif"; //$NON-NLS-1$ 
27
	public static final String FONT_FAMILY_SERIF = "serif"; //$NON-NLS-1$
28
	public static final String FONT_FAMILY_SANS_SERIF = "sans-serif"; //$NON-NLS-1$ 
28
	public static final String FONT_FAMILY_SANS_SERIF = "sans-serif"; //$NON-NLS-1$
29
	public static final String FONT_FAMILY_CURSIVE = "cursive"; //$NON-NLS-1$ 
29
	public static final String FONT_FAMILY_CURSIVE = "cursive"; //$NON-NLS-1$
30
	public static final String FONT_FAMILY_FANTASY = "fantasy"; //$NON-NLS-1$
30
	public static final String FONT_FAMILY_FANTASY = "fantasy"; //$NON-NLS-1$
31
	public static final String FONT_FAMILY_MONOSPACE = "monospace"; //$NON-NLS-1$
31
	public static final String FONT_FAMILY_MONOSPACE = "monospace"; //$NON-NLS-1$
32
32
Lines 257-262 Link Here
257
	public static final String PARAM_TYPE_DATETIME = "dateTime"; //$NON-NLS-1$
257
	public static final String PARAM_TYPE_DATETIME = "dateTime"; //$NON-NLS-1$
258
	public static final String PARAM_TYPE_BOOLEAN = "boolean"; //$NON-NLS-1$
258
	public static final String PARAM_TYPE_BOOLEAN = "boolean"; //$NON-NLS-1$
259
	public static final String PARAM_TYPE_INTEGER = "integer"; //$NON-NLS-1$
259
	public static final String PARAM_TYPE_INTEGER = "integer"; //$NON-NLS-1$
260
	public static final String PARAM_TYPE_OBJECT = "javaObject"; //$NON-NLS-1$
260
	/**
261
	/**
261
	 * @deprecated Now any is not supported.
262
	 * @deprecated Now any is not supported.
262
	 */
263
	 */
Lines 459-465 Link Here
459
	public static final String FORMAT_TYPE_REPORTLET = "reportlet"; //$NON-NLS-1$
460
	public static final String FORMAT_TYPE_REPORTLET = "reportlet"; //$NON-NLS-1$
460
	public static final String FORMAT_TYPE_EXCEL = "excel"; //$NON-NLS-1$
461
	public static final String FORMAT_TYPE_EXCEL = "excel"; //$NON-NLS-1$
461
	public static final String FORMAT_TYPE_WORD = "word"; //$NON-NLS-1$
462
	public static final String FORMAT_TYPE_WORD = "word"; //$NON-NLS-1$
462
	public static final String FORMAT_TYPE_POWERPOINT = "powerpoint"; //$NON-NLS-1$	
463
	public static final String FORMAT_TYPE_POWERPOINT = "powerpoint"; //$NON-NLS-1$
463
	public static final String FORMAT_TYPE_DOC = "doc"; //$NON-NLS-1$
464
	public static final String FORMAT_TYPE_DOC = "doc"; //$NON-NLS-1$
464
	/**
465
	/**
465
	 * ImageRefType -- The image reference type. The first constant is the name
466
	 * ImageRefType -- The image reference type. The first constant is the name
Lines 517-522 Link Here
517
	public static final String COLUMN_DATA_TYPE_DATE = "date";//$NON-NLS-1$
518
	public static final String COLUMN_DATA_TYPE_DATE = "date";//$NON-NLS-1$
518
	public static final String COLUMN_DATA_TYPE_TIME = "time";//$NON-NLS-1$
519
	public static final String COLUMN_DATA_TYPE_TIME = "time";//$NON-NLS-1$
519
	public static final String COLUMN_DATA_TYPE_BLOB = "blob";//$NON-NLS-1$
520
	public static final String COLUMN_DATA_TYPE_BLOB = "blob";//$NON-NLS-1$
521
	public static final String COLUMN_DATA_TYPE_OBJECT = "javaObject";//$NON-NLS-1$
520
522
521
	/**
523
	/**
522
	 * searchType -- The search type for column hint The first constant is the
524
	 * searchType -- The search type for column hint The first constant is the
Lines 618-624 Link Here
618
	 */
620
	 */
619
621
620
	public static final String CHOICE_NUMBER_FORMAT_TYPE = "numberFormat"; //$NON-NLS-1$
622
	public static final String CHOICE_NUMBER_FORMAT_TYPE = "numberFormat"; //$NON-NLS-1$
621
	public static final String NUMBER_FORMAT_TYPE_UNFORMATTED = "Unformatted"; //$NON-NLS-1$	
623
	public static final String NUMBER_FORMAT_TYPE_UNFORMATTED = "Unformatted"; //$NON-NLS-1$
622
	public static final String NUMBER_FORMAT_TYPE_GENERAL_NUMBER = "General Number"; //$NON-NLS-1$
624
	public static final String NUMBER_FORMAT_TYPE_GENERAL_NUMBER = "General Number"; //$NON-NLS-1$
623
	public static final String NUMBER_FORMAT_TYPE_CURRENCY = "Currency"; //$NON-NLS-1$
625
	public static final String NUMBER_FORMAT_TYPE_CURRENCY = "Currency"; //$NON-NLS-1$
624
	public static final String NUMBER_FORMAT_TYPE_FIXED = "Fixed"; //$NON-NLS-1$
626
	public static final String NUMBER_FORMAT_TYPE_FIXED = "Fixed"; //$NON-NLS-1$
Lines 677-684 Link Here
677
	public static final String STRING_FORMAT_TYPE_UPPERCASE = ">"; //$NON-NLS-1$
679
	public static final String STRING_FORMAT_TYPE_UPPERCASE = ">"; //$NON-NLS-1$
678
	public static final String STRING_FORMAT_TYPE_LOWERCASE = "<"; //$NON-NLS-1$
680
	public static final String STRING_FORMAT_TYPE_LOWERCASE = "<"; //$NON-NLS-1$
679
	public static final String STRING_FORMAT_TYPE_CUSTOM = "Custom"; //$NON-NLS-1$
681
	public static final String STRING_FORMAT_TYPE_CUSTOM = "Custom"; //$NON-NLS-1$
680
	public static final String STRING_FORMAT_TYPE_ZIP_CODE = "Zip Code"; //$NON-NLS-1$	
682
	public static final String STRING_FORMAT_TYPE_ZIP_CODE = "Zip Code"; //$NON-NLS-1$
681
	public static final String STRING_FORMAT_TYPE_ZIP_CODE_4 = "Zip Code + 4"; //$NON-NLS-1$	
683
	public static final String STRING_FORMAT_TYPE_ZIP_CODE_4 = "Zip Code + 4"; //$NON-NLS-1$
682
	public static final String STRING_FORMAT_TYPE_PHONE_NUMBER = "Phone Number"; //$NON-NLS-1$
684
	public static final String STRING_FORMAT_TYPE_PHONE_NUMBER = "Phone Number"; //$NON-NLS-1$
683
	public static final String STRING_FORMAT_TYPE_SOCIAL_SECURITY_NUMBER = "Social Security Number"; //$NON-NLS-1$
685
	public static final String STRING_FORMAT_TYPE_SOCIAL_SECURITY_NUMBER = "Social Security Number"; //$NON-NLS-1$
684
686
Lines 818-824 Link Here
818
	public static final String AGGREGATION_FUNCTION_IS_TOP_N = "is-top-n"; //$NON-NLS-1$
820
	public static final String AGGREGATION_FUNCTION_IS_TOP_N = "is-top-n"; //$NON-NLS-1$
819
	public static final String AGGREGATION_FUNCTION_IS_BOTTOM_N = "is-bottom-n"; //$NON-NLS-1$
821
	public static final String AGGREGATION_FUNCTION_IS_BOTTOM_N = "is-bottom-n"; //$NON-NLS-1$
820
	public static final String AGGREGATION_FUNCTION_IS_TOP_N_PERCENT = "is-top-n-percent"; //$NON-NLS-1$
822
	public static final String AGGREGATION_FUNCTION_IS_TOP_N_PERCENT = "is-top-n-percent"; //$NON-NLS-1$
821
	public static final String AGGREGATION_FUNCTION_IS_BOTTOM_N_PERCENT = "is-bottom-n-percent"; //$NON-NLS-1$	
823
	public static final String AGGREGATION_FUNCTION_IS_BOTTOM_N_PERCENT = "is-bottom-n-percent"; //$NON-NLS-1$
822
	public static final String AGGREGATION_FUNCTION_PERCENT_RANK = "percent-rank"; //$NON-NLS-1$
824
	public static final String AGGREGATION_FUNCTION_PERCENT_RANK = "percent-rank"; //$NON-NLS-1$
823
	public static final String AGGREGATION_FUNCTION_PERCENTILE = "percentile"; //$NON-NLS-1$
825
	public static final String AGGREGATION_FUNCTION_PERCENTILE = "percentile"; //$NON-NLS-1$
824
	public static final String AGGREGATION_FUNCTION_TOP_QUARTILE = "quartile"; //$NON-NLS-1$
826
	public static final String AGGREGATION_FUNCTION_TOP_QUARTILE = "quartile"; //$NON-NLS-1$
Lines 939-945 Link Here
939
941
940
	/**
942
	/**
941
	 * Choice constants for workMode.
943
	 * Choice constants for workMode.
942
	 * 
944
	 *
943
	 */
945
	 */
944
	public static final String CHOICE_VARIABLE_TYPE = "variableType"; //$NON-NLS-1$
946
	public static final String CHOICE_VARIABLE_TYPE = "variableType"; //$NON-NLS-1$
945
	public static final String VARIABLE_TYPE_REPORT = "report"; //$NON-NLS-1$
947
	public static final String VARIABLE_TYPE_REPORT = "report"; //$NON-NLS-1$
(-)src/org/eclipse/birt/report/data/adapter/api/DataAdapterUtil.java (-37 / +44 lines)
Lines 59-65 Link Here
59
	}
59
	}
60
60
61
	/**
61
	/**
62
	 * register model aggregation function names with build-in function names	
62
	 * register model aggregation function names with build-in function names
63
	 */
63
	 */
64
	private static void registerAggregationFunction( )
64
	private static void registerAggregationFunction( )
65
	{
65
	{
Lines 122-128 Link Here
122
		aggrAdapterMap.put( DesignChoiceConstants.AGGREGATION_FUNCTION_RANK,
122
		aggrAdapterMap.put( DesignChoiceConstants.AGGREGATION_FUNCTION_RANK,
123
				IBuildInAggregation.TOTAL_RANK_FUNC );
123
				IBuildInAggregation.TOTAL_RANK_FUNC );
124
	}
124
	}
125
	
125
126
	/**
126
	/**
127
	 * register model filter operator with dte's IConditionalExpression operator
127
	 * register model filter operator with dte's IConditionalExpression operator
128
	 */
128
	 */
Lines 177-187 Link Here
177
	/**
177
	/**
178
	 * This method is used to register the Java Script Objects which are defined in the scope of
178
	 * This method is used to register the Java Script Objects which are defined in the scope of
179
	 * source ResultSet ( might be IResultSet or CubeCursor ) to target scope. One possible client
179
	 * source ResultSet ( might be IResultSet or CubeCursor ) to target scope. One possible client
180
	 * of this method is Report Engine. A classic use case is that instead of register its own "row" object 
180
	 * of this method is Report Engine. A classic use case is that instead of register its own "row" object
181
	 * the Report Engine can simply call this method with proper argument so that the "row" object
181
	 * the Report Engine can simply call this method with proper argument so that the "row" object
182
	 * registered in IResultIterator's scope, that is, JSResultSetRow, can be accessed by engine using
182
	 * registered in IResultIterator's scope, that is, JSResultSetRow, can be accessed by engine using
183
	 * engine scope. 
183
	 * engine scope.
184
	 *   
184
	 *
185
	 * @param targetScope
185
	 * @param targetScope
186
	 * @param source
186
	 * @param source
187
	 */
187
	 */
Lines 205-211 Link Here
205
					scope ) );
205
					scope ) );
206
		}
206
		}
207
	}
207
	}
208
	
208
209
	/**
209
	/**
210
	 * Adapts a Model data type (string) to Data Engine data type constant
210
	 * Adapts a Model data type (string) to Data Engine data type constant
211
	 * (integer) on column
211
	 * (integer) on column
Lines 234-242 Link Here
234
			return DataType.BOOLEAN_TYPE;
234
			return DataType.BOOLEAN_TYPE;
235
		if ( modelDataType.equals( DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB ) )
235
		if ( modelDataType.equals( DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB ) )
236
			return DataType.BLOB_TYPE;
236
			return DataType.BLOB_TYPE;
237
		if ( modelDataType.equals( DesignChoiceConstants.COLUMN_DATA_TYPE_OBJECT ) )
238
		    return DataType.OBJECT_TYPE;
239
237
		return DataType.UNKNOWN_TYPE;
240
		return DataType.UNKNOWN_TYPE;
238
	}
241
	}
239
	
242
240
	/**
243
	/**
241
	 * @param type: a Data Engine data type
244
	 * @param type: a Data Engine data type
242
	 * @return Data Engine data types compatible with <code>type</code>, including <code>type</code> itself
245
	 * @return Data Engine data types compatible with <code>type</code>, including <code>type</code> itself
Lines 256-263 Link Here
256
				return new int[]{ DataType.DECIMAL_TYPE, DataType.DOUBLE_TYPE, DataType.INTEGER_TYPE };
259
				return new int[]{ DataType.DECIMAL_TYPE, DataType.DOUBLE_TYPE, DataType.INTEGER_TYPE };
257
			case DataType.STRING_TYPE:
260
			case DataType.STRING_TYPE:
258
				return new int[]{ DataType.STRING_TYPE, DataType.BOOLEAN_TYPE,
261
				return new int[]{ DataType.STRING_TYPE, DataType.BOOLEAN_TYPE,
259
						DataType.DECIMAL_TYPE, DataType.DOUBLE_TYPE, DataType.INTEGER_TYPE, 
262
						DataType.DECIMAL_TYPE, DataType.DOUBLE_TYPE, DataType.INTEGER_TYPE,
260
						DataType.DATE_TYPE, DataType.BLOB_TYPE, DataType.BINARY_TYPE, 
263
						DataType.DATE_TYPE, DataType.BLOB_TYPE, DataType.BINARY_TYPE,
261
						DataType.SQL_DATE_TYPE, DataType.SQL_TIME_TYPE };
264
						DataType.SQL_DATE_TYPE, DataType.SQL_TIME_TYPE };
262
			case DataType.DATE_TYPE:
265
			case DataType.DATE_TYPE:
263
				return new int[]{ DataType.DATE_TYPE, DataType.SQL_DATE_TYPE, DataType.SQL_TIME_TYPE };
266
				return new int[]{ DataType.DATE_TYPE, DataType.SQL_DATE_TYPE, DataType.SQL_TIME_TYPE };
Lines 265-270 Link Here
265
				return new int[]{ DataType.BLOB_TYPE };
268
				return new int[]{ DataType.BLOB_TYPE };
266
			case DataType.BINARY_TYPE:
269
			case DataType.BINARY_TYPE:
267
				return new int[]{ DataType.BINARY_TYPE };
270
				return new int[]{ DataType.BINARY_TYPE };
271
            case DataType.OBJECT_TYPE:
272
                return new int[]{ DataType.OBJECT_TYPE };
268
			case DataType.SQL_DATE_TYPE:
273
			case DataType.SQL_DATE_TYPE:
269
				return new int[]{ DataType.SQL_DATE_TYPE, DataType.DATE_TYPE };
274
				return new int[]{ DataType.SQL_DATE_TYPE, DataType.DATE_TYPE };
270
			case DataType.SQL_TIME_TYPE:
275
			case DataType.SQL_TIME_TYPE:
Lines 273-279 Link Here
273
				throw new AdapterException( ResourceConstants.INVALID_DATA_TYPE, type );
278
				throw new AdapterException( ResourceConstants.INVALID_DATA_TYPE, type );
274
		}
279
		}
275
	}
280
	}
276
		
281
277
	/**
282
	/**
278
	 * Adapter dte's data type to model data type
283
	 * Adapter dte's data type to model data type
279
	 * @param apiDataType
284
	 * @param apiDataType
Lines 299-310 Link Here
299
			return DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN;
304
			return DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN;
300
		else if ( apiDataType == DataType.BLOB_TYPE )
305
		else if ( apiDataType == DataType.BLOB_TYPE )
301
			return DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB;
306
			return DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB;
307
		else if ( apiDataType == DataType.OBJECT_TYPE )
308
            return DesignChoiceConstants.COLUMN_DATA_TYPE_OBJECT;
302
309
303
		return DesignChoiceConstants.COLUMN_DATA_TYPE_ANY;
310
		return DesignChoiceConstants.COLUMN_DATA_TYPE_ANY;
304
	}
311
	}
305
	
312
306
	/**
313
	/**
307
	 * 
314
	 *
308
	 * @param modelAggrType
315
	 * @param modelAggrType
309
	 * @return
316
	 * @return
310
	 * @throws AdapterException
317
	 * @throws AdapterException
Lines 315-325 Link Here
315
		Object o = aggrAdapterMap.get( modelAggrType );
322
		Object o = aggrAdapterMap.get( modelAggrType );
316
		return o == null ? modelAggrType : o.toString( );
323
		return o == null ? modelAggrType : o.toString( );
317
	}
324
	}
318
	
325
319
	/**
326
	/**
320
	 * This method is used to adapter model filter's operator into dte's
327
	 * This method is used to adapter model filter's operator into dte's
321
	 * operator
328
	 * operator
322
	 * 
329
	 *
323
	 * @param modelOpr
330
	 * @param modelOpr
324
	 * @return
331
	 * @return
325
	 */
332
	 */
Lines 331-342 Link Here
331
		else
338
		else
332
			return IConditionalExpression.OP_NONE;
339
			return IConditionalExpression.OP_NONE;
333
	}
340
	}
334
	
341
335
	/**
342
	/**
336
	 * Get the rollup aggregation name. If the function is TOTAL_AVE_FUNC,
343
	 * Get the rollup aggregation name. If the function is TOTAL_AVE_FUNC,
337
	 * TOTAL_COUNT_FUNC, or TOTAL_COUNT_DISTINCT_FUNC, return TOTAL_SUM_FUNC as
344
	 * TOTAL_COUNT_FUNC, or TOTAL_COUNT_DISTINCT_FUNC, return TOTAL_SUM_FUNC as
338
	 * measure function name
345
	 * measure function name
339
	 * 
346
	 *
340
	 * @param functionName
347
	 * @param functionName
341
	 * @return
348
	 * @return
342
	 */
349
	 */
Lines 360-369 Link Here
360
		else
367
		else
361
			return func;
368
			return func;
362
	}
369
	}
363
	
370
364
	/**
371
	/**
365
	 * This method is used to adapter model sort direction into dte's direction.
372
	 * This method is used to adapter model sort direction into dte's direction.
366
	 * 
373
	 *
367
	 * @param dir
374
	 * @param dir
368
	 * @return
375
	 * @return
369
	 */
376
	 */
Lines 372-380 Link Here
372
		return DesignChoiceConstants.SORT_DIRECTION_DESC.equals( modelSortDir )
379
		return DesignChoiceConstants.SORT_DIRECTION_DESC.equals( modelSortDir )
373
				? ISortDefinition.SORT_DESC : ISortDefinition.SORT_ASC;
380
				? ISortDefinition.SORT_DESC : ISortDefinition.SORT_ASC;
374
	}
381
	}
375
	
382
376
	/**
383
	/**
377
	 * 
384
	 *
378
	 * @param type
385
	 * @param type
379
	 * @return
386
	 * @return
380
	 */
387
	 */
Lines 399-407 Link Here
399
			typeNum = DataType.INTEGER_TYPE;
406
			typeNum = DataType.INTEGER_TYPE;
400
		return typeNum;
407
		return typeNum;
401
	}
408
	}
402
	
409
403
	/**
410
	/**
404
	 * 
411
	 *
405
	 * @param dteDTName
412
	 * @param dteDTName
406
	 * @return
413
	 * @return
407
	 */
414
	 */
Lines 430-438 Link Here
430
			modelDataType = DesignChoiceConstants.PARAM_TYPE_TIME;
437
			modelDataType = DesignChoiceConstants.PARAM_TYPE_TIME;
431
		return modelDataType;
438
		return modelDataType;
432
	}
439
	}
433
	
440
434
	/**
441
	/**
435
	 * 
442
	 *
436
	 * @param name
443
	 * @param name
437
	 * @return
444
	 * @return
438
	 */
445
	 */
Lines 442-451 Link Here
442
				? org.eclipse.birt.data.aggregation.impl.Constants.EXPRESSION_NAME
449
				? org.eclipse.birt.data.aggregation.impl.Constants.EXPRESSION_NAME
443
				: name;
450
				: name;
444
	}
451
	}
445
	
452
446
	/**
453
	/**
447
	 * Get the parameter value from .rptconfig file if it does exist
454
	 * Get the parameter value from .rptconfig file if it does exist
448
	 * 
455
	 *
449
	 * @return Object[] the parameter value
456
	 * @return Object[] the parameter value
450
	 */
457
	 */
451
	public static Object getParamValueFromConfigFile( ScalarParameterHandle paramHandle )
458
	public static Object getParamValueFromConfigFile( ScalarParameterHandle paramHandle )
Lines 463-470 Link Here
463
		String reportConfigName = designFileName.substring( 0, index + 1 )
470
		String reportConfigName = designFileName.substring( 0, index + 1 )
464
				+ "rptconfig";
471
				+ "rptconfig";
465
		final File file = new File( reportConfigName );
472
		final File file = new File( reportConfigName );
466
		
473
467
		
474
468
		if ( AccessController.doPrivileged( new PrivilegedAction<Boolean>()
475
		if ( AccessController.doPrivileged( new PrivilegedAction<Boolean>()
469
				{
476
				{
470
			  public Boolean run()
477
			  public Boolean run()
Lines 529-535 Link Here
529
					{
536
					{
530
						try
537
						try
531
						{
538
						{
532
							return DataTypeUtil.convert( 
539
							return DataTypeUtil.convert(
533
									values.get( 0 ), DataAdapterUtil.modelDataTypeToCoreDataType( parameterHandle.getDataType() ) );
540
									values.get( 0 ), DataAdapterUtil.modelDataTypeToCoreDataType( parameterHandle.getDataType() ) );
534
						}
541
						}
535
						catch ( BirtException e )
542
						catch ( BirtException e )
Lines 537-548 Link Here
537
							return null;
544
							return null;
538
						}
545
						}
539
					}
546
					}
540
					
547
541
					try {
548
					try {
542
						Object[] reValues = new Object[values.size()];
549
						Object[] reValues = new Object[values.size()];
543
						for (int i = 0; i < reValues.length; i++)
550
						for (int i = 0; i < reValues.length; i++)
544
						{
551
						{
545
							reValues[i] = DataTypeUtil.convert( 
552
							reValues[i] = DataTypeUtil.convert(
546
									values.get(i), DataAdapterUtil.modelDataTypeToCoreDataType(parameterHandle.getDataType()));
553
									values.get(i), DataAdapterUtil.modelDataTypeToCoreDataType(parameterHandle.getDataType()));
547
						}
554
						}
548
						return reValues;
555
						return reValues;
Lines 559-565 Link Here
559
566
560
	/**
567
	/**
561
	 * Delete the last "_" part
568
	 * Delete the last "_" part
562
	 * 
569
	 *
563
	 * @param name
570
	 * @param name
564
	 * @return String
571
	 * @return String
565
	 */
572
	 */
Lines 571-577 Link Here
571
578
572
	/**
579
	/**
573
	 * Checks whether the parameter value is null in the rptconfig file
580
	 * Checks whether the parameter value is null in the rptconfig file
574
	 * 
581
	 *
575
	 * @param varName
582
	 * @param varName
576
	 * @param varValue
583
	 * @param varValue
577
	 * @param newParaName
584
	 * @param newParaName
Lines 583-605 Link Here
583
		return varName.toLowerCase( ).startsWith( "__isnull" )
590
		return varName.toLowerCase( ).startsWith( "__isnull" )
584
				&& varValue.equals( newParaName );
591
				&& varValue.equals( newParaName );
585
	}
592
	}
586
	
593
587
	private static class JSResultIteratorObject extends ScriptableObject
594
	private static class JSResultIteratorObject extends ScriptableObject
588
	{
595
	{
589
		/**
596
		/**
590
		 * 
597
		 *
591
		 */
598
		 */
592
		private static final long serialVersionUID = 684728008759347940L;
599
		private static final long serialVersionUID = 684728008759347940L;
593
		private ILinkedResult it;
600
		private ILinkedResult it;
594
		private IResultIterator currentIterator;
601
		private IResultIterator currentIterator;
595
		
602
596
		JSResultIteratorObject( ILinkedResult it )
603
		JSResultIteratorObject( ILinkedResult it )
597
		{
604
		{
598
			this.it = it;
605
			this.it = it;
599
			if ( it.getCurrentResultType( ) == ILinkedResult.TYPE_TABLE )
606
			if ( it.getCurrentResultType( ) == ILinkedResult.TYPE_TABLE )
600
				this.currentIterator = (IResultIterator) it.getCurrentResult( );
607
				this.currentIterator = (IResultIterator) it.getCurrentResult( );
601
		}
608
		}
602
		
609
603
		public String getClassName( )
610
		public String getClassName( )
604
		{
611
		{
605
			return "JSResultIteratorObject";
612
			return "JSResultIteratorObject";
(-)src/org/eclipse/birt/report/model/adapter/oda/impl/ODAFactory.java (-3 / +7 lines)
Lines 27-33 Link Here
27
27
28
	/*
28
	/*
29
	 * (non-Javadoc)
29
	 * (non-Javadoc)
30
	 * 
30
	 *
31
	 * @see
31
	 * @see
32
	 * org.eclipse.birt.report.model.adapter.oda.api.IODAFactory#getUpdatedDataType
32
	 * org.eclipse.birt.report.model.adapter.oda.api.IODAFactory#getUpdatedDataType
33
	 * (java.lang.String, java.lang.String, int, java.lang.String,
33
	 * (java.lang.String, java.lang.String, int, java.lang.String,
Lines 99-104 Link Here
99
				return DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN;
99
				return DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN;
100
			case DataType.BLOB_TYPE :
100
			case DataType.BLOB_TYPE :
101
				return DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB;
101
				return DesignChoiceConstants.COLUMN_DATA_TYPE_BLOB;
102
			case DataType.OBJECT_TYPE :
103
			    return DesignChoiceConstants.COLUMN_DATA_TYPE_OBJECT;
102
			case DataType.BINARY_TYPE :
104
			case DataType.BINARY_TYPE :
103
			case DataType.ANY_TYPE :
105
			case DataType.ANY_TYPE :
104
			default :
106
			default :
Lines 126-131 Link Here
126
				return DesignChoiceConstants.PARAM_TYPE_FLOAT;
128
				return DesignChoiceConstants.PARAM_TYPE_FLOAT;
127
			case DataType.BOOLEAN_TYPE :
129
			case DataType.BOOLEAN_TYPE :
128
				return DesignChoiceConstants.PARAM_TYPE_BOOLEAN;
130
				return DesignChoiceConstants.PARAM_TYPE_BOOLEAN;
131
			case DataType.OBJECT_TYPE :
132
			    return DesignChoiceConstants.PARAM_TYPE_OBJECT;
129
			case DataType.ANY_TYPE :
133
			case DataType.ANY_TYPE :
130
			case DataType.BLOB_TYPE :
134
			case DataType.BLOB_TYPE :
131
			case DataType.BINARY_TYPE :
135
			case DataType.BINARY_TYPE :
Lines 136-142 Link Here
136
140
137
	/**
141
	/**
138
	 * Converts DTE api data type to ROM defined data type.
142
	 * Converts DTE api data type to ROM defined data type.
139
	 * 
143
	 *
140
	 * @param choiceName
144
	 * @param choiceName
141
	 *            the ROM choice to map
145
	 *            the ROM choice to map
142
	 * @param apiDataType
146
	 * @param apiDataType
Lines 163-169 Link Here
163
167
164
	/**
168
	/**
165
	 * Checks whether the oda data type is compaible with rom data type.
169
	 * Checks whether the oda data type is compaible with rom data type.
166
	 * 
170
	 *
167
	 * @param romDataType
171
	 * @param romDataType
168
	 *            the rom data type in string
172
	 *            the rom data type in string
169
	 * @param odaDataTypeCode
173
	 * @param odaDataTypeCode
(-)src/org/eclipse/birt/data/engine/odaconsumer/ParameterHint.java (-63 / +64 lines)
Lines 10-16 Link Here
10
 *  Actuate Corporation - initial API and implementation
10
 *  Actuate Corporation - initial API and implementation
11
 *
11
 *
12
 ******************************************************************************
12
 ******************************************************************************
13
 */ 
13
 */
14
14
15
package org.eclipse.birt.data.engine.odaconsumer;
15
package org.eclipse.birt.data.engine.odaconsumer;
16
16
Lines 26-32 Link Here
26
import org.eclipse.datatools.connectivity.oda.IClob;
26
import org.eclipse.datatools.connectivity.oda.IClob;
27
27
28
/**
28
/**
29
 * <code>ParameterHint</code> provides hints to map static  
29
 * <code>ParameterHint</code> provides hints to map static
30
 * parameter definitions to runtime parameters.
30
 * parameter definitions to runtime parameters.
31
 */
31
 */
32
public class ParameterHint
32
public class ParameterHint
Lines 42-49 Link Here
42
	private boolean m_isInputMode;
42
	private boolean m_isInputMode;
43
	private boolean m_isOutputMode;
43
	private boolean m_isOutputMode;
44
	private boolean m_isNullable;
44
	private boolean m_isNullable;
45
    
45
46
    private static final int UNKNOWN_NATIVE_TYPE = 0;   
46
    private static final int UNKNOWN_NATIVE_TYPE = 0;
47
47
48
	// trace logging variables
48
	// trace logging variables
49
	private static String sm_className = ParameterHint.class.getName();
49
	private static String sm_className = ParameterHint.class.getName();
Lines 55-61 Link Here
55
	 * @param parameterName	the parameter name.
55
	 * @param parameterName	the parameter name.
56
	 * @param isInputMode	whether this is an input parameter.
56
	 * @param isInputMode	whether this is an input parameter.
57
	 * @param isOutputMode	whether this is an output parameter.
57
	 * @param isOutputMode	whether this is an output parameter.
58
	 * @throws IllegalArgumentException	if the parameter name is null or 
58
	 * @throws IllegalArgumentException	if the parameter name is null or
59
	 * 									empty.
59
	 * 									empty.
60
	 */
60
	 */
61
	public ParameterHint( String parameterName, boolean isInputMode, boolean isOutputMode )
61
	public ParameterHint( String parameterName, boolean isInputMode, boolean isOutputMode )
Lines 64-87 Link Here
64
		if( sm_logger.isLoggingEnterExitLevel() )
64
		if( sm_logger.isLoggingEnterExitLevel() )
65
		    sm_logger.entering( sm_className, methodName,
65
		    sm_logger.entering( sm_className, methodName,
66
		            			new Object[] { parameterName, new Boolean( isInputMode ), new Boolean( isOutputMode ) } );
66
		            			new Object[] { parameterName, new Boolean( isInputMode ), new Boolean( isOutputMode ) } );
67
		
67
68
		if( parameterName == null || parameterName.length() == 0 )
68
		if( parameterName == null || parameterName.length() == 0 )
69
		{
69
		{
70
			String localizedMessage = 
70
			String localizedMessage =
71
				DataResourceHandle.getInstance().getMessage( ResourceConstants.PARAMETER_NAME_CANNOT_BE_EMPTY_OR_NULL );
71
				DataResourceHandle.getInstance().getMessage( ResourceConstants.PARAMETER_NAME_CANNOT_BE_EMPTY_OR_NULL );
72
			    
72
73
			sm_logger.logp( Level.SEVERE, sm_className, methodName, 
73
			sm_logger.logp( Level.SEVERE, sm_className, methodName,
74
							"The given parameter is null or empty." ); //$NON-NLS-1$
74
							"The given parameter is null or empty." ); //$NON-NLS-1$
75
			throw new IllegalArgumentException( localizedMessage );
75
			throw new IllegalArgumentException( localizedMessage );
76
		}
76
		}
77
		
77
78
		m_name = parameterName;
78
		m_name = parameterName;
79
		m_isInputMode = isInputMode;
79
		m_isInputMode = isInputMode;
80
		m_isOutputMode = isOutputMode;
80
		m_isOutputMode = isOutputMode;
81
		
81
82
		m_isInputOptional = true;
82
		m_isInputOptional = true;
83
		m_isNullable = true;
83
		m_isNullable = true;
84
		
84
85
	    sm_logger.exiting( sm_className, methodName, this );
85
	    sm_logger.exiting( sm_className, methodName, this );
86
	}
86
	}
87
87
Lines 93-131 Link Here
93
	{
93
	{
94
		return m_name;
94
		return m_name;
95
	}
95
	}
96
	
96
97
	/**
97
	/**
98
	 * Sets the parameter 1-based position for this parameter hint.
98
	 * Sets the parameter 1-based position for this parameter hint.
99
	 * @param position	the 1-based position of the parameter.
99
	 * @param position	the 1-based position of the parameter.
100
	 * @throws IllegalArgumentException	if the parameter position is less 
100
	 * @throws IllegalArgumentException	if the parameter position is less
101
	 * 									than 1.
101
	 * 									than 1.
102
	 */
102
	 */
103
	public void setPosition( int position )
103
	public void setPosition( int position )
104
	{
104
	{
105
		final String methodName = "setPosition( int )"; //$NON-NLS-1$
105
		final String methodName = "setPosition( int )"; //$NON-NLS-1$
106
		
106
107
		if( position < 1 )
107
		if( position < 1 )
108
		{
108
		{
109
			String localizedMessage = 
109
			String localizedMessage =
110
				DataResourceHandle.getInstance().getMessage( ResourceConstants.PARAMETER_POSITION_CANNOT_BE_LESS_THAN_ONE );
110
				DataResourceHandle.getInstance().getMessage( ResourceConstants.PARAMETER_POSITION_CANNOT_BE_LESS_THAN_ONE );
111
			sm_logger.logp( Level.SEVERE, sm_className, methodName, 
111
			sm_logger.logp( Level.SEVERE, sm_className, methodName,
112
					"Invalid parameter position {0} ", new Integer( position ) ); //$NON-NLS-1$
112
					"Invalid parameter position {0} ", new Integer( position ) ); //$NON-NLS-1$
113
			throw new IllegalArgumentException( localizedMessage );
113
			throw new IllegalArgumentException( localizedMessage );
114
		}
114
		}
115
		
115
116
		m_position = position;
116
		m_position = position;
117
	}
117
	}
118
	
118
119
	/**
119
	/**
120
	 * Returns the parameter 1-based position for this parameter hint.
120
	 * Returns the parameter 1-based position for this parameter hint.
121
	 * @return	the 1-based position of the parameter; 0 if no position was 
121
	 * @return	the 1-based position of the parameter; 0 if no position was
122
	 * 			specified.
122
	 * 			specified.
123
	 */
123
	 */
124
	public int getPosition()
124
	public int getPosition()
125
	{
125
	{
126
		return m_position;
126
		return m_position;
127
	}
127
	}
128
	
128
129
	/**
129
	/**
130
	 * Sets the data type for this parameter hint.
130
	 * Sets the data type for this parameter hint.
131
	 * @param dataType	the data type of the parameter.
131
	 * @param dataType	the data type of the parameter.
Lines 134-144 Link Here
134
	public void setDataType( Class dataType )
134
	public void setDataType( Class dataType )
135
	{
135
	{
136
		final String methodName = "setDataType( Class )"; //$NON-NLS-1$
136
		final String methodName = "setDataType( Class )"; //$NON-NLS-1$
137
		
137
138
		// validate given data type;
138
		// validate given data type;
139
		// data type for a hint may be null
139
		// data type for a hint may be null
140
		boolean isValid = false;
140
		boolean isValid = false;
141
		if( dataType == null || 
141
		if( dataType == null ||
142
		        dataType == Integer.class ||
142
		        dataType == Integer.class ||
143
		        dataType == Double.class ||
143
		        dataType == Double.class ||
144
		        dataType == String.class ||
144
		        dataType == String.class ||
Lines 149-182 Link Here
149
		        dataType == Timestamp.class ||
149
		        dataType == Timestamp.class ||
150
		        dataType == IBlob.class ||
150
		        dataType == IBlob.class ||
151
		        dataType == IClob.class ||
151
		        dataType == IClob.class ||
152
                dataType == Boolean.class )
152
                dataType == Boolean.class ||
153
                dataType == Object.class)
153
		{
154
		{
154
		    isValid = true;
155
		    isValid = true;
155
		}
156
		}
156
		
157
157
		// input parameter does not support Blob/Clob data type
158
		// input parameter does not support Blob/Clob data type
158
		if( isValid && isInputMode() && dataType != null )
159
		if( isValid && isInputMode() && dataType != null )
159
		{
160
		{
160
		    if( dataType == IBlob.class || 
161
		    if( dataType == IBlob.class ||
161
		        dataType == IClob.class )
162
		        dataType == IClob.class )
162
		    {
163
		    {
163
			    isValid = false;
164
			    isValid = false;
164
		    }
165
		    }
165
		}
166
		}
166
		
167
167
		if( isValid == false )
168
		if( isValid == false )
168
		{
169
		{
169
			String localizedMessage = 
170
			String localizedMessage =
170
				DataResourceHandle.getInstance().getMessage( ResourceConstants.UNSUPPORTED_PARAMETER_VALUE_TYPE,
171
				DataResourceHandle.getInstance().getMessage( ResourceConstants.UNSUPPORTED_PARAMETER_VALUE_TYPE,
171
				        new Object[]{ dataType } );
172
				        new Object[]{ dataType } );
172
			sm_logger.logp( Level.SEVERE, sm_className, methodName, 
173
			sm_logger.logp( Level.SEVERE, sm_className, methodName,
173
					"Invalid parameter data type {0}.", dataType ); //$NON-NLS-1$
174
					"Invalid parameter data type {0}.", dataType ); //$NON-NLS-1$
174
			throw new IllegalArgumentException( localizedMessage );
175
			throw new IllegalArgumentException( localizedMessage );
175
		}
176
		}
176
		
177
177
		m_dataType = dataType;
178
		m_dataType = dataType;
178
	}
179
	}
179
	
180
180
	/**
181
	/**
181
	 * Returns the parameter ODI data type specified in this parameter hint.
182
	 * Returns the parameter ODI data type specified in this parameter hint.
182
     * Note that this may not be the most effective data type to use.
183
     * Note that this may not be the most effective data type to use.
Lines 208-216 Link Here
208
    {
209
    {
209
        return m_nativeDataType;
210
        return m_nativeDataType;
210
    }
211
    }
211
    
212
212
	/**
213
	/**
213
	 * Sets whether the input parameter is optional.  Has 
214
	 * Sets whether the input parameter is optional.  Has
214
	 * no effect on non-input parameters.
215
	 * no effect on non-input parameters.
215
	 * @param isInputOptional	whether this input parameter is optional.
216
	 * @param isInputOptional	whether this input parameter is optional.
216
	 */
217
	 */
Lines 219-236 Link Here
219
		if( m_isInputMode )
220
		if( m_isInputMode )
220
			m_isInputOptional = isInputOptional;
221
			m_isInputOptional = isInputOptional;
221
	}
222
	}
222
	
223
223
	/**
224
	/**
224
	 * Returns whether the input parameter is optional.  Returns true 
225
	 * Returns whether the input parameter is optional.  Returns true
225
	 * for non-input parameters.
226
	 * for non-input parameters.
226
	 * @return	true if the input parameter is optional or if this is a 
227
	 * @return	true if the input parameter is optional or if this is a
227
	 * 			non-input parameter, false otherwise.
228
	 * 			non-input parameter, false otherwise.
228
	 */
229
	 */
229
	public boolean isInputOptional()
230
	public boolean isInputOptional()
230
	{
231
	{
231
		return ( m_isInputMode ) ? m_isInputOptional : true;
232
		return ( m_isInputMode ) ? m_isInputOptional : true;
232
	}
233
	}
233
	
234
234
	/**
235
	/**
235
	 * Sets whether the parameter can be null.
236
	 * Sets whether the parameter can be null.
236
	 * @param isNullable	whether this parameter can be null.
237
	 * @param isNullable	whether this parameter can be null.
Lines 239-245 Link Here
239
	{
240
	{
240
		m_isNullable = isNullable;
241
		m_isNullable = isNullable;
241
	}
242
	}
242
	
243
243
	/**
244
	/**
244
	 * Returns whether the parameter can be null.
245
	 * Returns whether the parameter can be null.
245
	 * @return	true if the parameter can be null, false otherwise.
246
	 * @return	true if the parameter can be null, false otherwise.
Lines 248-256 Link Here
248
	{
249
	{
249
		return m_isNullable;
250
		return m_isNullable;
250
	}
251
	}
251
	
252
252
	/**
253
	/**
253
	 * Sets the default value of the input parameter.  Has no effect on 
254
	 * Sets the default value of the input parameter.  Has no effect on
254
	 * non-input parameters.
255
	 * non-input parameters.
255
	 * @param defaultInputValue	the default value.
256
	 * @param defaultInputValue	the default value.
256
	 */
257
	 */
Lines 259-276 Link Here
259
		if( m_isInputMode )
260
		if( m_isInputMode )
260
			m_defaultInputValue = defaultInputValue;
261
			m_defaultInputValue = defaultInputValue;
261
	}
262
	}
262
	
263
263
	/**
264
	/**
264
	 * Gets the default vlaue of the input parameter.  Returns null for 
265
	 * Gets the default vlaue of the input parameter.  Returns null for
265
	 * non-input parameters.
266
	 * non-input parameters.
266
	 * @return	the default value of the input parameter, or null for 
267
	 * @return	the default value of the input parameter, or null for
267
	 * 			non-input parameters.
268
	 * 			non-input parameters.
268
	 */
269
	 */
269
	public String getDefaultInputValue()
270
	public String getDefaultInputValue()
270
	{
271
	{
271
		return ( m_isInputMode ) ? m_defaultInputValue : null;
272
		return ( m_isInputMode ) ? m_defaultInputValue : null;
272
	}
273
	}
273
	
274
274
	/**
275
	/**
275
	 * Returns whether the parameter is an input parameter.
276
	 * Returns whether the parameter is an input parameter.
276
	 * @return	true if the parameter is an input parameter, false otherwise.
277
	 * @return	true if the parameter is an input parameter, false otherwise.
Lines 291-307 Link Here
291
292
292
    /**
293
    /**
293
     * Sets the native name of the parameter as known to the underlying data source.
294
     * Sets the native name of the parameter as known to the underlying data source.
294
     * @param nativeName The native name to set; may be a null value if the name 
295
     * @param nativeName The native name to set; may be a null value if the name
295
     *          is not available or this parameter is not named.
296
     *          is not available or this parameter is not named.
296
     */
297
     */
297
    public void setNativeName( String nativeName )
298
    public void setNativeName( String nativeName )
298
    {
299
    {
299
        m_nativeName = nativeName;
300
        m_nativeName = nativeName;
300
    }
301
    }
301
	
302
302
	/**
303
	/**
303
     * Returns the native name of the parameter as known to the underlying data source.
304
     * Returns the native name of the parameter as known to the underlying data source.
304
     * @return the parameter native name, or 
305
     * @return the parameter native name, or
305
     *          null if the name is not available or this parameter is not named.
306
     *          null if the name is not available or this parameter is not named.
306
     */
307
     */
307
    public String getNativeName()
308
    public String getNativeName()
Lines 310-316 Link Here
310
    }
311
    }
311
312
312
    /**
313
    /**
313
     * Sets hether this parameter allows binding with multiple input values.  
314
     * Sets hether this parameter allows binding with multiple input values.
314
     * Has no effect on non-input parameters.
315
     * Has no effect on non-input parameters.
315
     * @param isMultiInputValuesAllowed  true if multiple input values are allowed;
316
     * @param isMultiInputValuesAllowed  true if multiple input values are allowed;
316
     *          false if at most a single input value is allowed.
317
     *          false if at most a single input value is allowed.
Lines 333-339 Link Here
333
    }
334
    }
334
335
335
    /**
336
    /**
336
	 * Helper method to update this <code>ParameterHint</code> with 
337
	 * Helper method to update this <code>ParameterHint</code> with
337
	 * information from another <code>ParameterHint</code>.
338
	 * information from another <code>ParameterHint</code>.
338
	 * @param hint	the <code>ParameterHint</code> instance.
339
	 * @param hint	the <code>ParameterHint</code> instance.
339
	 */
340
	 */
Lines 343-349 Link Here
343
		sm_logger.entering( sm_className, methodName, hint );
344
		sm_logger.entering( sm_className, methodName, hint );
344
345
345
		m_name = hint.m_name;
346
		m_name = hint.m_name;
346
		
347
347
		// don't update if the specified hint has default values
348
		// don't update if the specified hint has default values
348
349
349
	    if( hint.m_nativeName != null )
350
	    if( hint.m_nativeName != null )
Lines 351-363 Link Here
351
352
352
		if( hint.m_position != 0 )
353
		if( hint.m_position != 0 )
353
			m_position = hint.m_position;
354
			m_position = hint.m_position;
354
		
355
355
		if( hint.m_dataType != null )
356
		if( hint.m_dataType != null )
356
			m_dataType = hint.m_dataType;
357
			m_dataType = hint.m_dataType;
357
        
358
358
        if( hint.m_nativeDataType != UNKNOWN_NATIVE_TYPE )
359
        if( hint.m_nativeDataType != UNKNOWN_NATIVE_TYPE )
359
            m_nativeDataType = hint.m_nativeDataType;
360
            m_nativeDataType = hint.m_nativeDataType;
360
		
361
361
		m_isInputOptional = hint.m_isInputOptional;
362
		m_isInputOptional = hint.m_isInputOptional;
362
		m_defaultInputValue = hint.m_defaultInputValue;
363
		m_defaultInputValue = hint.m_defaultInputValue;
363
		m_isInputMode = hint.m_isInputMode;
364
		m_isInputMode = hint.m_isInputMode;
Lines 366-395 Link Here
366
367
367
		sm_logger.exiting( sm_className, methodName, this );
368
		sm_logger.exiting( sm_className, methodName, this );
368
	}
369
	}
369
    
370
370
    /**
371
    /**
371
     * Returns the most effective ODI data type defined in the hint.
372
     * Returns the most effective ODI data type defined in the hint.
372
     * It determines the best type to use based on the native data type defined.
373
     * It determines the best type to use based on the native data type defined.
373
     * @param odaDataSourceId   underlying ODA driver's data source id that defines
374
     * @param odaDataSourceId   underlying ODA driver's data source id that defines
374
     *                          the native data type mappings
375
     *                          the native data type mappings
375
     * @param dataSetType       type of data set; may be null 
376
     * @param dataSetType       type of data set; may be null
376
     *                          if the oda data source has only one type of data set
377
     *                          if the oda data source has only one type of data set
377
     * @return  the most effective ODI data type to use
378
     * @return  the most effective ODI data type to use
378
     */
379
     */
379
    public Class getEffectiveDataType( String odaDataSourceId, String dataSetType )
380
    public Class getEffectiveDataType( String odaDataSourceId, String dataSetType )
380
    {
381
    {
381
        return DataTypeUtil.toTypeClass( 
382
        return DataTypeUtil.toTypeClass(
382
                    getEffectiveOdaType( odaDataSourceId, dataSetType ) );
383
                    getEffectiveOdaType( odaDataSourceId, dataSetType ) );
383
    }
384
    }
384
    
385
385
    int getEffectiveOdaType( String odaDataSourceId, String dataSetType )
386
    int getEffectiveOdaType( String odaDataSourceId, String dataSetType )
386
    {
387
    {
387
        /* The BIRT DtE ODI data type specified in a parameter hint may be based on
388
        /* The BIRT DtE ODI data type specified in a parameter hint may be based on
388
         * what an user manually entered in BIRT host designer, and was not necessarily 
389
         * what an user manually entered in BIRT host designer, and was not necessarily
389
         * validated against an underlying ODA driver.
390
         * validated against an underlying ODA driver.
390
         * Whereas, the native data type in hint, if available, is provided by
391
         * Whereas, the native data type in hint, if available, is provided by
391
         * a custom ODA designer.  It is thus a more reliable type to use in a retry.  
392
         * a custom ODA designer.  It is thus a more reliable type to use in a retry.
392
         * So we first try to use the native data type for the effective ODA data type. 
393
         * So we first try to use the native data type for the effective ODA data type.
393
         */
394
         */
394
        if( getNativeDataType() != UNKNOWN_NATIVE_TYPE )
395
        if( getNativeDataType() != UNKNOWN_NATIVE_TYPE )
395
        {
396
        {
Lines 399-408 Link Here
399
            if( odaType != Types.NULL )
400
            if( odaType != Types.NULL )
400
                return odaType;     // found valid native to oda type mapping
401
                return odaType;     // found valid native to oda type mapping
401
        }
402
        }
402
        
403
403
        // no native data type mapping info, use the BIRT DtE ODI API data type instead 
404
        // no native data type mapping info, use the BIRT DtE ODI API data type instead
404
        Class typeInHint = getDataType();
405
        Class typeInHint = getDataType();
405
        return DataTypeUtil.toOdaType( typeInHint );
406
        return DataTypeUtil.toOdaType( typeInHint );
406
    }
407
    }
407
    
408
408
}
409
}
(-)src/org/eclipse/birt/data/engine/executor/ResultClassHelper.java (-9 / +9 lines)
Lines 41-47 Link Here
41
	}
41
	}
42
42
43
	/**
43
	/**
44
	 * 
44
	 *
45
	 * @throws DataException
45
	 * @throws DataException
46
	 */
46
	 */
47
	private void initIndex( ) throws DataException
47
	private void initIndex( ) throws DataException
Lines 52-60 Link Here
52
		{
52
		{
53
			Class valueClass = resultClass.getFieldValueClass( i + 1 );
53
			Class valueClass = resultClass.getFieldValueClass( i + 1 );
54
			assert valueClass != null;
54
			assert valueClass != null;
55
			if ( valueClass.isAssignableFrom( IClob.class ) )
55
			if ( IClob.class.isAssignableFrom( valueClass ) )
56
				clobIndexList.add( new Integer( i ) );
56
				clobIndexList.add( new Integer( i ) );
57
			else if ( valueClass.isAssignableFrom( IBlob.class ) )
57
			else if ( IBlob.class.isAssignableFrom( valueClass ) )
58
				blobIndexList.add( new Integer( i ) );;
58
				blobIndexList.add( new Integer( i ) );;
59
		}
59
		}
60
		clobIndex = toIntArray( clobIndexList );
60
		clobIndex = toIntArray( clobIndexList );
Lines 64-70 Link Here
64
	}
64
	}
65
65
66
	/**
66
	/**
67
	 * 
67
	 *
68
	 * @param integerList
68
	 * @param integerList
69
	 * @return
69
	 * @return
70
	 */
70
	 */
Lines 77-85 Link Here
77
		}
77
		}
78
		return reArray;
78
		return reArray;
79
	}
79
	}
80
	
80
81
	/**
81
	/**
82
	 * 
82
	 *
83
	 * @return
83
	 * @return
84
	 */
84
	 */
85
	boolean hasClobOrBlob( )
85
	boolean hasClobOrBlob( )
Lines 88-94 Link Here
88
	}
88
	}
89
89
90
	/**
90
	/**
91
	 * 
91
	 *
92
	 * @return
92
	 * @return
93
	 */
93
	 */
94
	int[] getClobIndexArray( )
94
	int[] getClobIndexArray( )
Lines 97-108 Link Here
97
	}
97
	}
98
98
99
	/**
99
	/**
100
	 * 
100
	 *
101
	 * @return
101
	 * @return
102
	 */
102
	 */
103
	int[] getBlobIndexArray( )
103
	int[] getBlobIndexArray( )
104
	{
104
	{
105
		return blobIndex;
105
		return blobIndex;
106
	}
106
	}
107
	
107
108
}
108
}
(-)src/org/eclipse/birt/data/engine/olap/data/util/DataType.java (-5 / +5 lines)
Lines 16-22 Link Here
16
import java.util.Date;
16
import java.util.Date;
17
17
18
/**
18
/**
19
 * 
19
 *
20
 */
20
 */
21
21
22
public class DataType
22
public class DataType
Lines 33-39 Link Here
33
	public static final int BYTES_TYPE = 102;
33
	public static final int BYTES_TYPE = 102;
34
	public static final int SQL_DATE_TYPE = org.eclipse.birt.core.data.DataType.SQL_DATE_TYPE;
34
	public static final int SQL_DATE_TYPE = org.eclipse.birt.core.data.DataType.SQL_DATE_TYPE;
35
	public static final int SQL_TIME_TYPE = org.eclipse.birt.core.data.DataType.SQL_TIME_TYPE;
35
	public static final int SQL_TIME_TYPE = org.eclipse.birt.core.data.DataType.SQL_TIME_TYPE;
36
	
36
37
37
38
	private static final String[] names = {
38
	private static final String[] names = {
39
			"Boolean",
39
			"Boolean",
Lines 87-93 Link Here
87
87
88
	/**
88
	/**
89
	 * Gets the description of a data type.
89
	 * Gets the description of a data type.
90
	 * 
90
	 *
91
	 * @param typeCode
91
	 * @param typeCode
92
	 *            Data type enumeration value
92
	 *            Data type enumeration value
93
	 * @return Textual description of data type. "Unknown" if an undefined data
93
	 * @return Textual description of data type. "Unknown" if an undefined data
Lines 111-117 Link Here
111
111
112
	/**
112
	/**
113
	 * Gets the Java class used to represent the specified data type.
113
	 * Gets the Java class used to represent the specified data type.
114
	 * 
114
	 *
115
	 * @return Class for the specified data type. If data type is unknown or
115
	 * @return Class for the specified data type. If data type is unknown or
116
	 *         ANY, returns null.
116
	 *         ANY, returns null.
117
	 */
117
	 */
Lines 132-138 Link Here
132
	}
132
	}
133
133
134
	/**
134
	/**
135
	 * 
135
	 *
136
	 * @param objClass
136
	 * @param objClass
137
	 * @return
137
	 * @return
138
	 */
138
	 */

Return to bug 178897