if (DebugFile.trace) {
DebugFile.writeln("Begin WeekPlan.getDistinctFellows([JDCConnection])");
DebugFile.incIdent();
}
DBSubset oFellows;
Timestamp dtFirst = new Timestamp(dtFrom.getYear(),dtFrom.getMonth(),dtFrom.getDate(),0,0,0,0);
Timestamp dtLast = new Timestamp(dtFirst.getTime()+WeekMilis);
int nFellows = 0;
Fellow[] aFellows;
if (null==sWorkAreaGuid) {
oFellows = new DBSubset (
DB.k_fellows+" f",
new Fellow().getTable(oConn).getColumnsStr(),
"f."+DB.id_domain+"=? AND ("+
"EXISTS (SELECT m."+DB.gu_fellow+" FROM "+DB.k_meetings+" m WHERE m."+DB.gu_fellow+"=f."+DB.gu_fellow+" AND m."+DB.dt_start+" BETWEEN ? AND ?) OR "+
"EXISTS (SELECT x."+DB.gu_fellow+" FROM "+DB.k_x_meeting_fellow+" x WHERE x."+DB.gu_fellow+"=f."+DB.gu_fellow+" AND x."+DB.dt_start+" BETWEEN ? AND ?))"+
" ORDER BY "+DB.tx_name+","+DB.tx_surname, 10);
nFellows = oFellows.load(oConn, new Object[]{oDomainId,dtFirst,dtLast,dtFirst,dtLast});
} else {
oFellows = new DBSubset (
DB.k_fellows+" f",
new Fellow().getTable(oConn).getColumnsStr(),
"f."+DB.id_domain+"=? AND f."+DB.gu_workarea+"=? AND ("+
"EXISTS (SELECT m."+DB.gu_fellow+" FROM "+DB.k_meetings+" m WHERE m."+DB.gu_fellow+"=f."+DB.gu_fellow+" AND m."+DB.dt_start+" BETWEEN ? AND ?) OR "+
"EXISTS (SELECT x."+DB.gu_fellow+" FROM "+DB.k_x_meeting_fellow+" x WHERE x."+DB.gu_fellow+"=f."+DB.gu_fellow+" AND x."+DB.dt_start+" BETWEEN ? AND ?))"+
" ORDER BY "+DB.tx_name+","+DB.tx_surname, 10);
nFellows = oFellows.load(oConn, new Object[]{oDomainId,sWorkAreaGuid,dtFirst,dtLast,dtFirst,dtLast});
} // fi
if (0==nFellows) {
aFellows = null;
} else {
aFellows = new Fellow[nFellows];
for (int f=0; f<nFellows; f++) {
aFellows[f] = new Fellow();
aFellows[f].putAll(oFellows.getRowAsMap(f));
} // next
} // fi (nFellows)
if (DebugFile.trace) {
DebugFile.decIdent();