use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class DeployAnotherVersionAction method doRun.
@Override
protected void doRun() {
boolean checkMissingJar = MissingJarService.getInstance().checkMissingJar(true);
if (!checkMissingJar) {
return;
}
List<IRepositoryViewObject> viewObjs = getSelectedRepositoryViewObject();
if (viewObjs.size() == 0) {
return;
}
String originVersion = viewObjs.get(0).getProperty().getVersion();
// open the version dialog
SelectVersionDialog versionDialog = new SelectVersionDialog(getShell(), Messages.DeployAnotherVersionAction_selectAnother, viewObjs.get(0));
versionDialog.create();
if (versionDialog.open() == IDialogConstants.OK_ID) {
if (versionDialog.getSelection() != null) {
viewObjs = new ArrayList<IRepositoryViewObject>();
IRepositoryViewObject modelviewObj = versionDialog.getSelection();
viewObjs.add(modelviewObj);
viewObjs.addAll(getAssociatedObjects(modelviewObj));
}
SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
if (dialog.open() == IDialogConstants.OK_ID) {
// save editors
LockedDirtyObjectDialog lockDirtyDialog = new LockedDirtyObjectDialog(getShell(), Messages.AbstractDeployAction_promptToSaveEditors, viewObjs);
if (lockDirtyDialog.needShowDialog() && lockDirtyDialog.open() == IDialogConstants.CANCEL_ID) {
return;
}
lockDirtyDialog.saveDirtyObjects();
// deploy
MDMServerDef serverDef = dialog.getSelectedServerDef();
if (doCheckServerConnection(serverDef)) {
IStatus status = DeployService.getInstance().deployAnotherVersion(serverDef, viewObjs);
if (status.isMultiStatus()) {
showDeployStatus(status);
}
if (isLatestVersion(viewObjs.get(0), originVersion)) {
updateChangedStatus(status);
updateLastServer(status, new NullProgressMonitor());
}
}
}
}
}
use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class DeployToAction method initializeSelection.
/**
* set the default selection in SelectServerDefDialog
*
* @param viewObjs current selected view objects
* @param dialog
*/
private void initializeSelection(List<IRepositoryViewObject> viewObjs, SelectServerDefDialog dialog) {
MDMServerDef defServer = null;
for (IRepositoryViewObject viewObject : viewObjs) {
MDMServerDef tmpServer = RepositoryResourceUtil.getLastServerDef(viewObject);
if (defServer == null) {
defServer = tmpServer;
} else if (tmpServer != null && !RepositoryResourceUtil.isSameMDMServerDef(defServer, tmpServer)) {
defServer = null;
break;
}
}
dialog.create();
dialog.setSelectServer(defServer);
}
use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class DeployToAction method doRun.
@Override
protected void doRun() {
boolean checkMissingJar = MissingJarService.getInstance().checkMissingJar(true);
if (!checkMissingJar) {
return;
}
List<IRepositoryViewObject> viewObjs = getSelectedRepositoryViewObject();
viewObjs = doCheckDependency(viewObjs);
if (viewObjs == null) {
return;
}
SelectServerDefDialog dialog = getSelectServerDefDialog(viewObjs);
if (dialog.open() == IDialogConstants.OK_ID) {
// save editors
if (!doBeforeDeploy(viewObjs)) {
return;
}
// deploy
MDMServerDef serverDef = dialog.getSelectedServerDef();
IStatus status = deploy(serverDef, viewObjs, ICommand.CMD_MODIFY);
if (status.getSeverity() != IStatus.CANCEL) {
updateChangedStatus(status);
if (status.isMultiStatus()) {
showDeployStatus(status);
}
doPostDeploy(status);
}
}
}
use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef 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.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class CopyUrlAction method multiCopy.
private void multiCopy() {
StringBuilder result = new StringBuilder();
List<Object> selectedObject = getSelectedObject();
for (Object obj : selectedObject) {
IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
// picture file info
Item item = viewObject.getProperty().getItem();
WSResourceE wsItem = null;
if (!(item instanceof WSResourceItem)) {
continue;
}
wsItem = ((WSResourceItem) item).getResource();
String catalog = wsItem.getImageCatalog();
if (catalog == null) {
continue;
}
String fileName = viewObject.getLabel() + '.' + wsItem.getFileExtension();
// MDMServerDef thing
MDMServerDef serverDef = RepositoryResourceUtil.getLastServerDef(viewObject);
if (serverDef == null) {
continue;
}
// all picture url string
String contextPath = Util.getContextPath(serverDef.getPath());
String uripre = serverDef.getProtocol() + serverDef.getHost() + ':' + serverDef.getPort() + contextPath;
result.append(uripre);
// $NON-NLS-1$
result.append("/imageserver/upload/" + catalog + '/' + fileName);
result.append('\n');
}
// copy url to clipboard
if (result.length() != 0) {
Clipboard cb = new Clipboard(Display.getCurrent());
String textData = result.toString();
TextTransfer transfer = TextTransfer.getInstance();
cb.setContents(new Object[] { textData }, new Transfer[] { transfer });
cb.dispose();
}
}
Aggregations