Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6a36d113 authored by Guillaume Thomazon's avatar Guillaume Thomazon
Browse files

Start date is the creation of TI

End date is the last modification of step or creation + one year

git-svn-id: https://scm.gforge.inria.fr/authscm/ycadoret/svn/gazelle/Maven/gazelle-proxy/trunk@35091 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent 347fa8ab
No related branches found
No related tags found
No related merge requests found
...@@ -2,8 +2,10 @@ package net.ihe.gazelle.proxy.dao; ...@@ -2,8 +2,10 @@ package net.ihe.gazelle.proxy.dao;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -17,8 +19,12 @@ import net.ihe.gazelle.proxy.model.tm.Step; ...@@ -17,8 +19,12 @@ import net.ihe.gazelle.proxy.model.tm.Step;
import net.ihe.gazelle.proxy.model.tm.TestInstance; import net.ihe.gazelle.proxy.model.tm.TestInstance;
import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MessageFilterStep<T extends AbstractMessage> implements MessageFilter<T> { public class MessageFilterStep<T extends AbstractMessage> implements MessageFilter<T> {
private static Logger log = LoggerFactory.getLogger(MessageFilterStep.class);
private Step step; private Step step;
private boolean filterPathReceiver = true; private boolean filterPathReceiver = true;
...@@ -279,19 +285,21 @@ public class MessageFilterStep<T extends AbstractMessage> implements MessageFilt ...@@ -279,19 +285,21 @@ public class MessageFilterStep<T extends AbstractMessage> implements MessageFilt
Crit oneOfPath = new CritLogical(false, pathsArray); Crit oneOfPath = new CritLogical(false, pathsArray);
criterions.add(oneOfPath); criterions.add(oneOfPath);
} }
if (filterPersoDate) { if (filterPersoDate) {
if (endDate.before(startDate)){ if (endDate.before(startDate)) {
endDate=startDate; endDate = startDate;
} }
criterions.add(new CritSimple("dateReceived", "date", startDate, CritSimpleType.GE)); criterions.add(new CritSimple("dateReceived", "date", startDate, CritSimpleType.GE));
criterions.add(new CritSimple("dateReceived", "date", endDate, CritSimpleType.LE)); criterions.add(new CritSimple("dateReceived", "date", endDate, CritSimpleType.LE));
} }
if (filterDates) { if (filterDates) {
startDate = getStartDate(testInstance); startDate = getStartDate(testInstance);
endDate = step.getDate(); // For the moment the end date is the last modification of TI
endDate = getLastModifDate(testInstance);
// endDate = step.getDate();
criterions.add(new CritSimple("dateReceived", "date", startDate, CritSimpleType.GE)); criterions.add(new CritSimple("dateReceived", "date", startDate, CritSimpleType.GE));
criterions.add(new CritSimple("dateReceived", "date", endDate, CritSimpleType.LE)); criterions.add(new CritSimple("dateReceived", "date", endDate, CritSimpleType.LE));
...@@ -321,11 +329,44 @@ public class MessageFilterStep<T extends AbstractMessage> implements MessageFilt ...@@ -321,11 +329,44 @@ public class MessageFilterStep<T extends AbstractMessage> implements MessageFilt
if (indexOf == 0) { if (indexOf == 0) {
startDate = testInstance.getDate(); startDate = testInstance.getDate();
} else { } else {
startDate = steps.get(indexOf - 1).getDate(); // for the moment the start date is always the date of TI creation
startDate = testInstance.getDate();
// startDate = steps.get(indexOf - 1).getDate();
} }
return startDate; return startDate;
} }
private Date getLastModifDate(TestInstance testInstance) {
Date lastModifDate = null;
List<Step> steps = testInstance.getSteps();
int indexOf = steps.indexOf(step);
if (indexOf > 0) {
lastModifDate = steps.get(indexOf - 1).getDate();
}
for (int i = 0; i < steps.size();) {
for (int j = 1; j < steps.size();) {
log.info(""+steps.get(i).getDate());
log.info(""+steps.get(j).getDate());
if (steps.get(i).getDate().compareTo(steps.get(j).getDate()) >= 0) {
if (lastModifDate==null || lastModifDate.compareTo(steps.get(i).getDate()) <= 0) {
lastModifDate = steps.get(i).getDate();
}
}
j++;
}
i++;
}
if (lastModifDate == null || startDate.after(lastModifDate)) {
lastModifDate.equals(startDate);
Calendar cal = new GregorianCalendar();
cal.setTime(lastModifDate);
cal.set(Calendar.YEAR, 1);
lastModifDate = cal.getTime();
}
return lastModifDate;
}
public boolean isFilterPathReceiver() { public boolean isFilterPathReceiver() {
return filterPathReceiver; return filterPathReceiver;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment