} catch(Exception e) {
environment.log("Problems initializing GUI: \n"+e.getMessage());
}
ListModel pipes = new ListModel(pers.loadAllPipes());
Field listField = pipeListFieldInfo.getField(
pipes,
environment.getLabelResource(session),
req);
//Try to get pipe id from the request.
Long pipeId=new Long(parameters.getLong(PIPE_ID));
if(pipeId!=0){
//If the start button of one of the pipes was pressed, execute the pipe
Pipe startedPipe=pers.loadPipe(pipeId);
startedPipe.transfer(new TransferInfo(pers.getDatabaseName(),(String)session.getAttribute("syncro.user")));
pers.update(startedPipe);
}
if(requestType == POST_REQUEST) {
if(parameters.getInt(ACTION) == 1) {
listField.commit();
for(Iterator added = pipes.getList().addedIterator(); added.hasNext();) {
Pipe pipe = (Pipe) added.next();
pers.save(pipe);
//System.out.println("Saved pipe #" + pipe.getId().toString());
//environment.log("Saved pipe #" + pipe.getId().toString());
}
/*for(Iterator cloned = pipes.getList().clonedIterator(); cloned.hasNext();) {
Pipe pipe = (Pipe) cloned.next();
pers.save(pipe);
}*/
for(Iterator current = pipes.getList().iterator(); current.hasNext();) {
Pipe pipe = (Pipe) current.next();
pers.update(pipe);
//System.out.println("Updated pipe #" + pipe.getId().toString());
//environment.log("Updated pipe #" + pipe.getId().toString());
}
for(Iterator removed = pipes.getList().removedIterator(); removed.hasNext();) {
Pipe pipe = (Pipe) removed.next();
//System.out.println("Removing pipe #" + pipe.getId().toString());
//environment.log("Removing pipe #" + pipe.getId().toString());
pers.delete(pipe);
}
} else
listField.revert();
}
Form form = getForm("PipeList", listField.getEditor(), labels, false, true);
return form.toString();
}