final ProgressDialog progDlg = new ProgressDialog("deploy..."){
public void run() throws Exception{
Serializer se = GlobalContext.getSerializer("XPD");
ProcessDefinition def = definition;
def.setName(saveDialogInfo.getName());
def.setAlias(saveDialogInfo.getAlias());
def.setVersion(saveDialogInfo.getVersion());
saveDialogInfo.getAuthor().setVersion(saveDialogInfo.getVersion());
RevisionInfo revInfo = saveDialogInfo.getAuthor();
def.addRevisionInfo(revInfo);
setRevisionInfo((RevisionInfo)revInfo.clone());
ByteArrayOutputStream bao = new ByteArrayOutputStream();
se.serialize(def, bao, null);
String strDef = bao.toString("UTF-8");
System.out.println("getSavingFolder() : " + getSavingFolder());
Map parameters = new HashMap();
parameters.put("definition", strDef);
parameters.put("definitionName", def.getName().getText());
parameters.put("version", ""+def.getVersion());
parameters.put("description", def.getDescription()!=null ? def.getDescription().getText() : null);
parameters.put("folderId", getFolderId());
if(UEngineUtil.isNotEmpty(getSuperDefId())){
parameters.put("defId", null);
parameters.put("version", "1");
parameters.put("superDefId", getSuperDefId());
}else{
if(def==getProcessDefinitionDesigner().getActivity()){
parameters.put("defId", getDefinitionId());
parameters.put("defVerId", getDefinitionVersionId());
}else{
parameters.put("defId", def.getBelongingDefinitionId());
parameters.put("defVerId", def.getId());
}
}
parameters.put("alias", def.getAlias());
parameters.put("autoProduction", ""+saveDialogInfo.isAutoProduction());
String result = proxy.saveProcessDefinition(parameters);
if (result == null || result.trim().startsWith("FAILURE") ) {
String errorMessage = result.trim().split("@")[1];
def.getRevisionInfoList().remove(revInfo);
throw new Exception(errorMessage);
}else if (result == null || result.trim().startsWith("ProcessManagerError")) {
throw new Exception(result);
}
String[] okAndNewDefVerId = result.trim().split("@");
if(okAndNewDefVerId!=null && okAndNewDefVerId.length > 1){
if(okAndNewDefVerId.length > 2){
String newVersionId = okAndNewDefVerId[2];
def.setId(newVersionId);
if(def==getProcessDefinitionDesigner().getActivity())
setDefinitionVersionId(newVersionId);
}
String belongingDefId = okAndNewDefVerId[1];
def.setBelongingDefinitionId(belongingDefId);
if(def==getProcessDefinitionDesigner().getActivity())
setDefinitionId(belongingDefId);
}
setDocumentChanged(false);
LoadedDefinition oldDef=null;
if(currentloadedType == 0)
oldDef = getLoadedDefinition((String)parameters.get("definitionId"));
else
oldDef = getLoadedDefinition((String)parameters.get("defVerId"));
LoadedDefinition newDef = new LoadedDefinition(((ProcessDefinition)getProcessDefinitionDesigner().getActivity()).getId(), def.getName().getText(), 1);
replaceDefinition(oldDef, newDef);
}