summaryrefslogtreecommitdiff
path: root/reportbuilder
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-04-07 13:14:23 +0200
committersb <sb@openoffice.org>2010-04-07 13:14:23 +0200
commitb2124b5bf90a363cabdce4a30567b8b16e547395 (patch)
treee82d701ab4c0fc90625a583f61fa0b6b8cddbc09 /reportbuilder
parent960de8c8550455a8353120318990a325ecf74aca (diff)
parent31c6a714d09f18d5b1fa95edff156f0f856119c6 (diff)
sb118: merged in re/DEV300_next towards DEV300_m76
Diffstat (limited to 'reportbuilder')
-rw-r--r--reportbuilder/images/em42.pngbin1965 -> 0 bytes
-rw-r--r--reportbuilder/images/em42_hc.pngbin1160 -> 0 bytes
-rw-r--r--reportbuilder/images/em47.pngbin0 -> 5448 bytes
-rw-r--r--reportbuilder/images/em47_hc.pngbin0 -> 3182 bytes
-rw-r--r--reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java270
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java7
-rwxr-xr-xreportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java4
-rw-r--r--reportbuilder/util/component.txt2
-rw-r--r--reportbuilder/util/description.xml13
-rw-r--r--reportbuilder/util/makefile.mk10
-rw-r--r--reportbuilder/util/manifest.xml2
12 files changed, 52 insertions, 258 deletions
diff --git a/reportbuilder/images/em42.png b/reportbuilder/images/em42.png
deleted file mode 100644
index 31f48ea8fb69..000000000000
--- a/reportbuilder/images/em42.png
+++ /dev/null
Binary files differ
diff --git a/reportbuilder/images/em42_hc.png b/reportbuilder/images/em42_hc.png
deleted file mode 100644
index 3870cc4709d4..000000000000
--- a/reportbuilder/images/em42_hc.png
+++ /dev/null
Binary files differ
diff --git a/reportbuilder/images/em47.png b/reportbuilder/images/em47.png
new file mode 100644
index 000000000000..a018f1710ea5
--- /dev/null
+++ b/reportbuilder/images/em47.png
Binary files differ
diff --git a/reportbuilder/images/em47_hc.png b/reportbuilder/images/em47_hc.png
new file mode 100644
index 000000000000..418cd1479298
--- /dev/null
+++ b/reportbuilder/images/em47_hc.png
Binary files differ
diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java
index 79d37c6fcd45..de632a3671f9 100644
--- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java
+++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java
@@ -207,7 +207,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
final Boolean escapeProcessing = (Boolean) parameters.get(ESCAPE_PROCESSING);
final String filter = (String) parameters.get(UNO_FILTER);
final Integer maxRows = (Integer) parameters.get("MaxRows");
- RowSetProperties rowSetProps = new RowSetProperties(escapeProcessing, commandType, command, filter, maxRows);
+ final RowSetProperties rowSetProps = new RowSetProperties(escapeProcessing, commandType, command, filter, maxRows);
final Object[] p = createRowSet(rowSetProps, parameters);
final XRowSet rowSet = (XRowSet) p[0];
@@ -251,33 +251,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 (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(", ");
+ }
}
}
}
@@ -293,7 +295,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);
@@ -306,171 +308,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,
@@ -501,61 +339,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;
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java
index 032ccb67d965..907bbd230dfd 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java
@@ -254,6 +254,11 @@ public class PentahoReportJob implements ReportJob
if (parameters.length > 0)
{
String name = parameters[0].toString();
+ if (parameters[0] instanceof ContextLookup)
+ {
+ final ContextLookup context = (ContextLookup) parameters[0];
+ name = context.getName();
+ }
for (int j = 0; j < reportFunctions.length; j++)
{
if (reportFunctions[j] instanceof FormulaExpression)
@@ -367,7 +372,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";
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
index d5f3d7386114..8be077b4375b 100755
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
@@ -54,7 +54,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";
- private static final String VALUE = "value";
+ public static final String VALUE = "value";
private static SimpleDateFormat dateFormat;
private static SimpleDateFormat timeFormat;
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
index de718e8fc700..681b8d8e4f0c 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
@@ -77,6 +77,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)
{
diff --git a/reportbuilder/util/component.txt b/reportbuilder/util/component.txt
index 17f312c8ea72..3b6ba3156efc 100644
--- a/reportbuilder/util/component.txt
+++ b/reportbuilder/util/component.txt
@@ -1 +1 @@
-Create with the Sun Report Builder stylish, smart-looking database reports. The flexible report editor can define group and page headers as well as group and page footers and even calculation fields are available to accomplish complex database reports.
+Create with the Oracle Report Builder stylish, smart-looking database reports. The flexible report editor can define group and page headers as well as group and page footers and even calculation fields are available to accomplish complex database reports.
diff --git a/reportbuilder/util/description.xml b/reportbuilder/util/description.xml
index c254d5bd1a73..82ae8544b48b 100644
--- a/reportbuilder/util/description.xml
+++ b/reportbuilder/util/description.xml
@@ -3,11 +3,11 @@
xmlns:d="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
<display-name>
- <name lang="en-US">Sun Report Builder</name>
+ <name lang="en-US">Oracle Report Builder</name>
<!-- <name lang="en-US">Sun(TM) Report Builder</name> -->
</display-name>
<registration>
- <simple-license accept-by="admin" default-license-id="lic-en-US" >
+ <simple-license accept-by="admin" default-license-id="lic-en-US" suppress-if-required="true" >
<license-text xlink:href="licensefile" lang="isocode" license-id="lic-isocode"/>
</simple-license>
</registration>
@@ -17,11 +17,14 @@
<OpenOffice.org-minimal-version value="3.2" d:name="OpenOffice.org 3.2"/>
</dependencies>
<publisher>
- <name xlink:href="http://www.sun.com/software/star/staroffice/extensions.jsp?cid=925095" lang="en">Sun Microsystems, Inc.</name>
+ <name xlink:href="http://www.sun.com/software/star/staroffice/extensions.jsp?cid=925095" lang="en">Oracle</name>
</publisher>
<icon>
- <default xlink:href="images/em42.png" />
- <high-contrast xlink:href="images/em42_hc.png" />
+ <default xlink:href="images/em47.png" />
+ <high-contrast xlink:href="images/em47_hc.png" />
</icon>
+ <extension-description>
+ <src xlink:href="help/component.txt" lang="en" />
+ </extension-description>
</description>
diff --git a/reportbuilder/util/makefile.mk b/reportbuilder/util/makefile.mk
index f36b1f50406c..7ff8f64e7938 100644
--- a/reportbuilder/util/makefile.mk
+++ b/reportbuilder/util/makefile.mk
@@ -28,7 +28,7 @@
PRJ=..
PRJNAME=reportbuilder
TARGET=rpt
-EXTENSION_VERSION_BASE=1.2.0
+EXTENSION_VERSION_BASE=1.2.1
.IF "$(CWS_WORK_STAMP)" == ""
EXTENSION_VERSION=$(EXTENSION_VERSION_BASE)
@@ -41,8 +41,8 @@ EXTENSION_VERSION_BASE=1.2.0
.IF "$(L10N_framework)"==""
# ------------------------------------------------------------------
# calready set in util$/makefile.pmk
-# EXTENSIONNAME:=sun-report-builder
-EXTENSION_ZIPNAME:=sun-report-builder
+# EXTENSIONNAME:=oracle-report-builder
+EXTENSION_ZIPNAME:=oracle-report-builder
# create Extension -----------------------------
@@ -76,8 +76,8 @@ COMPONENT_OTR_FILES= \
$(EXTENSIONDIR)$/template$/en-US$/wizard$/report$/default.otr
COMPONENT_IMAGES= \
- $(EXTENSIONDIR)$/images$/em42.png \
- $(EXTENSIONDIR)$/images$/em42_hc.png
+ $(EXTENSIONDIR)$/images$/em47.png \
+ $(EXTENSIONDIR)$/images$/em47_hc.png
COMPONENT_HTMLFILES = $(EXTENSIONDIR)$/THIRDPARTYREADMELICENSE.html \
$(EXTENSIONDIR)$/readme_en-US.html \
diff --git a/reportbuilder/util/manifest.xml b/reportbuilder/util/manifest.xml
index 8ea30b6ad08e..1a5a0f84623b 100644
--- a/reportbuilder/util/manifest.xml
+++ b/reportbuilder/util/manifest.xml
@@ -3,5 +3,3 @@
<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Java"
manifest:full-path="sun-report-builder.jar"/>
- <manifest:file-entry manifest:media-type="application/vnd.sun.star.package-bundle-description"
- manifest:full-path="help/component.txt"/>