return job;
}
public void saveJob(Job job, File file) throws Exception {
Serializer serializer = createSerializer();
Set<Board> boards = new HashSet<Board>();
// Fix the paths to any boards in the Job
for (BoardLocation boardLocation : job.getBoardLocations()) {
Board board = boardLocation.getBoard();
boards.add(board);
try {
String relativePath = ResourceUtils.getRelativePath(
board.getFile().getAbsolutePath(),
file.getAbsolutePath(),
File.separator);
boardLocation.setBoardFile(relativePath);
}
catch (ResourceUtils.PathResolutionException ex) {
boardLocation.setBoardFile(board.getFile().getAbsolutePath());
}
}
// Save the job
serializer.write(job, new ByteArrayOutputStream());
serializer.write(job, file);
job.setFile(file);
job.setDirty(false);
}