"url","port","interval","timeout","username","password","proxyserver",
"proxyport","proxyuser","proxypassword","resolveurl","publish","valid","paused","autoDelete"};
String[] types = new String[]{v,v,v,"DATE","OTHER","DATE","OTHER",
v,v,v,v,v,v,v,
v,v,v,v,"BOOLEAN",v,"BOOLEAN","BOOLEAN"};
railo.runtime.type.Query query=new QueryImpl(cols,types,tasks.length,"query"
);
try {
for(int i=0;i<tasks.length;i++) {
int row=i+1;
ScheduleTask task=tasks[i];
query.setAt(KeyConstants._task,row,task.getTask());
if(task.getResource()!=null) {
query.setAt(KeyConstants._path,row,task.getResource().getParent());
query.setAt(KeyConstants._file,row,task.getResource().getName());
}
query.setAt("publish",row,Caster.toBoolean(task.isPublish()));
query.setAt("startdate",row,task.getStartDate());
query.setAt("starttime",row,task.getStartTime());
query.setAt("enddate",row,task.getEndDate());
query.setAt("endtime",row,task.getEndTime());
query.setAt(KeyConstants._url,row,printUrl(task.getUrl()));
query.setAt(KeyConstants._port,row,Caster.toString(HTTPUtil.getPort(task.getUrl())));
query.setAt("interval",row,task.getStringInterval());
query.setAt("timeout",row,Caster.toString(task.getTimeout()/1000));
query.setAt("valid",row,Caster.toString(task.isValid()));
if(task.hasCredentials()) {
query.setAt("username",row,task.getCredentials().getUsername());
query.setAt("password",row,task.getCredentials().getPassword());
}
ProxyData pd = task.getProxyData();
if(ProxyDataImpl.isValid(pd)){
query.setAt("proxyserver",row,pd.getServer());
if(pd.getPort()>0)query.setAt("proxyport",row,Caster.toString(pd.getPort()));
if(ProxyDataImpl.hasCredentials(pd)) {
query.setAt("proxyuser",row,pd.getUsername());
query.setAt("proxypassword",row,pd.getPassword());
}
}
query.setAt("resolveurl",row,Caster.toString(task.isResolveURL()));
query.setAt("paused",row,Caster.toBoolean(task.isPaused()));
query.setAt("autoDelete",row,Caster.toBoolean(((ScheduleTaskImpl)task).isAutoDelete()));
}
pageContext.setVariable(returnvariable,query);