Search in sources :

Example 1 with MDMServerObjectItem

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);
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) BusinessException(org.talend.commons.exception.BusinessException) IPath(org.eclipse.core.runtime.IPath) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) LoginException(org.talend.commons.exception.LoginException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 2 with MDMServerObjectItem

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);
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) BusinessException(org.talend.commons.exception.BusinessException) IPath(org.eclipse.core.runtime.IPath) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) PersistenceException(org.talend.commons.exception.PersistenceException) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 3 with MDMServerObjectItem

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);
            }
        }
    }
}
Also used : WSPing(com.amalto.workbench.webservices.WSPing) DataClusterService(org.talend.mdm.repository.core.service.DataClusterService) WebServiceException(javax.xml.ws.WebServiceException) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IDataContentProcess(org.talend.mdm.repository.core.datacontent.IDataContentProcess) MultiStatus(org.eclipse.core.runtime.MultiStatus) TMDMService(com.amalto.workbench.webservices.TMDMService) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FileDialog(org.eclipse.swt.widgets.FileDialog) File(java.io.File) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 4 with MDMServerObjectItem

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);
}
Also used : MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) TreeObject(com.amalto.workbench.models.TreeObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TreeObject(com.amalto.workbench.models.TreeObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) WSResourceE(org.talend.mdm.repository.model.mdmserverobject.WSResourceE) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)

Example 5 with MDMServerObjectItem

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);
}
Also used : Item(org.talend.core.model.properties.Item) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) TMDMService(com.amalto.workbench.webservices.TMDMService) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)

Aggregations

MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)50 MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)33 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)28 Item (org.talend.core.model.properties.Item)22 Property (org.talend.core.model.properties.Property)15 PersistenceException (org.talend.commons.exception.PersistenceException)13 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)12 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)11 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)10 LoginException (org.talend.commons.exception.LoginException)9 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)9 TreeObject (com.amalto.workbench.models.TreeObject)7 Test (org.junit.Test)7 TMDMService (com.amalto.workbench.webservices.TMDMService)6 LinkedList (java.util.LinkedList)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 BusinessException (org.talend.commons.exception.BusinessException)5 FolderItem (org.talend.core.model.properties.FolderItem)5 ProcessItem (org.talend.core.model.properties.ProcessItem)5 ArrayList (java.util.ArrayList)4