Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
9d6be8c6
Kaydet (Commit)
9d6be8c6
authored
Ock 08, 2010
tarafından
Ocke Janssen [oj]
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Automated merge with
http://hg.services.openoffice.org/cws/dba33e
üst
63ccb14f
ed6a9255
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
244 deletions
+32
-244
SDBCReportDataFactory.java
...ilder/java/com/sun/star/report/SDBCReportDataFactory.java
+26
-242
PentahoReportJob.java
...er/java/com/sun/star/report/pentaho/PentahoReportJob.java
+1
-1
FormatValueUtility.java
...ar/report/pentaho/layoutprocessor/FormatValueUtility.java
+1
-1
TableCellLayoutController.java
...rt/pentaho/layoutprocessor/TableCellLayoutController.java
+4
-0
No files found.
reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java
Dosyayı görüntüle @
9d6be8c6
...
...
@@ -254,33 +254,35 @@ public class SDBCReportDataFactory implements DataSourceFactory
final
String
quote
=
connection
.
getMetaData
().
getIdentifierQuoteString
();
final
XComponent
[]
hold
=
new
XComponent
[
1
];
final
XNameAccess
columns
=
getFieldsByCommandDescriptor
(
commandType
,
command
,
hold
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
if
(
columns
!=
null
)
{
final
Object
[]
pair
=
(
Object
[])
groupExpressions
.
get
(
i
);
String
expression
=
(
String
)
pair
[
0
];
if
(!
expression
.
startsWith
(
quote
)
&&
columns
.
hasByName
(
expression
))
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
expression
=
quote
+
expression
+
quote
;
}
expression
=
expression
.
trim
();
// Trim away white spaces
final
Object
[]
pair
=
(
Object
[])
groupExpressions
.
get
(
i
);
String
expression
=
(
String
)
pair
[
0
];
if
(
expression
.
length
()
>
0
)
{
order
.
append
(
expression
);
if
(
order
.
length
()
>
0
)
if
(!
expression
.
startsWith
(
quote
)
&&
columns
.
hasByName
(
expression
))
{
order
.
append
(
' '
)
;
expression
=
quote
+
expression
+
quote
;
}
final
String
sorting
=
(
String
)
pair
[
1
];
if
(
sorting
==
null
||
sorting
.
equals
(
OfficeToken
.
FALSE
))
{
order
.
append
(
"DESC"
);
}
if
((
i
+
1
)
<
count
)
expression
=
expression
.
trim
();
// Trim away white spaces
if
(
expression
.
length
()
>
0
)
{
order
.
append
(
", "
);
order
.
append
(
expression
);
if
(
order
.
length
()
>
0
)
{
order
.
append
(
' '
);
}
final
String
sorting
=
(
String
)
pair
[
1
];
if
(
sorting
==
null
||
sorting
.
equals
(
OfficeToken
.
FALSE
))
{
order
.
append
(
"DESC"
);
}
if
((
i
+
1
)
<
count
)
{
order
.
append
(
", "
);
}
}
}
}
...
...
@@ -296,7 +298,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
private
XNameAccess
getFieldsByCommandDescriptor
(
final
int
commandType
,
final
String
command
,
final
XComponent
[]
out
)
throws
SQLException
{
final
Class
[]
parameter
=
new
Class
[
3
];
parameter
[
0
]
=
Integer
.
class
;
parameter
[
0
]
=
int
.
class
;
parameter
[
1
]
=
String
.
class
;
parameter
[
2
]
=
out
.
getClass
();
final
XConnectionTools
tools
=
(
XConnectionTools
)
UnoRuntime
.
queryInterface
(
XConnectionTools
.
class
,
connection
);
...
...
@@ -309,171 +311,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
{
}
XNameAccess
xFields
=
null
;
// some kind of state machine to ease the sharing of code
int
eState
=
FAILED
;
switch
(
commandType
)
{
case
CommandType
.
TABLE
:
eState
=
HANDLE_TABLE
;
break
;
case
CommandType
.
QUERY
:
eState
=
HANDLE_QUERY
;
break
;
case
CommandType
.
COMMAND
:
eState
=
HANDLE_SQL
;
break
;
}
// needed in various states:
XNameAccess
xObjectCollection
=
null
;
XColumnsSupplier
xSupplyColumns
=
null
;
try
{
// go!
while
((
DONE
!=
eState
)
&&
(
FAILED
!=
eState
))
{
switch
(
eState
)
{
case
HANDLE_TABLE:
{
// initial state for handling the tables
// get the table objects
final
XTablesSupplier
xSupplyTables
=
(
XTablesSupplier
)
UnoRuntime
.
queryInterface
(
XTablesSupplier
.
class
,
connection
);
if
(
xSupplyTables
!=
null
)
{
xObjectCollection
=
xSupplyTables
.
getTables
();
// if something went wrong 'til here, then this will be handled in the next state
// next state: get the object
}
eState
=
RETRIEVE_OBJECT
;
}
break
;
case
HANDLE_QUERY:
{
// initial state for handling the tables
// get the table objects
final
XQueriesSupplier
xSupplyQueries
=
(
XQueriesSupplier
)
UnoRuntime
.
queryInterface
(
XQueriesSupplier
.
class
,
connection
);
if
(
xSupplyQueries
!=
null
)
{
xObjectCollection
=
xSupplyQueries
.
getQueries
();
// if something went wrong 'til here, then this will be handled in the next state
// next state: get the object
}
eState
=
RETRIEVE_OBJECT
;
}
break
;
case
RETRIEVE_OBJECT:
// here we should have an object (aka query or table) collection, and are going
// to retrieve the desired object
// next state: default to FAILED
eState
=
FAILED
;
if
(
xObjectCollection
!=
null
&&
xObjectCollection
.
hasByName
(
command
))
{
xSupplyColumns
=
(
XColumnsSupplier
)
UnoRuntime
.
queryInterface
(
XColumnsSupplier
.
class
,
xObjectCollection
.
getByName
(
command
));
// next: go for the columns
eState
=
RETRIEVE_COLUMNS
;
}
break
;
case
RETRIEVE_COLUMNS:
// next state: default to FAILED
eState
=
FAILED
;
if
(
xSupplyColumns
!=
null
)
{
xFields
=
xSupplyColumns
.
getColumns
();
// that's it
eState
=
DONE
;
}
break
;
case
HANDLE_SQL:
{
String
sStatementToExecute
=
command
;
// well, the main problem here is to handle statements which contain a parameter
// If we would simply execute a parametrized statement, then this will fail because
// we cannot supply any parameter values.
// Thus, we try to analyze the statement, and to append a WHERE 0=1 filter criterion
// This should cause every driver to not really execute the statement, but to return
// an empty result set with the proper structure. We then can use this result set
// to retrieve the columns.
try
{
final
XMultiServiceFactory
xComposerFac
=
(
XMultiServiceFactory
)
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
.
class
,
connection
);
if
(
xComposerFac
!=
null
)
{
final
XSingleSelectQueryComposer
xComposer
=
(
XSingleSelectQueryComposer
)
UnoRuntime
.
queryInterface
(
XSingleSelectQueryComposer
.
class
,
xComposerFac
.
createInstance
(
"com.sun.star.sdb.SingleSelectQueryComposer"
));
if
(
xComposer
!=
null
)
{
xComposer
.
setQuery
(
sStatementToExecute
);
// Now set the filter to a dummy restriction which will result in an empty
// result set.
xComposer
.
setFilter
(
"0=1"
);
sStatementToExecute
=
xComposer
.
getQuery
();
}
}
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
ex
)
{
// silent this error, this was just a try. If we're here, we did not change sStatementToExecute,
// so it will still be _rCommand, which then will be executed without being touched
}
// now execute
final
XPreparedStatement
xStatement
=
connection
.
prepareStatement
(
sStatementToExecute
);
// transfer ownership of this temporary object to the caller
out
[
0
]
=
(
XComponent
)
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
xStatement
);
// set the "MaxRows" to 0. This is just in case our attempt to append a 0=1 filter
// failed - in this case, the MaxRows restriction should at least ensure that there
// is no data returned (which would be potentially expensive)
final
XPropertySet
xStatementProps
=
(
XPropertySet
)
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
xStatement
);
try
{
if
(
xStatementProps
!=
null
)
{
xStatementProps
.
setPropertyValue
(
"MaxRows"
,
Integer
.
valueOf
(
0
));
}
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
ex
)
{
// oh damn. Not much of a chance to recover, we will no retrieve the complete
// full blown result set
}
xSupplyColumns
=
(
XColumnsSupplier
)
UnoRuntime
.
queryInterface
(
XColumnsSupplier
.
class
,
xStatement
.
executeQuery
());
// this should have given us a result set which does not contain any data, but
// the structural information we need
// so the next state is to get the columns
eState
=
RETRIEVE_COLUMNS
;
}
break
;
default
:
eState
=
FAILED
;
}
}
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
ex
)
{
}
return
xFields
;
throw
new
SQLException
();
}
private
XSingleSelectQueryComposer
getComposer
(
final
XConnectionTools
tools
,
...
...
@@ -504,61 +342,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
// should not happen
// assert False
}
try
{
final
XMultiServiceFactory
factory
=
(
XMultiServiceFactory
)
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
.
class
,
connection
);
final
XSingleSelectQueryComposer
out
=
(
XSingleSelectQueryComposer
)
UnoRuntime
.
queryInterface
(
XSingleSelectQueryComposer
.
class
,
factory
.
createInstance
(
"com.sun.star.sdb.SingleSelectQueryAnalyzer"
));
final
String
quote
=
connection
.
getMetaData
().
getIdentifierQuoteString
();
String
statement
=
command
;
switch
(
commandType
)
{
case
CommandType
.
TABLE
:
statement
=
"SELECT * FROM "
+
quote
+
command
+
quote
;
break
;
case
CommandType
.
QUERY
:
{
final
XQueriesSupplier
xSupplyQueries
=
(
XQueriesSupplier
)
UnoRuntime
.
queryInterface
(
XQueriesSupplier
.
class
,
connection
);
final
XNameAccess
queries
=
xSupplyQueries
.
getQueries
();
if
(
queries
.
hasByName
(
command
))
{
final
XPropertySet
prop
=
(
XPropertySet
)
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
queries
.
getByName
(
command
));
final
Boolean
escape
=
(
Boolean
)
prop
.
getPropertyValue
(
ESCAPEPROCESSING
);
if
(
escape
)
{
statement
=
(
String
)
prop
.
getPropertyValue
(
UNO_COMMAND
);
final
XSingleSelectQueryComposer
composer
=
getComposer
(
tools
,
statement
,
CommandType
.
COMMAND
);
if
(
composer
!=
null
)
{
final
String
order
=
(
String
)
prop
.
getPropertyValue
(
UNO_ORDER
);
if
(
order
!=
null
&&
order
.
length
()
!=
0
)
{
composer
.
setOrder
(
order
);
}
final
Boolean
applyFilter
=
(
Boolean
)
prop
.
getPropertyValue
(
UNO_APPLY_FILTER
);
if
(
applyFilter
)
{
final
String
filter
=
(
String
)
prop
.
getPropertyValue
(
UNO_FILTER
);
if
(
filter
!=
null
&&
filter
.
length
()
!=
0
)
{
composer
.
setFilter
(
filter
);
}
}
statement
=
composer
.
getQuery
();
}
}
}
break
;
}
case
CommandType
.
COMMAND
:
statement
=
command
;
break
;
}
out
.
setElementaryQuery
(
statement
);
return
out
;
}
catch
(
Exception
e
)
{
}
return
null
;
}
...
...
reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java
Dosyayı görüntüle @
9d6be8c6
...
...
@@ -375,7 +375,7 @@ public class PentahoReportJob implements ReportJob
catch
(
final
Exception
e
)
{
String
message
=
e
.
getMessage
();
if
(
message
.
length
()
==
0
)
if
(
message
==
null
||
message
.
length
()
==
0
)
{
message
=
"Failed to process the report"
;
}
...
...
reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
Dosyayı görüntüle @
9d6be8c6
...
...
@@ -57,7 +57,7 @@ public class FormatValueUtility
private
static
final
String
BOOLEAN_VALUE
=
"boolean-value"
;
private
static
final
String
STRING_VALUE
=
"string-value"
;
public
static
final
String
VALUE_TYPE
=
"value-type"
;
p
rivate
static
final
String
VALUE
=
"value"
;
p
ublic
static
final
String
VALUE
=
"value"
;
private
static
SimpleDateFormat
dateFormat
;
private
static
SimpleDateFormat
timeFormat
;
...
...
reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
Dosyayı görüntüle @
9d6be8c6
...
...
@@ -80,6 +80,10 @@ public class TableCellLayoutController extends SectionLayoutController
{
FormatValueUtility
.
applyValueForCell
(
value
.
getValue
(),
attributeMap
,
valueType
);
}
else
if
(
"float"
.
equals
(
valueType
))
{
attributeMap
.
setAttribute
(
OfficeNamespaces
.
OFFICE_NS
,
FormatValueUtility
.
VALUE
,
"1.#NAN"
);
}
}
catch
(
Exception
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment