Changeset 5424


Ignore:
Timestamp:
Sep 23, 2010, 3:09:12 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

References #1512: Add support for datetime annotation types

Makes it possible to use TIMESTAMP for regular list columns. Added support for searching on the date part to the query api.

Changes all existing tables with date+time data to use TIMESTAMP instead.

This is half of 4) in the ticket description. It is still not possible to search on TIMESTAMP annotations.

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r5384 r5424  
    678678              }             
    679679              if ("".equals(value)) value = null;
    680               if (valueType == Type.DATE && value != null)
     680              if (valueType.isTemporal() && value != null)
    681681              {
    682                 // Dates are stored as long timevalues to avoid problems if user
     682                // Temporal values are stored as long timevalues to avoid problems if user
    683683                // changes the date format. The date is converted back when displayed
    684684                Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     
    793793      Operator op = filter.getOperator();
    794794      String value = filter.getValue();
    795       if (filter.getValueType() == Type.DATE && value != null)
     795      if (filter.getValueType().isTemporal() && value != null)
    796796      {
    797797        try
  • trunk/src/clients/web/net/sf/basedb/clients/web/DynamicUtil.java

    r4917 r5424  
    136136    Formatter<String> stringFormatter = FormatterFactory.getStringFormatter(sc);
    137137    Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     138    Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc);
    138139    columns.add(new TableColumn(idPrefix + "id", propertyPrefix+"id", "rep('id')",
    139140      Type.INT, titlePrefix + "Internal ID", "Reporter internal ID", "auto", true, true, true,
     
    155156        Formula.AverageMethod.NONE, dateFormatter));
    156157    columns.add(new TableColumn(idPrefix + "lastUpdate", propertyPrefix+"lastUpdate", "rep('lastUpdate')",
    157       Type.DATE, titlePrefix + "Last update", "Last updateded", "auto", true, true, true,
    158       Formula.AverageMethod.NONE, dateFormatter));
     158      Type.TIMESTAMP, titlePrefix + "Last update", "Last updateded", "auto", true, true, true,
     159      Formula.AverageMethod.NONE, dateTimeFormatter));
    159160
    160161    List<ExtendedProperty> extended = ExtendedProperties.getProperties("ReporterData");
  • trunk/src/core/net/sf/basedb/core/DateUtil.java

    r5422 r5424  
    171171        catch (Exception ex2)
    172172        {
    173           throw new InvalidDataException("The value "+value+" is not a valid date.");
     173          throw new InvalidDataException("The value "+value+" is not a valid timestamp.");
    174174        }
    175175      }
  • trunk/src/core/net/sf/basedb/core/PropertyFilter.java

    r5384 r5424  
    689689      {   
    690690        Expression propertyExpression = Hql.property(alias, property);
    691         if (getValueType() == Type.DATE && getValue() != null)
     691        if (getValueType().isTemporal() && getValue() != null)
    692692        {
    693693          if (!operator.isListOperator())
     
    695695            // To use ==, != and <= filter on dates we must add 24 hours to it
    696696            // and use different restrictions
    697             Date filter = (Date)getValueAsObject();
     697            Date filter = DateUtil.truncate((Date)getValueAsObject());
    698698            Date filterPlus24H = new Date(filter.getTime()+24*3600*1000);
    699699            Expression parameterPlus24H =
     
    726726            for (Object obj : objects)
    727727            {
    728               Date filter = (Date)obj;
     728              Date filter = DateUtil.truncate((Date)obj);
    729729              Date filterPlus24H = new Date(filter.getTime()+24*3600*1000);
    730730              parameterName = "p" + System.identityHashCode(obj);
  • trunk/src/plugins/core/net/sf/basedb/plugins/BaseFileExporterPlugin.java

    r5384 r5424  
    608608    items.add(reporterField("symbol", "Gene symbol", Type.STRING, MAX));
    609609    items.add(reporterField("description", "Description", Type.TEXT, MAX));
    610     items.add(reporterField("lastUpdate", "Last updated", Type.DATE, MAX));
     610    items.add(reporterField("lastUpdate", "Last updated", Type.TIMESTAMP, MAX));
    611611   
    612612    for (ExtendedProperty ep : ExtendedProperties.getProperties("ReporterData"))
  • trunk/src/plugins/core/net/sf/basedb/plugins/BfsExporterPlugin.java

    r5384 r5424  
    631631    items.add(reporterField("symbol", "Gene symbol", Type.STRING, MAX));
    632632    items.add(reporterField("description", "Description", Type.TEXT, MAX));
    633     items.add(reporterField("lastUpdate", "Last updated", Type.DATE, MAX));
     633    items.add(reporterField("lastUpdate", "Last updated", Type.TIMESTAMP, MAX));
    634634   
    635635    for (ExtendedProperty ep : ExtendedProperties.getProperties("ReporterData"))
  • trunk/www/common/history/list_history.jsp

    r5061 r5424  
    11<%-- $Id$
    22  ------------------------------------------------------------------
    3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
     3  Copyright (C) 2006 Jari Hkkinen, Nicklas Nordborg, Martin Svensson
    44
    55  This file is part of BASE - BioArray Software Environment.
     
    176176        property="$hst.time"
    177177        exportproperty="changeHistory.time"
    178         datatype="date"
     178        datatype="timestamp"
    179179        title="Time"
    180180        sortable="true"
  • trunk/www/filemanager/files/list_files.jsp

    r5361 r5424  
    11<%-- $Id$
    22  ------------------------------------------------------------------
    3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
     3  Copyright (C) 2006 Jari Hkkinen, Nicklas Nordborg, Martin Svensson
    44  Copyright (C) 2007 Johan Enell, Nicklas Nordborg, Martin Svensson
    55
     
    677677        id="lastUpdate"
    678678        property="lastUpdate"
    679         datatype="date"
     679        datatype="timestamp"
    680680        title="Last update"
    681681        sortable="true"
  • trunk/www/lims/arraydesigns/features/list_features.jsp

    r5062 r5424  
    11<%-- $Id$
    22  ------------------------------------------------------------------
    3   Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg, Martin Svensson
     3  Copyright (C) 2006 Johan Enell, Jari Hkkinen, Nicklas Nordborg, Martin Svensson
    44  Copyright (C) 2007 Johan Enell, Nicklas Nordborg
    55
     
    380380      <tbl:columndef
    381381        id="reporterList"
    382         property="$rpt.£reporterListScores"
     382        property="$rpt.reporterListScores"
    383383        datatype="int"
    384384        title="[Rep] Reporter list"
     
    437437        id="reporter.lastUpdate"
    438438        property="reporter.lastUpdate"
    439         datatype="date"
     439        datatype="timestamp"
    440440        title="[Rep] Last update"
    441441        sortable="true"
  • trunk/www/lims/plates/wells/list_wells.jsp

    r5062 r5424  
    11<%-- $Id$
    22  ------------------------------------------------------------------
    3   Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg, Martin Svensson
     3  Copyright (C) 2006 Johan Enell, Jari Hkkinen, Nicklas Nordborg, Martin Svensson
    44  Copyright (C) 2007 Johan Enell, Nicklas Nordborg
    55
     
    276276      <tbl:columndef
    277277        id="reporterList"
    278         property="$rpt.£reporterListScores"
     278        property="$rpt.reporterListScores"
    279279        datatype="int"
    280280        title="[Rep] Reporter list"
     
    333333        id="reporter.lastUpdate"
    334334        property="reporter.lastUpdate"
    335         datatype="date"
     335        datatype="timestamp"
    336336        title="[Rep] Last update"
    337337        sortable="true"
  • trunk/www/my_base/messages/list_messages.jsp

    r4889 r5424  
    11<%-- $Id$
    22  ------------------------------------------------------------------
    3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
     3  Copyright (C) 2006 Jari Hkkinen, Nicklas Nordborg, Martin Svensson
    44  Copyright (C) 2007 Johan Enell
    55
     
    234234        id="timeSent"
    235235        property="timeSent"
    236         datatype="date"
     236        datatype="timestamp"
    237237        title="Time sent"
    238238        sortable="true"
  • trunk/www/views/jobs/list_jobs.jsp

    r5406 r5424  
    11<%-- $Id$
    22  ------------------------------------------------------------------
    3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
     3  Copyright (C) 2006 Jari Hkkinen, Nicklas Nordborg, Martin Svensson
    44  Copyright (C) 2007 Johan Enell, Nicklas Nordborg
    55
     
    343343        id="created"
    344344        property="created"
    345         datatype="date"
     345        datatype="timestamp"
    346346        title="Created"
    347347        sortable="true"
     
    353353        id="scheduled"
    354354        property="scheduled"
    355         datatype="date"
     355        datatype="timestamp"
    356356        title="Scheduled"
    357357        sortable="true"
     
    363363        id="started"
    364364        property="started"
    365         datatype="date"
     365        datatype="timestamp"
    366366        title="Started"
    367367        sortable="true"
     
    373373        id="ended"
    374374        property="ended"
    375         datatype="date"
     375        datatype="timestamp"
    376376        title="Ended"
    377377        sortable="true"
  • trunk/www/views/rawbioassays/rawdata/list_rawdata.jsp

    r5064 r5424  
    11<%-- $Id$
    22  ------------------------------------------------------------------
    3   Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg
     3  Copyright (C) 2006 Johan Enell, Jari Hkkinen, Nicklas Nordborg
    44  Copyright (C) 2007 Johan Enell, Nicklas Nordborg
    55
     
    350350      <tbl:columndef
    351351        id="reporterList"
    352         property="$r.£reporterListScores"
     352        property="$r.reporterListScores"
    353353        datatype="int"
    354354        title="[Rep] Reporter list"
     
    397397        id="reporter.lastUpdate"
    398398        property="reporter.lastUpdate"
    399         datatype="date"
     399        datatype="timestamp"
    400400        title="[Rep] Last update"
    401401        sortable="true"
  • trunk/www/views/reporterlists/reporters/list_reporters.jsp

    r5319 r5424  
    294294      <tbl:columndef
    295295        id="reporterList"
    296         property="$rpt.£reporterListScores"
     296        property="$rpt.reporterListScores"
    297297        datatype="int"
    298298        title="Reporter list"
     
    314314        id="lastUpdate"
    315315        property="reporter.lastUpdate"
    316         datatype="date"
     316        datatype="timestamp"
    317317        title="Last update"
    318318        sortable="true"
  • trunk/www/views/reporters/list_reporters.jsp

    r4889 r5424  
    22  ------------------------------------------------------------------
    33  Copyright (C) 2005 Nicklas Nordborg
    4   Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg, Martin Svensson
     4  Copyright (C) 2006 Johan Enell, Jari Hkkinen, Nicklas Nordborg, Martin Svensson
    55  Copyright (C) 2007 Johan Enell, Nicklas Nordborg
    66
     
    257257      <tbl:columndef
    258258        id="reporterList"
    259         property="£reporterListScores"
     259        property="reporterListScores"
    260260        datatype="int"
    261261        title="Reporter list"
     
    277277        id="lastUpdate"
    278278        property="lastUpdate"
    279         datatype="date"
     279        datatype="timestamp"
    280280        title="Last update"
    281281        sortable="true"
  • trunk/www/views/sessions/list_sessions.jsp

    r4889 r5424  
    11<%-- $Id$
    22  ------------------------------------------------------------------
    3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
     3  Copyright (C) 2006 Jari Hkkinen, Nicklas Nordborg, Martin Svensson
    44  Copyright (C) 2007 Johan Enell
    55
     
    176176        id="loginTime"
    177177        property="loginTime"
    178         datatype="date"
     178        datatype="timestamp"
    179179        title="Login time"
    180180        sortable="true"
     
    186186        id="logoutTime"
    187187        property="logoutTime"
    188         datatype="date"
     188        datatype="timestamp"
    189189        title="Logout time"
    190190        sortable="true"
Note: See TracChangeset for help on using the changeset viewer.