jpl.mipl.mdms.FileService.komodo.services.query.api
Class QueryConstraints

java.lang.Object
  extended by jpl.mipl.mdms.FileService.komodo.services.query.api.QueryConstraints

public class QueryConstraints
extends java.lang.Object

Purpose: Handles and manages the post-query blob modifiers such as file name expression, global date filter, and filetype/modification time pairs. This data is usually populated from command line options such as file expressions, before/after/between-and time constraints, and restart files for filetype modification times.

   Copyright 2007, California Institute of Technology.
   ALL RIGHTS RESERVED.
   U.S. Government Sponsorship acknowledge. 2007.
   
 ============================================================================
 Modification History :
 ----------------------

 Date              Who              What
 ----------------------------------------------------------------------------
 07/11/2007        Nick             Initial release.
 ============================================================================
 

Version:
$Id: QueryConstraints.java,v 1.7 2007/09/26 00:06:50 ntt Exp $
Author:
Nicholas Toole (Nicholas.T.Toole@jpl.nasa.gov)

Field Summary
static java.lang.String FEI_FILENAME
           
static java.lang.String FEI_FILETYPE
           
static java.lang.String FEI_MODTIME
           
protected  java.util.Map<java.lang.String,jpl.mipl.mdms.FileService.komodo.services.query.api.QueryConstraints.FileTypeTimePair> filetypeList
           
protected  java.util.Date[] globalDateFilter
           
protected  java.lang.String[] globalFilenameExpressions
           
 
Constructor Summary
QueryConstraints()
           
 
Method Summary
 void addFiletype(java.lang.String filetype)
          Adds a new filetype filter with no minimum modification time value
 java.lang.Long getFiletypeTime(java.lang.String filetype)
          Returns the modification time associated with a filetype filter.
static void main(java.lang.String[] args)
           
static QueryConstraints parse(java.lang.String entry)
           
 void resetDates()
          Resets date filters.
 void sanityCheck()
           
 void setAfterDate(java.util.Date date)
          Sets the after date filter.
 void setBeforeDate(java.util.Date date)
          Sets the before date filter.
 void setBetweenDates(java.util.Date dateMin, java.util.Date dateMax)
          Sets the range date filter.
 void setFilenameExpression(java.lang.String expression)
           
 void setFilenameExpressions(java.lang.String[] expressions)
           
 void setFiletypeTime(java.lang.String filetype, java.lang.Long time)
          Sets the modification time associated with a filetype filter.
protected  void setGlobalTime(java.util.Date date1, java.util.Date date2)
           
protected  java.lang.String sqlize(java.lang.String text)
           
 java.lang.String toSqlString()
          Returns a SQL-formatted string representation of the contents of this constraints instance.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FEI_MODTIME

public static final java.lang.String FEI_MODTIME
See Also:
Constant Field Values

FEI_FILENAME

public static final java.lang.String FEI_FILENAME
See Also:
Constant Field Values

FEI_FILETYPE

public static final java.lang.String FEI_FILETYPE
See Also:
Constant Field Values

globalFilenameExpressions

protected java.lang.String[] globalFilenameExpressions

globalDateFilter

protected java.util.Date[] globalDateFilter

filetypeList

protected java.util.Map<java.lang.String,jpl.mipl.mdms.FileService.komodo.services.query.api.QueryConstraints.FileTypeTimePair> filetypeList
Constructor Detail

QueryConstraints

public QueryConstraints()
Method Detail

setFilenameExpression

public void setFilenameExpression(java.lang.String expression)

setFilenameExpressions

public void setFilenameExpressions(java.lang.String[] expressions)

setBeforeDate

public void setBeforeDate(java.util.Date date)
Sets the before date filter. Results will have a modification time less than date parameter

Parameters:
date - Maximum date value

setAfterDate

public void setAfterDate(java.util.Date date)
Sets the after date filter. Results will have a modification time greater than date parameter

Parameters:
date - Minimum date value

setBetweenDates

public void setBetweenDates(java.util.Date dateMin,
                            java.util.Date dateMax)
Sets the range date filter. Results will have a modification time that falls between the two parameters.

Parameters:
dateMin - Minimum date value
dateMax - Maximum date value

resetDates

public void resetDates()
Resets date filters.


setGlobalTime

protected void setGlobalTime(java.util.Date date1,
                             java.util.Date date2)

addFiletype

public void addFiletype(java.lang.String filetype)
Adds a new filetype filter with no minimum modification time value

Parameters:
filetype - Full filetype {severgroup:filetype} to add

setFiletypeTime

public void setFiletypeTime(java.lang.String filetype,
                            java.lang.Long time)
Sets the modification time associated with a filetype filter. If no filter exists, then it is created and added.

Parameters:
filetype - Full filetype {severgroup:filetype}
time - Time filter, in epoch milliseconds

getFiletypeTime

public java.lang.Long getFiletypeTime(java.lang.String filetype)
Returns the modification time associated with a filetype filter.

Parameters:
filetype - Full filetype {severgroup:filetype} return Time associated with filetype, possibly null

toSqlString

public java.lang.String toSqlString()
Returns a SQL-formatted string representation of the contents of this constraints instance.

Returns:
SQL-formatted constraints

sqlize

protected java.lang.String sqlize(java.lang.String text)

sanityCheck

public void sanityCheck()
                 throws SessionException
Throws:
SessionException

parse

public static QueryConstraints parse(java.lang.String entry)
                              throws java.text.ParseException
Throws:
java.text.ParseException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)