com.arunta.base.search
Class SearchCriteria

java.lang.Object
  extended by com.arunta.base.search.SearchCriteria
All Implemented Interfaces:
java.io.Serializable

public class SearchCriteria
extends java.lang.Object
implements java.io.Serializable

Search criteria for Recordings.

This search criteria can be used to filter records based on the:

Note that records are always ordered; most recent and highest channel number first.

See Also:
Serialized Form

Constructor Summary
SearchCriteria()
          Creates a search criteria which will limit the result to 1000 records that match the criteria.
SearchCriteria(int recordCnt)
          Creates a search criteria that will limit the result to the specified number of records.
SearchCriteria(SearchCriteria other)
          Creates a search criteria that is a copy of another.
 
Method Summary
 void clearFollowOnQuery()
          Disables paging.
 java.lang.String getAgentName()
           
 java.lang.String getCallDirection()
           
 java.lang.String getChannel()
           
 java.lang.String getCountSQLQuery(boolean backwardCompatible)
          Constructs the full SQL SELECT statement that will fetch the actual number of records that match this criteria.
 java.lang.String getExtension()
           
 java.lang.String getFileName()
           
 java.lang.String getFromDate()
           
 java.lang.String getFromTime()
           
 java.lang.String getNoteKeyword()
           
 java.lang.String getNumber()
           
 int getRecordCnt()
           
 java.lang.String getSQLQuery(boolean backwardCompatible)
          Constructs the full SQL SELECT statement that represents this criteria.
 java.lang.String getSQLWhereClause(boolean backwardCompatible)
          Construct the WHERE part of the SQL SELECT statement that represents this criteria.
 java.lang.String getTagged()
           
 java.lang.String getToDate()
           
 java.lang.String getToTime()
           
 boolean isAgentNameFilterEnabled()
           
 boolean isAuthorisedExtensionsFilterEnabled()
           
 boolean isCallDirectionFilterEnabled()
           
 boolean isCallDurationFilterEnabled()
           
 boolean isChannelFilterEnabled()
           
 boolean isDateFilterEnabled()
           
 boolean isExtensionFilterEnabled()
           
 boolean isFileNameFilterEnabled()
           
 boolean isFollowonQuery()
           
 boolean isNoteKeywordFilterEnabled()
           
 boolean isNumberFilterEnabled()
           
 boolean isTaggedFilterEnabled()
           
 boolean isTaggedSearch()
           
 boolean isTimeFilterEnabled()
           
 void setAgentName(boolean enable, java.lang.String agentName)
          Sets the agent name filer for this criteria.
 void setAuthorisedExtensions(boolean enable, AuthorisedExtensionsSet authorisedExtensions)
          Sets the authorised extensions filer for this criteria.
 void setCallDirection(boolean enable, java.lang.String direction)
          Sets the call direction filer for this criteria.
 void setCallDurationRange(boolean enable, java.lang.String min, java.lang.String max)
          Sets the call duration filer for this criteria.
 void setChannel(boolean enable, int channel)
          Sets the recording channel number filer for this criteria.
 void setChannel(boolean enable, java.lang.String channel)
          Sets the recording channel number filer for this criteria.
 void setDateRange(java.lang.String day)
          Quick way of specifying a To and From Date filter where the to and from dates are the same day.
 void setDateTimeRange(boolean useGMT, boolean enableDate, java.lang.String fromDateStr, java.lang.String toDateStr, boolean enableTime, java.lang.String fromTimeStr, java.lang.String toTimeStr)
          Sets the date and/or time filer for this criteria.
 void setExtension(boolean enable, java.lang.String extension)
          Sets the extension filer for this criteria.
 void setFileName(boolean enable, java.lang.String fileName)
          Sets the file name filer for this criteria.
 void setFollowOnQuery(java.lang.String startDate, java.lang.String startTime, int channel, boolean backInTime)
          Enables paging.
 void setNoteKeyword(boolean enable, java.lang.String noteKeyword)
          Sets the notes keyword filer for this criteria.
 void setNumber(boolean enable, java.lang.String phoneNumber)
          Sets the phone number filer for this criteria.
 void setRecordCnt(int recordCnt)
          Sets the maximum number of records that this criteria should return when used in a search.
 void setTagged(boolean enable, java.lang.String val)
          Sets the record tag filer for this criteria.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SearchCriteria

public SearchCriteria()
Creates a search criteria which will limit the result to 1000 records that match the criteria.

Note that the criteria will match all records in the database without setting specific filters.


SearchCriteria

public SearchCriteria(SearchCriteria other)
Creates a search criteria that is a copy of another.

Parameters:
other - An instance of a search criteria which will be used to copy.

SearchCriteria

public SearchCriteria(int recordCnt)
Creates a search criteria that will limit the result to the specified number of records.

Note that the criteria will match all records in the database without setting specific filters.

Parameters:
recordCnt - The maximum number of records in the search result.
Method Detail

getRecordCnt

public int getRecordCnt()
Returns:
The maximum number of records that will be returned if this criteria is used in a search.

setRecordCnt

public void setRecordCnt(int recordCnt)
Sets the maximum number of records that this criteria should return when used in a search.

Parameters:
recordCnt - Desired maximum number of records.

setDateTimeRange

public void setDateTimeRange(boolean useGMT,
                             boolean enableDate,
                             java.lang.String fromDateStr,
                             java.lang.String toDateStr,
                             boolean enableTime,
                             java.lang.String fromTimeStr,
                             java.lang.String toTimeStr)
Sets the date and/or time filer for this criteria.

It is possible to enable the date filter only, the time filter only, or both. In addition, it is possible to specify the from date/time only, the to date/time only or both. The criteria will match different records based on which filter is enabled and the values of the from and to date and time. Use the following table as a guide when defining this filter:

Specify From Date filter only
The criteria will match all recordings for calls which started on the specified date; or, any date after the specified date
Specify From and To Date filter
The criteria will match all recordings for calls which started on or between the specified dates
Specify From Time filter only
The criteria will match all recordings for calls which started on the specified time on any date; or, any time after the specified time on any date
Specify From and To Time filter
The criteria will match all recordings for calls which started on or between the specified time on any date
Specify From Date and From Time filter
The criteria will match all recordings for calls which started on the specified date and on or after the specified time; or, any date after the specified date and time on or after the specified time on that date
Specify From Date and From and To Time filter
The criteria will match all recordings for calls which started on the specified date and on or between the specified times; or, any date after the specified date and on or between the specified times on that date
Specify To Date and From Time filter
The criteria will match all recordings for calls which started on the specified date and on or after the specified time; or any date before the specified date and time on or after the specified time on that date
Specify To Date and From and To Time filter
The criteria will match all recordings for calls which started on the specified date and on or between the specified times; or any date before the specified date and times on or after the specified times on that date
Specify From and To Date and From and To Time filter
The criteria will match all recordings for calls which started on the specified dates and on or between the specified times; or any date between the specified dates and times on or after the specified times on that date

Parameters:
useGMT - Set this flag to true if the date and time and date parameters are in GMT (well UTC) time and date. Set it to false if the time and date parameters are in local time.
enableDate - Set this flag to true to enable the date filter. Set it to false to ignore the from and to date values.
fromDateStr - From date. Must be in the yyyy.MM.dd format or null if not used.
toDateStr - To date. Must be in the yyyy.MM.dd format or null if not used.
enableTime - Set this flag to true to enable the time filter. Set it to false to ignore the from and to time values.
fromTimeStr - From time. Must be in the HH:mm:ss format or null if not used.
toTimeStr - To time. Must be in the HH:mm:ss format or null if not used.

setDateRange

public void setDateRange(java.lang.String day)
Quick way of specifying a To and From Date filter where the to and from dates are the same day.

Parameters:
day - From and To date. Must be in the yyyy.MM.dd format.

getFromTime

public java.lang.String getFromTime()
Returns:
The From time in HH:mm:ss format if set. Otherwise null.

getToTime

public java.lang.String getToTime()
Returns:
The To time in HH:mm:ss format if set. Otherwise null.

getFromDate

public java.lang.String getFromDate()
Returns:
The From date in yyyy.MM.dd format if set. Otherwise null.

getToDate

public java.lang.String getToDate()
Returns:
The To date in yyyy.MM.dd format if set. Otherwise null.

isDateFilterEnabled

public boolean isDateFilterEnabled()
Returns:
true if the Date filter is enabled. Otherwise false.

isTimeFilterEnabled

public boolean isTimeFilterEnabled()
Returns:
true if the Time filter is enabled. Otherwise false.

setNumber

public void setNumber(boolean enable,
                      java.lang.String phoneNumber)
Sets the phone number filer for this criteria.

It creates a filter which will match calls which originated from or terminated at a number that is like the specified phone number.

Parameters:
enable - Set this flag to true to enable the phone number filter.
phoneNumber - The phone number to use in the filter. Note that if you set this parameter to 02 for example, the filter will match any number which has 02 in it at any position.

getNumber

public java.lang.String getNumber()
Returns:
The phone number if set. Otherwise null.

isNumberFilterEnabled

public boolean isNumberFilterEnabled()
Returns:
true if the phone number filter is enabled. Otherwise false.

setExtension

public void setExtension(boolean enable,
                         java.lang.String extension)
Sets the extension filer for this criteria.

It creates a filter which will match calls which originated from or terminated at an extension that is exactly equal to the specified extension.

Parameters:
enable - Set this flag to true to enable the extension filter.
extension - The extension to use in the filter.

getExtension

public java.lang.String getExtension()
Returns:
The extension if set. Otherwise null.

isExtensionFilterEnabled

public boolean isExtensionFilterEnabled()
Returns:
true if the extension filter is enabled. Otherwise false.

setAgentName

public void setAgentName(boolean enable,
                         java.lang.String agentName)
Sets the agent name filer for this criteria.

It creates a filter which will match calls which were serviced by the agent with the specified name.

Parameters:
enable - Set this flag to true to enable the agent name filter.
agentName - The agent name to use in the filter.

getAgentName

public java.lang.String getAgentName()
Returns:
The agent name if set. Otherwise null.

isAgentNameFilterEnabled

public boolean isAgentNameFilterEnabled()
Returns:
true if the agent name filter is enabled. Otherwise false.

setTagged

public void setTagged(boolean enable,
                      java.lang.String val)
Sets the record tag filer for this criteria.

It creates a filter which will match records of calls that have been tagged, or not.

Parameters:
enable - Set this flag to true to enable the record tag filter.
val - Set to "0" to match records that have not been tagged. Set to "1" to match records that have been tagged.

getTagged

public java.lang.String getTagged()
Returns:
The record tag if set. Otherwise null.

isTaggedFilterEnabled

public boolean isTaggedFilterEnabled()
Returns:
true if the record tag filter is enabled. Otherwise false.

isTaggedSearch

public boolean isTaggedSearch()
Returns:
true if the record tag filter is enabled and if it limits the search to records that have been tagged. Otherwise false.

setCallDirection

public void setCallDirection(boolean enable,
                             java.lang.String direction)
Sets the call direction filer for this criteria.

It creates a filter which will match records of calls with the specified direction.

Parameters:
enable - Set this flag to true to enable the call direction filter.
direction - Set to "0" to match records of incoming calls. Set to "1" to match records of outgoing calls. Set to "2" to match records of internal calls. Set to "3" to match records of unknown calls.

getCallDirection

public java.lang.String getCallDirection()
Returns:
The call direction if set. Otherwise null.

isCallDirectionFilterEnabled

public boolean isCallDirectionFilterEnabled()
Returns:
true if the call direction filter is enabled. Otherwise false.

setChannel

public void setChannel(boolean enable,
                       int channel)
Sets the recording channel number filer for this criteria.

It creates a filter which will match calls were recorded by the specified recording channel number.

Parameters:
enable - Set this flag to true to enable the recording channel number filter.
channel - The recording channel number to use in the filter.

setChannel

public void setChannel(boolean enable,
                       java.lang.String channel)
Sets the recording channel number filer for this criteria.

It creates a filter which will match calls which were recorded by the specified recording channel number.

Parameters:
enable - Set this flag to true to enable the recording channel number filter.
channel - The recording channel number to use in the filter.

getChannel

public java.lang.String getChannel()
Returns:
The recording channel number if set. Otherwise null.

isChannelFilterEnabled

public boolean isChannelFilterEnabled()
Returns:
true if the recording channel number filter is enabled. Otherwise false.

setFileName

public void setFileName(boolean enable,
                        java.lang.String fileName)
Sets the file name filer for this criteria.

It creates a filter which will match calls which were stored in the media file with the specified file name.

Parameters:
enable - Set this flag to true to enable the file name filter.
fileName - The fully qualified file name to use in the filter.

getFileName

public java.lang.String getFileName()
Returns:
The file name if set. Otherwise null.

isFileNameFilterEnabled

public boolean isFileNameFilterEnabled()
Returns:
true if the file name filter is enabled. Otherwise false.

setNoteKeyword

public void setNoteKeyword(boolean enable,
                           java.lang.String noteKeyword)
Sets the notes keyword filer for this criteria.

It creates a filter which will match calls which contain words in the notes that are like the specified keyword.

Parameters:
enable - Set this flag to true to enable the notes keyword filter.
noteKeyword - The keyword to use in the filter. Note that if you set this parameter to "tada" for example, the filter will match any word which has "tada" in it at any position.

getNoteKeyword

public java.lang.String getNoteKeyword()
Returns:
The note keyword if set. Otherwise null.

isNoteKeywordFilterEnabled

public boolean isNoteKeywordFilterEnabled()
Returns:
true if the note keyword filter is enabled. Otherwise false.

setCallDurationRange

public void setCallDurationRange(boolean enable,
                                 java.lang.String min,
                                 java.lang.String max)
Sets the call duration filer for this criteria.

It creates a filter which will match calls which duration is in the specified range.

Parameters:
enable - Set this flag to true to enable the call duration filter.
min - The minimum duration in milliseconds.
max - The maximum duration in milliseconds.

isCallDurationFilterEnabled

public boolean isCallDurationFilterEnabled()
Returns:
true if the call duration filter is enabled. Otherwise false.

setAuthorisedExtensions

public void setAuthorisedExtensions(boolean enable,
                                    AuthorisedExtensionsSet authorisedExtensions)
Sets the authorised extensions filer for this criteria.

It creates a filter which will match calls which originated from or terminated at the set of specified extensions.

Parameters:
enable - Set this flag to true to enable the authorised extensions filter.
authorisedExtensions - The extensions to use in the filter.

isAuthorisedExtensionsFilterEnabled

public boolean isAuthorisedExtensionsFilterEnabled()
Returns:
true if the call duration filter is enabled. Otherwise false.

getSQLQuery

public java.lang.String getSQLQuery(boolean backwardCompatible)
Constructs the full SQL SELECT statement that represents this criteria.

Parameters:
backwardCompatible - Set this to false always.
Returns:
The SQL SELECT statement that represents this criteria.

getCountSQLQuery

public java.lang.String getCountSQLQuery(boolean backwardCompatible)
Constructs the full SQL SELECT statement that will fetch the actual number of records that match this criteria.

Parameters:
backwardCompatible - Set this to false always.
Returns:
The SQL SELECT statement that determines the number of records that match this criteria.

getSQLWhereClause

public java.lang.String getSQLWhereClause(boolean backwardCompatible)
Construct the WHERE part of the SQL SELECT statement that represents this criteria.

Parameters:
backwardCompatible - Set this to false always.
Returns:
The WHERE part of the SQL SELECT statement that represents this criteria.

setFollowOnQuery

public void setFollowOnQuery(java.lang.String startDate,
                             java.lang.String startTime,
                             int channel,
                             boolean backInTime)
Enables paging.

Configures this criteria to match the maximum number of records that are before or after the specified date and time.

Parameters:
startDate - The start date of the page in yyyy.MM.dd format.
startTime - The start time of the page in HH:mm:ss format.
channel - The start recording channel number of the page.
backInTime - Set this parameter to true to select records prior to the start date and time. Set this parameter to true to select records after the start date and time.

clearFollowOnQuery

public void clearFollowOnQuery()
Disables paging.


isFollowonQuery

public boolean isFollowonQuery()
Returns:
true if paging is enabled. Otherwise false.

toString

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


Copyright ©, 2005-2012 Prolancer Pty Ltd, Sydney Australia.