use of org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand in project tmdm-studio-se by Talend.
the class DeployService method updateServerConsistencyStatus.
public void updateServerConsistencyStatus(MDMServerDef serverDef, IStatus mainStatus) throws XtentisException, WebServiceException {
if (!UIUtil.isWorkInUI()) {
return;
}
if (mainStatus.isMultiStatus()) {
Set<IRepositoryViewObject> viewObjs = new HashSet<IRepositoryViewObject>();
for (IStatus childStatus : mainStatus.getChildren()) {
DeployStatus deployStatus = null;
if (childStatus instanceof DeployStatus) {
deployStatus = (DeployStatus) childStatus;
if (deployStatus.isOK()) {
AbstractDeployCommand command = (AbstractDeployCommand) deployStatus.getCommand();
if (command instanceof BatchDeployJobCommand) {
for (ICommand subCmd : ((BatchDeployJobCommand) command).getSubCmds()) {
if (subCmd instanceof AbstractDeployCommand) {
IRepositoryViewObject viewObj = ((AbstractDeployCommand) subCmd).getViewObject();
if (viewObj != null) {
viewObjs.add(viewObj);
}
}
}
} else {
if (command != null) {
IRepositoryViewObject viewObj = command.getViewObject();
if (viewObj != null) {
viewObjs.add(viewObj);
}
}
}
}
} else if (childStatus instanceof MultiStatus) {
updateServerConsistencyStatus(serverDef, childStatus);
}
}
updateServerConsistencyStatus(serverDef, viewObjs);
}
}
use of org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand in project tmdm-studio-se by Talend.
the class DeployStatusDialog method getType.
private ERepositoryObjectType getType(IStatus status) {
IStatus queryStatus = status;
if (status.isMultiStatus()) {
IStatus[] childrenStatus = status.getChildren();
if (childrenStatus != null && childrenStatus.length > 0) {
queryStatus = childrenStatus[0];
}
}
if (queryStatus != null && queryStatus instanceof DeployStatus) {
ICommand command = ((DeployStatus) queryStatus).getCommand();
IRepositoryViewObject viewObject = null;
if (command != null) {
if (command instanceof BatchDeployJobCommand) {
return ERepositoryObjectType.PROCESS;
} else {
viewObject = command.getViewObject();
}
}
if (viewObject == null) {
return null;
}
return viewObject.getRepositoryObjectType();
}
return null;
}
use of org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand in project tmdm-studio-se by Talend.
the class DeployService method updateForStatus.
private void updateForStatus(boolean isUpdateServer, List<DeployStatus> deployStatuses) {
if (deployStatuses == null || deployStatuses.size() == 0) {
return;
}
for (DeployStatus deployStatus : deployStatuses) {
if (deployStatus != null && deployStatus.isOK()) {
ICommand command = deployStatus.getCommand();
if (command != null) {
CommandManager manager = CommandManager.getInstance();
manager.removeCommandStack(command, ICommand.PHASE_DEPLOY);
if (isUpdateServer) {
MDMServerDef serverDef = null;
if (command instanceof AbstractDeployCommand) {
serverDef = ((AbstractDeployCommand) command).getServerDef();
} else if (command instanceof DeployCompoundCommand) {
serverDef = ((DeployCompoundCommand) command).getServerDef();
}
if (command instanceof BatchDeployJobCommand) {
BatchDeployJobCommand deployJobCommand = (BatchDeployJobCommand) command;
pushRestoreCommand(manager, deployJobCommand.getSubCmds(), serverDef);
pushRestoreCommand(manager, deployJobCommand.getSubDeleteCmds(), serverDef);
} else {
// updateserver
pushRestoreCommand(manager, command, serverDef);
}
}
}
}
}
}
use of org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand in project tmdm-studio-se by Talend.
the class DeployService method updateChangedStatus.
public void updateChangedStatus(IStatus status, boolean isUpdateServer) {
if (status.isMultiStatus()) {
for (IStatus childStatus : status.getChildren()) {
List<DeployStatus> deployStatuses = new ArrayList<DeployStatus>();
if (childStatus instanceof DeployStatus) {
deployStatuses.add((DeployStatus) childStatus);
} else if (childStatus instanceof MultiStatus) {
IStatus[] childrenStatus = ((MultiStatus) childStatus).getChildren();
if (childrenStatus.length > 0) {
for (IStatus cstatus : childrenStatus) {
if (cstatus instanceof DeployStatus) {
deployStatuses.add((DeployStatus) cstatus);
if (((DeployStatus) cstatus).getCommand() instanceof BatchDeployJobCommand) {
break;
}
}
}
}
}
updateForStatus(isUpdateServer, deployStatuses);
}
}
}
use of org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand in project tmdm-studio-se by Talend.
the class JobInteractiveHandler method deploy.
@Override
public boolean deploy(AbstractDeployCommand cmd) throws XtentisException {
setToDefaultValue();
if (cmd instanceof BatchDeployJobCommand) {
BatchDeployJobCommand deployJobCommand = (BatchDeployJobCommand) cmd;
List<IRepositoryViewObject> viewObjects = deployJobCommand.getViewObjects();
if (viewObjects.isEmpty()) {
return true;
}
IStructuredSelection selection = getSelection(viewObjects);
//
final DeployOnMDMExportWizard publishWizard = new DeployOnMDMExportWizard();
SpagoBiServer server = getServer(deployJobCommand.getServerDef());
publishWizard.setMdmServer(server);
IWorkbench workbench = RepositoryPlugin.getDefault().getWorkbench();
publishWizard.setWindowTitle(Messages.JobInteractiveHandler_wizardTitle);
publishWizard.init(workbench, selection);
final Display display = Display.getDefault();
display.syncExec(new Runnable() {
public void run() {
Shell activeShell = display.getActiveShell();
WizardDialog dialog = new WizardDialog(activeShell, publishWizard);
int open = dialog.open();
if (open == IDialogConstants.CANCEL_ID) {
setDeployCancelled(true);
} else {
setResult(publishWizard.isDeploySucceed());
RuntimeException e = publishWizard.getDeployException();
if (e != null) {
setException(e);
}
}
}
});
}
if (deployCancelled) {
throw new OperationCanceledException();
}
if (deployException != null) {
throw deployException;
}
return result;
}
Aggregations