Changeset 3453


Ignore:
Timestamp:
Jun 5, 2007, 2:56:01 PM (14 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #561

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/PropertyFilter.java

    r2866 r3453  
    2323*/
    2424package net.sf.basedb.core;
     25
     26import java.util.Date;
    2527
    2628import net.sf.basedb.core.data.PropertyFilterData;
     
    238240      else
    239241      {
    240         restriction = operator.getRestriction(Hql.property(alias, property), parameter);
     242        Expression propertyExpression = Hql.property(alias, property);
     243        if (getValueType() == Type.DATE)
     244        {
     245          // To use ==, != and <= filter on dates we must add 24 hours to it
     246          // and use different restrictions
     247          Date filter = (Date)getValueAsObject();
     248          Date filterPlus24H = new Date(filter.getTime()+24*3600*1000);
     249          Expression parameterPlus24H =
     250            Expressions.parameter(parameterName+"24h", filterPlus24H, Type.DATE);
     251          if (operator == Operator.EQ)
     252          {
     253            // date <= property < date + 24H
     254            restriction = Restrictions.between(propertyExpression, parameter, parameterPlus24H);
     255          }
     256          else if (operator == Operator.NEQ)
     257          {
     258            // NOT date <= property < date + 24H
     259            restriction = Restrictions.not(Restrictions.between(propertyExpression, parameter, parameterPlus24H));
     260          }
     261          else if (operator == Operator.LTEQ)
     262          {
     263            // property < date + 24H
     264            restriction = Restrictions.lt(propertyExpression, parameterPlus24H);
     265          }
     266          else if (operator == Operator.GT)
     267          {
     268            // property >= date + 24H
     269            restriction = Restrictions.gteq(propertyExpression, parameterPlus24H);
     270          }
     271        }
     272        if (restriction == null)
     273        {
     274          restriction = operator.getRestriction(propertyExpression, parameter);
     275        }
    241276      }
    242277    }
  • trunk/www/lims/arraydesigns/features/list_features.jsp

    r3190 r3453  
    8787  final ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId);
    8888  final boolean isAffy = design.isAffyChip();
    89   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     89  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    9090 
    9191  final DataQuery<FeatureData> query = design.getFeatures();
  • trunk/www/lims/arraydesigns/features/view_feature.jsp

    r2978 r3453  
    7474try
    7575{
    76   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     76  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    7777  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
    7878
  • trunk/www/lims/plates/wells/list_wells.jsp

    r3190 r3453  
    9696  typeQuery.setCacheResult(true);
    9797  List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData");
    98   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     98  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    9999 
    100100  try
  • trunk/www/lims/plates/wells/view_well.jsp

    r2978 r3453  
    7070try
    7171{
    72   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     72  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    7373  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
    7474
  • trunk/www/views/experiments/explorer/view/view.jsp

    r2993 r3453  
    9797try
    9898{
    99   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     99  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    100100  String title = null;
    101101  final BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId);
  • trunk/www/views/rawbioassays/rawdata/list_rawdata.jsp

    r3190 r3453  
    114114  int numListed = 0;
    115115  final boolean writeReporterPermission = sc.hasPermission(Permission.WRITE, Item.REPORTER);
    116   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     116  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    117117  %>
    118118  <base:page title="<%=title%>">
  • trunk/www/views/rawbioassays/rawdata/view_rawdata.jsp

    r2978 r3453  
    8787  final ReporterData reporter = rawData.getReporter();
    8888  final FeatureData feature = rawData.getFeature();
    89   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     89  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    9090  %>
    9191  <base:page title="<%=title%>" type="popup">
  • trunk/www/views/reporterlists/reporters/list_reporters.jsp

    r3190 r3453  
    104104  }
    105105  int numListed = 0;
    106   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     106  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    107107  %>
    108108  <base:page title="<%=title%>" type="<%=mode.getPageType()%>">
  • trunk/www/views/reporters/list_reporters.jsp

    r3190 r3453  
    9797  }
    9898  int numListed = 0;
    99   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     99  Formatter<Date> timeFormatter = FormatterFactory.getDateTimeFormatter(sc);
    100100  %>
    101101  <base:page title="<%=title==null ? "Reporters" : title%>" type="<%=mode.getPageType()%>">
     
    240240        filterable="true"
    241241        exportable="true"
    242         formatter="<%=dateFormatter%>"
     242        formatter="<%=timeFormatter%>"
    243243      />
    244244      <%
  • trunk/www/views/reporters/view_reporter.jsp

    r2978 r3453  
    7979  final boolean writePermission = sc.hasPermission(Permission.WRITE, itemType);
    8080  final boolean deletePermission = sc.hasPermission(Permission.DELETE, itemType);
    81   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
     81  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    8282  %>
    8383
Note: See TracChangeset for help on using the changeset viewer.