use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class RenameProcessAction method moveToOtherTypeNode.
public void moveToOtherTypeNode(IRepositoryViewObject parent, IRepositoryViewObject viewObj) {
MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
waitSomeTime(viewObj);
IProxyRepositoryFactory factory = getFactory();
try {
if (factory.isEditableAndLockIfPossible(item)) {
String path = item.getState().getPath();
IPath ipath = new Path(path);
factory.moveObject(viewObj, ipath);
IRepositoryViewObject iRepositoryViewObject = ContainerCacheService.get(viewObj.getRepositoryObjectType(), path);
commonViewer.refresh(parent);
commonViewer.refresh(iRepositoryViewObject);
}
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
} catch (BusinessException e) {
log.error(e.getMessage(), e);
} finally {
try {
factory.unlock(item);
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
} catch (LoginException e) {
log.error(e.getMessage(), e);
}
}
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class MDMEditViewProcessPropertyAction method moveToOtherTypeNode.
private void moveToOtherTypeNode(IRepositoryViewObject viewObj, String oldPath, String newPath) {
MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
item.getState().setPath(newPath);
waitSomeTime(viewObj);
IProxyRepositoryFactory factory = getFactory();
try {
if (factory.isEditableAndLockIfPossible(item)) {
IPath ipath = new Path(newPath);
factory.moveObject(viewObj, ipath);
ERepositoryObjectType type = viewObj.getRepositoryObjectType();
refreshTree(type, oldPath);
refreshTree(type, newPath);
}
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
} catch (BusinessException e) {
log.error(e.getMessage(), e);
} finally {
unlockItem(item);
}
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class ExportDataClusterAction method doRun.
@Override
protected void doRun() {
List<Object> selectedObject = getSelectedObject();
if (!selectedObject.isEmpty()) {
IRepositoryViewObject viewObj = (IRepositoryViewObject) selectedObject.get(0);
SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
if (dialog.open() == IDialogConstants.OK_ID) {
MDMServerDef serverDef = dialog.getSelectedServerDef();
MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
String dName = item.getMDMServerObject().getName();
try {
FileDialog fd = new FileDialog(getShell(), SWT.SAVE);
// $NON-NLS-1$
fd.setFilterExtensions(new String[] { "*.zip" });
String fPath = fd.open();
if (fPath != null) {
TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
service.ping(new WSPing(Messages.ExportDataClusterAction_exportContent));
DataClusterService dataClusterService = DataClusterService.getIntance();
if (dataClusterService.isExistDataCluster(service, dName)) {
File tempFolder = IOUtil.getTempFolder();
String tempFolderPath = tempFolder.getAbsolutePath();
dataClusterService.storeIndexFile(tempFolderPath, dName);
//
IDataContentProcess process = dataClusterService.getNewExportContentProcess(service, tempFolderPath, dName, fPath);
try {
process.run();
} catch (InterruptedException e) {
// do nothing
return;
}
MultiStatus status = process.getResult();
if (status != null && status.getChildren().length > 0) {
MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.ExportDataClusterAction_failedExportContent, dName));
} else {
MessageDialog.openInformation(getShell(), Messages.ExportDataClusterAction_exportContent, Messages.bind(Messages.ExportDataClusterAction_successExport, dName));
}
} else {
MessageDialog.openInformation(getShell(), Messages.Common_Warning, Messages.bind(Messages.ExportDataClusterAction_noContainerFound, dName));
}
}
} catch (XtentisException e) {
log.error(e.getMessage(), e);
} catch (WebServiceException e) {
MessageDialog.openError(getShell(), Messages.ExportDataClusterAction_exportContent, Messages.AbstractDataClusterAction_ConnectFailed);
}
}
}
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class ResourceRepositoryFileEditorInput method init.
@Override
protected void init(Item item) {
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
String name = null;
if (serverObject instanceof WSResourceE) {
// $NON-NLS-1$
name = serverObject.getName() + "." + ((WSResourceE) serverObject).getFileExtension();
}
Object treeObject = new TreeObject(name, null, TreeObject.RESOURCES, null, null, null);
setModel(treeObject);
setName(name);
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class AbstractInteractiveHandler method deploy.
/*
* (non-Javadoc)
*
* @see
* org.talend.mdm.repository.core.service.IInteractiveHandler#deploy(com.amalto.workbench.webservices.XtentisPort,
* org.talend.core.model.properties.Item, org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)
*/
@Override
public boolean deploy(AbstractDeployCommand cmd) throws XtentisException {
IRepositoryViewObject viewObj = cmd.getViewObject();
Item item = viewObj.getProperty().getItem();
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
Object wsObj = convert(item, serverObject);
TMDMService service = getService(cmd.getServerDef());
return doDeployWSObject(service, wsObj);
}
Aggregations