ResourceSet resourceSet = getResourceSet();
Bpmn2Resource resource = (Bpmn2Resource) resourceSet.getResource(uri, true);
DocumentRoot documentRoot = (DocumentRoot) resource.getContents().get(0);
documentRoot.setDefinitions(definitions);
try {
resource.save(null);
} catch (IOException e) {
e.printStackTrace();
throw new FixFlowException(ExceptionCode.EXCEPTION_DEFAULT,e);
}
}