Opened 11 years ago

Closed 11 years ago

#1522 closed enhancement (fixed)

Add support for timestamp type to formulas

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 2.16
Component: core Version:
Keywords: Cc:

Description

As a side-effect of #1512 and it's propagation to extended properties formulas can now also return timestamp values. The option is already present in the gui when creating a new formula. But it will create a date instead of a timestamp when used. A fix is needed to make various listings display a timestamp. We should also check if the various exporters can handle it. The table exporter currently throws an exception:

java.io.IOException: java.sql.Timestamp cannot be cast to java.lang.Number
at net.sf.basedb.clients.web.plugins.SimpleExport.exportProperties(SimpleExport.java:656)
at net.sf.basedb.clients.web.plugins.SimpleExport.performExport(SimpleExport.java:362)
at net.sf.basedb.core.plugin.AbstractExporterPlugin.run(AbstractExporterPlugin.java:144)
at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:116)
at net.sf.basedb.core.PluginExecutionRequest.run(PluginExecutionRequest.java:141)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.Number
at net.sf.basedb.util.formatter.NumberFormatter.format(NumberFormatter.java:33)
at net.sf.basedb.clients.web.plugins.PlainTextTemplate.writeProperty(PlainTextTemplate.java:123)
at net.sf.basedb.clients.web.plugins.SimpleExport.exportProperties(SimpleExport.java:634)
... 5 more

Change History (1)

comment:1 Changed 11 years ago by Nicklas Nordborg

Resolution: fixed
Status: newclosed

(In [5440]) Fixes #1522: Add support for timestamp type to formulas

List pages with formulas now use the proper formatter (added FormatterFactory?.getFormulaFormatter) which builds on the value type of the formula. The problem wih the table exporter was not actually related to the timestamp... but to a hard-coded Type.FLOAT value type for all formulas.

Other exporters (BaseFileExporter? and BfsExporter?) doesn't use formatters at all.

Note: See TracTickets for help on using tickets.