Program: 148614
Project: 148614
Buggy source:
public void doImport(TreeObject[] objs,IProgressMonitor monitor){
  monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
  Reader reader=null;
  Arrays.sort(objs,new Comparator<Object>(){
    public int compare(    Object o1,    Object o2){
      return ((TreeObject)o1).getType() - ((TreeObject)o2).getType();
    }
  }
);
  LocalTreeObjectRepository.getInstance().mergeImportCategory(objs,serverRoot);
  boolean isOverrideAll=false;
  for (  TreeObject item : objs) {
    String[] subItems;
switch (item.getType()) {
case TreeObject.DATA_CLUSTER:
      monitor.subTask("String_Node_Str");
    subItems=item.getItems();
  for (  String subItem : subItems) {
    try {
      reader=new FileReader(importFolder + "String_Node_Str" + subItem);
      WSDataCluster model=new WSDataCluster();
      model=(WSDataCluster)Unmarshaller.unmarshal(WSDataCluster.class,reader);
      if (port.existsDataCluster(new WSExistsDataCluster(new WSDataClusterPK(model.getName()))).is_true()) {
        if (!isOverrideAll) {
          int result=isOveride(model.getName(),TreeObject.DATACONTAINER);
          if (result == IDialogConstants.CANCEL_ID) {
            return;
          }
          if (result == IDialogConstants.YES_TO_ALL_ID) {
            isOverrideAll=true;
          }
          if (result == IDialogConstants.NO_ID) {
            break;
          }
        }
      }
      port.putDataCluster(new WSPutDataCluster(model));
    }
 catch (    Exception e1) {
      e1.printStackTrace();
    }
 finally {
      try {
        if (reader != null)         reader.close();
      }
 catch (      Exception e) {
      }
    }
    importClusterContents(item,port);
  }
break;
case TreeObject.DATA_CLUSTER_CONTENTS:
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSItem wsItem=new WSItem();
wsItem=(WSItem)Unmarshaller.unmarshal(WSItem.class,reader);
if (wsItem != null) {
  port.putItem(new WSPutItem(wsItem.getWsDataClusterPK(),wsItem.getContent(),new WSDataModelPK(wsItem.getDataModelName()),true));
}
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
  if (reader != null)   reader.close();
}
 catch (Exception e) {
}
}
}
break;
case TreeObject.DATA_MODEL:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSDataModel model=new WSDataModel();
model=(WSDataModel)Unmarshaller.unmarshal(WSDataModel.class,reader);
if (port.existsDataModel(new WSExistsDataModel(new WSDataModelPK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.DATAMODEL_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putDataModel(new WSPutDataModel(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.MENU:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSMenu memu=new WSMenu();
memu=(WSMenu)Unmarshaller.unmarshal(WSMenu.class,reader);
if (port.existsMenu(new WSExistsMenu(new WSMenuPK(memu.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(memu.getName(),TreeObject.MENU_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putMenu(new WSPutMenu(memu));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.ROLE:
if (Util.IsEnterPrise()) {
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSRole role=new WSRole();
role=(WSRole)Unmarshaller.unmarshal(WSRole.class,reader);
if (port.existsRole(new WSExistsRole(new WSRolePK(role.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(role.getName(),TreeObject.ROLE_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putRole(new WSPutRole(role));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
}
break;
case TreeObject.ROUTING_RULE:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSRoutingRule routingRule=new WSRoutingRule();
routingRule=(WSRoutingRule)Unmarshaller.unmarshal(WSRoutingRule.class,reader);
if (routingRule.getWsRoutingRuleExpressions() != null) {
for (WSRoutingRuleExpression rule : routingRule.getWsRoutingRuleExpressions()) {
if (rule.getWsOperator() == null) rule.setWsOperator(WSRoutingRuleOperator.CONTAINS);
}
}
if (port.existsRoutingRule(new WSExistsRoutingRule(new WSRoutingRulePK(routingRule.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(routingRule.getName(),TreeObject.ROUTINGRULE_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putRoutingRule(new WSPutRoutingRule(routingRule));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.STORED_PROCEDURE:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSStoredProcedure model=new WSStoredProcedure();
model=(WSStoredProcedure)Unmarshaller.unmarshal(WSStoredProcedure.class,reader);
if (port.existsStoredProcedure(new WSExistsStoredProcedure(new WSStoredProcedurePK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.STOREDPROCEDURE_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putStoredProcedure(new WSPutStoredProcedure(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.SYNCHRONIZATIONPLAN:
if (Util.IsEnterPrise()) {
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSSynchronizationPlan model=new WSSynchronizationPlan();
model=(WSSynchronizationPlan)Unmarshaller.unmarshal(WSSynchronizationPlan.class,reader);
if (port.existsSynchronizationPlan(new WSExistsSynchronizationPlan(new WSSynchronizationPlanPK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.SYNCHRONIZATIONPLAN_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putSynchronizationPlan(new WSPutSynchronizationPlan(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
}
break;
case TreeObject.PICTURES_RESOURCE:
subItems=item.getItems();
for (String subItem : subItems) {
try {
Util.uploadImageFile(serverRoot.getEndpointIpAddress() + "String_Node_Str",importFolder + "String_Node_Str" + subItem,serverRoot.getUsername(),serverRoot.getPassword());
}
 catch (Exception e2) {
e2.printStackTrace();
}
}
break;
case TreeObject.WORKFLOW_PROCESS:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
TreeParent parent=new TreeParent(null,null,TreeObject.WORKFLOW,null,null);
for (int i=0; i < serverRoot.getChildren().length; i++) {
parent=(TreeParent)item.getServerRoot().getChildren()[i];
if (parent.getType() == TreeObject.WORKFLOW) {
break;
}
}
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
String endpointaddress=item.getEndpointAddress();
String uploadURL=new URL(endpointaddress).getProtocol() + "String_Node_Str" + new URL(endpointaddress).getHost()+ "String_Node_Str"+ new URL(endpointaddress).getPort()+ "String_Node_Str";
String remoteFile=Util.uploadFileToAppServer(uploadURL,importFolder + "String_Node_Str" + subItem,"String_Node_Str","String_Node_Str");
WSWorkflowProcessDefinitionUUID uuid=port.workflowDeploy(new WSWorkflowDeploy(remoteFile));
TreeObject obj=new TreeObject(uuid.getProcessName() + "String_Node_Str" + uuid.getProcessVersion(),item.getServerRoot(),TreeObject.WORKFLOW_PROCESS,uuid,null);
parent.addChild(obj);
}
 catch (Exception e) {
e.printStackTrace();
ErrorExceptionDialog.openError(view.getSite().getShell(),"String_Node_Str",CommonUtil.getErrMsgFromException(e));
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
break;
case TreeObject.TRANSFORMER:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSTransformer model=new WSTransformer();
model=(WSTransformer)Unmarshaller.unmarshal(WSTransformer.class,reader);
if (port.existsTransformer(new WSExistsTransformer(new WSTransformerPK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.TRANSFORMER_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putTransformer(new WSPutTransformer(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.UNIVERSE:
if (Util.IsEnterPrise()) {
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSUniverse model=new WSUniverse();
model=(WSUniverse)Unmarshaller.unmarshal(WSUniverse.class,reader);
if (port.existsUniverse(new WSExistsUniverse(new WSUniversePK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.UNIVERSE_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putUniverse(new WSPutUniverse(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
}
break;
case TreeObject.VIEW:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSView model=new WSView();
model=(WSView)Unmarshaller.unmarshal(WSView.class,reader);
if (model.getIsTransformerActive() == null) model.setIsTransformerActive(new WSBoolean(false));
if (model.getTransformerPK() == null) model.setTransformerPK("String_Node_Str");
if (model.getWhereConditions() != null) {
for (WSWhereCondition ws : model.getWhereConditions()) {
if (ws.getOperator() == null) {
ws.setOperator(WSWhereOperator.CONTAINS);
}
if (ws.getStringPredicate() == null) {
ws.setStringPredicate(WSStringPredicate.NONE);
}
}
}
if (port.existsView(new WSExistsView(new WSViewPK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.VIEW_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putView(new WSPutView(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
}
}
monitor.done();
}

Fixed version (ground truth):
public void doImport(TreeObject[] objs,IProgressMonitor monitor){
  monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
  Reader reader=null;
  Arrays.sort(objs,new Comparator<Object>(){
    public int compare(    Object o1,    Object o2){
      return ((TreeObject)o1).getType() - ((TreeObject)o2).getType();
    }
  }
);
  LocalTreeObjectRepository.getInstance().mergeImportCategory(objs,serverRoot);
  boolean isOverrideAll=false;
  for (  TreeObject item : objs) {
    String[] subItems;
switch (item.getType()) {
case TreeObject.DATA_CLUSTER:
      monitor.subTask("String_Node_Str");
    subItems=item.getItems();
  for (  String subItem : subItems) {
    try {
      reader=new FileReader(importFolder + "String_Node_Str" + subItem);
      WSDataCluster model=new WSDataCluster();
      model=(WSDataCluster)Unmarshaller.unmarshal(WSDataCluster.class,reader);
      if (port.existsDataCluster(new WSExistsDataCluster(new WSDataClusterPK(model.getName()))).is_true()) {
        if (!isOverrideAll) {
          int result=isOveride(model.getName(),TreeObject.DATACONTAINER);
          if (result == IDialogConstants.CANCEL_ID) {
            return;
          }
          if (result == IDialogConstants.YES_TO_ALL_ID) {
            isOverrideAll=true;
          }
          if (result == IDialogConstants.NO_ID) {
            break;
          }
        }
      }
      port.putDataCluster(new WSPutDataCluster(model));
    }
 catch (    Exception e1) {
      e1.printStackTrace();
    }
 finally {
      try {
        if (reader != null)         reader.close();
      }
 catch (      Exception e) {
      }
    }
    importClusterContents(item,port);
    if (item.getBackupPath() != null) {
      try {
        String file=importFolder + "String_Node_Str" + item.getBackupPath();
        restoreCluster(port,file);
      }
 catch (      Exception e2) {
        e2.printStackTrace();
      }
 finally {
        try {
          if (reader != null)           reader.close();
        }
 catch (        Exception e) {
        }
      }
    }
  }
break;
case TreeObject.DATA_MODEL:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSDataModel model=new WSDataModel();
model=(WSDataModel)Unmarshaller.unmarshal(WSDataModel.class,reader);
if (port.existsDataModel(new WSExistsDataModel(new WSDataModelPK(model.getName()))).is_true()) {
if (!isOverrideAll) {
  int result=isOveride(model.getName(),TreeObject.DATAMODEL_);
  if (result == IDialogConstants.CANCEL_ID) {
    return;
  }
  if (result == IDialogConstants.YES_TO_ALL_ID) {
    isOverrideAll=true;
  }
  if (result == IDialogConstants.NO_ID) {
    break;
  }
}
}
port.putDataModel(new WSPutDataModel(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.MENU:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSMenu memu=new WSMenu();
memu=(WSMenu)Unmarshaller.unmarshal(WSMenu.class,reader);
if (port.existsMenu(new WSExistsMenu(new WSMenuPK(memu.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(memu.getName(),TreeObject.MENU_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putMenu(new WSPutMenu(memu));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.ROLE:
if (Util.IsEnterPrise()) {
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSRole role=new WSRole();
role=(WSRole)Unmarshaller.unmarshal(WSRole.class,reader);
if (port.existsRole(new WSExistsRole(new WSRolePK(role.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(role.getName(),TreeObject.ROLE_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putRole(new WSPutRole(role));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
}
break;
case TreeObject.ROUTING_RULE:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSRoutingRule routingRule=new WSRoutingRule();
routingRule=(WSRoutingRule)Unmarshaller.unmarshal(WSRoutingRule.class,reader);
if (routingRule.getWsRoutingRuleExpressions() != null) {
for (WSRoutingRuleExpression rule : routingRule.getWsRoutingRuleExpressions()) {
if (rule.getWsOperator() == null) rule.setWsOperator(WSRoutingRuleOperator.CONTAINS);
}
}
if (port.existsRoutingRule(new WSExistsRoutingRule(new WSRoutingRulePK(routingRule.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(routingRule.getName(),TreeObject.ROUTINGRULE_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putRoutingRule(new WSPutRoutingRule(routingRule));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.STORED_PROCEDURE:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSStoredProcedure model=new WSStoredProcedure();
model=(WSStoredProcedure)Unmarshaller.unmarshal(WSStoredProcedure.class,reader);
if (port.existsStoredProcedure(new WSExistsStoredProcedure(new WSStoredProcedurePK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.STOREDPROCEDURE_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putStoredProcedure(new WSPutStoredProcedure(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.SYNCHRONIZATIONPLAN:
if (Util.IsEnterPrise()) {
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSSynchronizationPlan model=new WSSynchronizationPlan();
model=(WSSynchronizationPlan)Unmarshaller.unmarshal(WSSynchronizationPlan.class,reader);
if (port.existsSynchronizationPlan(new WSExistsSynchronizationPlan(new WSSynchronizationPlanPK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.SYNCHRONIZATIONPLAN_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putSynchronizationPlan(new WSPutSynchronizationPlan(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
}
break;
case TreeObject.PICTURES_RESOURCE:
subItems=item.getItems();
for (String subItem : subItems) {
try {
Util.uploadImageFile(serverRoot.getEndpointIpAddress() + "String_Node_Str",importFolder + "String_Node_Str" + subItem,serverRoot.getUsername(),serverRoot.getPassword());
}
 catch (Exception e2) {
e2.printStackTrace();
}
}
break;
case TreeObject.WORKFLOW_PROCESS:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
TreeParent parent=new TreeParent(null,null,TreeObject.WORKFLOW,null,null);
for (int i=0; i < serverRoot.getChildren().length; i++) {
parent=(TreeParent)item.getServerRoot().getChildren()[i];
if (parent.getType() == TreeObject.WORKFLOW) {
break;
}
}
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
String endpointaddress=item.getEndpointAddress();
String uploadURL=new URL(endpointaddress).getProtocol() + "String_Node_Str" + new URL(endpointaddress).getHost()+ "String_Node_Str"+ new URL(endpointaddress).getPort()+ "String_Node_Str";
String remoteFile=Util.uploadFileToAppServer(uploadURL,importFolder + "String_Node_Str" + subItem,"String_Node_Str","String_Node_Str");
WSWorkflowProcessDefinitionUUID uuid=port.workflowDeploy(new WSWorkflowDeploy(remoteFile));
TreeObject obj=new TreeObject(uuid.getProcessName() + "String_Node_Str" + uuid.getProcessVersion(),item.getServerRoot(),TreeObject.WORKFLOW_PROCESS,uuid,null);
parent.addChild(obj);
}
 catch (Exception e) {
e.printStackTrace();
ErrorExceptionDialog.openError(view.getSite().getShell(),"String_Node_Str",CommonUtil.getErrMsgFromException(e));
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
break;
case TreeObject.TRANSFORMER:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSTransformer model=new WSTransformer();
model=(WSTransformer)Unmarshaller.unmarshal(WSTransformer.class,reader);
if (port.existsTransformer(new WSExistsTransformer(new WSTransformerPK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.TRANSFORMER_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putTransformer(new WSPutTransformer(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
case TreeObject.UNIVERSE:
if (Util.IsEnterPrise()) {
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSUniverse model=new WSUniverse();
model=(WSUniverse)Unmarshaller.unmarshal(WSUniverse.class,reader);
if (port.existsUniverse(new WSExistsUniverse(new WSUniversePK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.UNIVERSE_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putUniverse(new WSPutUniverse(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
}
break;
case TreeObject.VIEW:
monitor.subTask("String_Node_Str");
subItems=item.getItems();
for (String subItem : subItems) {
try {
reader=new FileReader(importFolder + "String_Node_Str" + subItem);
WSView model=new WSView();
model=(WSView)Unmarshaller.unmarshal(WSView.class,reader);
if (model.getIsTransformerActive() == null) model.setIsTransformerActive(new WSBoolean(false));
if (model.getTransformerPK() == null) model.setTransformerPK("String_Node_Str");
if (model.getWhereConditions() != null) {
for (WSWhereCondition ws : model.getWhereConditions()) {
if (ws.getOperator() == null) {
ws.setOperator(WSWhereOperator.CONTAINS);
}
if (ws.getStringPredicate() == null) {
ws.setStringPredicate(WSStringPredicate.NONE);
}
}
}
if (port.existsView(new WSExistsView(new WSViewPK(model.getName()))).is_true()) {
if (!isOverrideAll) {
int result=isOveride(model.getName(),TreeObject.VIEW_);
if (result == IDialogConstants.CANCEL_ID) {
return;
}
if (result == IDialogConstants.YES_TO_ALL_ID) {
isOverrideAll=true;
}
if (result == IDialogConstants.NO_ID) {
break;
}
}
}
port.putView(new WSPutView(model));
}
 catch (Exception e2) {
e2.printStackTrace();
}
 finally {
try {
if (reader != null) reader.close();
}
 catch (Exception e) {
}
}
}
monitor.worked(1);
break;
}
}
monitor.done();
}