Fixed issue with future dates.

cusax-fix
Damian Minkov 20 years ago
parent f1a3135873
commit fe0cf91ff7

@ -295,9 +295,6 @@ private QueryResultSet find(
Vector filelist =
filterFilesByDate(this.historyImpl.getFileList(), startDate, endDate);
ProgressEvent progressEvent =
new ProgressEvent(this, startDate, endDate, keywords);
int currentProgress = HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE;
int fileProgressStep = HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE;
@ -306,7 +303,8 @@ private QueryResultSet find(
HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE / filelist.size();
// start progress - minimum value
fireProgressStateChanged(progressEvent, HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE);
fireProgressStateChanged(startDate, endDate,
keywords, HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE);
Iterator fileIterator = filelist.iterator();
while (fileIterator.hasNext())
@ -347,13 +345,14 @@ private QueryResultSet find(
}
currentProgress += nodesProgressStep;
fireProgressStateChanged(progressEvent, currentProgress);
fireProgressStateChanged(
startDate, endDate, keywords, currentProgress);
}
}
// end progress - maximum value
fireProgressStateChanged(progressEvent,
HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE);
fireProgressStateChanged(startDate, endDate, keywords,
HistorySearchProgressListener.PROGRESS_MAXIMUM_VALUE);
return new OrderedQueryResultSet(result);
}
@ -485,7 +484,8 @@ private boolean matchKeyword(String value, String[] keywords,
* @param endDate Date
* @return Iterator
*/
private Vector filterFilesByDate(Iterator filelist, Date startDate, Date endDate)
private Vector filterFilesByDate(
Iterator filelist, Date startDate, Date endDate)
{
if(startDate == null && endDate == null)
{
@ -564,13 +564,17 @@ else if(endDate == null)
return result;
}
private void fireProgressStateChanged(ProgressEvent event, int progress)
private void fireProgressStateChanged(Date startDate, Date endDate,
String[] keywords, int progress)
{
event.setProgress(progress);
ProgressEvent event =
new ProgressEvent(this, startDate, endDate, keywords, progress);
Iterator iter = progressListeners.iterator();
while (iter.hasNext())
{
HistorySearchProgressListener item = (HistorySearchProgressListener) iter.next();
HistorySearchProgressListener item =
(HistorySearchProgressListener) iter.next();
item.progressChanged(event);
}
}

@ -331,7 +331,14 @@ private Object convertHistoryRecordToMessageEvent(HistoryRecord hr, Contact cont
// this is the event timestamp (this is the date that had came from protocol)
// the HistoryRecord timestamp is the timestamp when the record was written
if(msg.getMessageReceivedDate() != null)
timestamp = msg.getMessageReceivedDate();
{
if(msg.getMessageReceivedDate().after(hr.getTimestamp()) &&
(msg.getMessageReceivedDate().getTime() -
hr.getTimestamp().getTime()) > 86400000) // 24*60*60*1000
timestamp = hr.getTimestamp();
else
timestamp = msg.getMessageReceivedDate();
}
else
timestamp = hr.getTimestamp();

@ -50,13 +50,11 @@ public class ProgressEvent
* @param startDate Date The start date in the search condition.
* @param endDate Date The end date in the search condition.
* @param keywords String[] The keywords in the search condition.
* @param last int The number of last messages in the search condition.
* @param progress int The current progress that we will pass.
*/
public ProgressEvent(Object source,
Date startDate, Date endDate,
String[] keywords,
int last,
int progress)
{
super(source);
@ -79,7 +77,7 @@ public ProgressEvent(Object source,
Date startDate, Date endDate,
String[] keywords)
{
this(source, startDate, endDate, keywords, -1, 0);
this(source, startDate, endDate, keywords, 0);
}
/**
@ -91,7 +89,7 @@ public ProgressEvent(Object source,
*/
public ProgressEvent(Object source, Date startDate, Date endDate)
{
this(source, startDate, endDate, null, -1, 0);
this(source, startDate, endDate, null, 0);
}
/**

Loading…
Cancel
Save