use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class DeployToLastServerAction method doRun.
@Override
protected void doRun() {
boolean checkMissingJar = MissingJarService.getInstance().checkMissingJar(true);
if (!checkMissingJar) {
return;
}
List<IRepositoryViewObject> viewObjs = getSelectedRepositoryViewObject();
if (exAdapter != null) {
viewObjs = exAdapter.showDependencyConfigDialog(viewObjs);
if (viewObjs == null) {
return;
}
// TO add match rule object
viewObjs = getSelectedRepositoryViewObject(viewObjs);
filterMatchRuleObjs(viewObjs);
}
LockedDirtyObjectDialog lockDirtyDialog = new LockedDirtyObjectDialog(getShell(), Messages.AbstractDeployAction_promptToSaveEditors, viewObjs);
if (lockDirtyDialog.needShowDialog() && lockDirtyDialog.open() == IDialogConstants.CANCEL_ID) {
return;
}
lockDirtyDialog.saveDirtyObjects();
//
MDMServerDef currentServerDef = getLastServer(viewObjs);
// handle last server is null case
boolean isLostedServer = false;
if (currentServerDef == null) {
isLostedServer = true;
boolean isDeployToAnother = MessageDialog.openQuestion(getShell(), null, Messages.DeployToLastServerAction_askReselectServerMsg);
if (isDeployToAnother) {
SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
if (dialog.open() == IDialogConstants.OK_ID) {
currentServerDef = dialog.getSelectedServerDef();
} else {
return;
}
} else {
return;
}
}
// check last server
if (!currentServerDef.isEnabled()) {
MessageDialog.openWarning(Display.getDefault().getActiveShell(), null, Messages.DeployService_CanNotDeployToDisabledServer);
return;
}
// deploy
IStatus status = deploy(currentServerDef, viewObjs, ICommand.CMD_MODIFY);
if (status.getSeverity() != IStatus.CANCEL) {
if (status.isMultiStatus()) {
showDeployStatus(status);
}
if (isLostedServer) {
updateLastServer(status, new NullProgressMonitor());
}
DeployService.getInstance().updateChangedStatus(status, false);
for (IRepositoryViewObject viewObject : viewObjs) {
commonViewer.refresh(viewObject);
}
}
}
use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method getLastServerDef.
/**
* @param item
* @return A decrypted serverDef
*/
public static MDMServerDef getLastServerDef(Item item) {
if (item != null) {
if (item instanceof MDMServerObjectItem) {
MDMServerObject mdmServerObject = ((MDMServerObjectItem) item).getMDMServerObject();
String lastServerName = mdmServerObject.getLastServerName();
if (lastServerName == null) {
MDMServerDef lastServerDef = mdmServerObject.getLastServerDef();
if (lastServerDef != null) {
lastServerName = lastServerDef.getName();
}
}
if (lastServerName != null) {
return ServerDefService.findServerDefByName(lastServerName);
}
} else {
Property property = item.getProperty();
if (property != null) {
Object value = property.getAdditionalProperties().get(PROP_LAST_SERVER_DEF);
if (value != null) {
return ServerDefService.findServerDefByName((String) value);
}
}
}
}
return null;
}
use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class ServerExplorer method reInputPassword.
private void reInputPassword() {
List<IRepositoryViewObject> viewObjects = ServerDefService.getAllServerDefViewObjects();
for (IRepositoryViewObject viewObj : viewObjects) {
MDMServerDefItem serverDefItem = getMDMItem(viewObj);
MDMServerDef serverDef = serverDefItem.getServerDef();
if (serverDef.getPasswd().equals("")) {
// $NON-NLS-1$
MessageDialog.openInformation(null, Messages.ServerExplorer_WarningText, Messages.bind(Messages.Reinput_Password, serverDef.getName()));
editServerDef(viewObj);
}
}
}
use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class ServerExplorer method getMenuListener.
private IMenuListener getMenuListener() {
return new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
ISelection selection = treeViewer.getSelection();
boolean isEmpty = selection.isEmpty();
if (isEmpty) {
manager.add(addServerDefAction);
} else {
addAllActions(manager);
IRepositoryViewObject viewObject = getCurSelectedViewObject();
if (viewObject != null) {
MDMServerDefItem mdmItem = getMDMItem(viewObject);
if (mdmItem != null) {
MDMServerDef serverDef = mdmItem.getServerDef();
manager.add(new Separator());
if (serverDef.isEnabled()) {
manager.add(toDisableServerAction);
} else {
manager.add(toEnableServerAction);
}
}
}
}
}
};
}
use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.
the class ServerDefService method getAllServerDefs.
public static List<MDMServerDef> getAllServerDefs(boolean includeDisabledServer) {
List<IRepositoryViewObject> viewObjects = getAllServerDefViewObjects(includeDisabledServer);
if (viewObjects != null) {
List<MDMServerDef> serverDefs = new ArrayList<MDMServerDef>(viewObjects.size());
for (IRepositoryViewObject viewObj : viewObjects) {
Item item = viewObj.getProperty().getItem();
MDMServerDef serverDef = ((MDMServerDefItem) item).getServerDef();
if (serverDef != null && (includeDisabledServer || serverDef.isEnabled())) {
serverDefs.add(serverDef.getDecryptedServerDef());
}
}
return serverDefs;
}
return null;
}
Aggregations