public static ProcessDefinition updateToNextVersion(ProcessDefinition oldDefinition, IFile file) throws Exception {
List<String> versions = getAllJpdlVersions();
int versionIndex = versions.indexOf(oldDefinition.getJpdlVersion());
String newVersion = versions.get(versionIndex + 1);
JpdlModelConverter modelConverter = getModelConverter(newVersion);
ProcessDefinition newDefinition = modelConverter.convert(oldDefinition, newVersion);
newDefinition.setJpdlVersion(newVersion);
Document document = newDefinition.getContentProvider().getInitialProcessDefinitionDocument(newDefinition.getName());
newDefinition.getContentProvider().saveToXML(newDefinition, document);
byte[] bytes = XmlUtil.writeXml(document);
file.setContents(new ByteArrayInputStream(bytes), true, true, null);
return newDefinition;
}