Search in sources :

Example 1 with IInteractiveHandler

use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.

the class DefaultDeployCommand method doExecute.

private IStatus doExecute(Object params, IProgressMonitor monitor) {
    ERepositoryObjectType type = getViewObjectType();
    String objectName = getLabel();
    IInteractiveHandler handler = InteractiveService.findHandler(type);
    if (handler != null) {
        String typeLabel = handler.getLabel();
        monitor.subTask(Messages.bind(Messages.Deploy_text, typeLabel));
        try {
            boolean isOK = handler.deploy(this);
            if (getDeployStatus() != null) {
                return getDeployStatus();
            }
            if (isOK) {
                if (getCommandType() == CMD_MODIFY) {
                    return DeployStatus.getOKStatus(this, Messages.bind(Messages.Deploy_successfully_text, typeLabel, objectName));
                }
                return DeployStatus.getOKStatus(this, Messages.bind(Messages.Create_successfully_text, typeLabel, objectName));
            } else {
                return DeployStatus.getErrorStatus(this, Messages.bind(Messages.Deploy_fail_text, typeLabel, objectName));
            }
        } catch (OperationIgnoredException e) {
            return null;
        } catch (OperationCanceledException e) {
            return DeployStatus.getInfoStatus(this, Messages.bind(Messages.Deploy_cancel_text, typeLabel, objectName));
        } catch (WebServiceException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        } catch (XtentisException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        } catch (RuntimeException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        }
    } else {
        return DeployStatus.getErrorStatus(this, Messages.bind(Messages.Deploy_notSupport_text, objectName));
    }
}
Also used : OperationIgnoredException(com.amalto.workbench.utils.OperationIgnoredException) WebServiceException(javax.xml.ws.WebServiceException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) IInteractiveHandler(org.talend.mdm.repository.core.service.IInteractiveHandler) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 2 with IInteractiveHandler

use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.

the class DeployStatusDialog method initMultiStatus.

@Override
protected IStatus initMultiStatus(IStatus multiStatus) {
    IStatus[] children = multiStatus.getChildren();
    Map<ERepositoryObjectType, List<IStatus>> map = new HashMap<ERepositoryObjectType, List<IStatus>>();
    for (IStatus status : children) {
        collectTypeStatus(map, status);
    }
    // $NON-NLS-1$
    MultiStatus retStatus = new MultiStatus(RepositoryPlugin.PLUGIN_ID, Status.OK, "", null);
    for (Entry<ERepositoryObjectType, List<IStatus>> entry : map.entrySet()) {
        ERepositoryObjectType key = entry.getKey();
        IInteractiveHandler handler = InteractiveService.findHandler(key);
        if (handler != null) {
            MultiStatus submultiStatus = new DeployCategoryStatus(RepositoryPlugin.PLUGIN_ID, Status.OK, Messages.bind(Messages.MultiStatusDialog_MultiStatus_Messages, key.getLabel()), null);
            for (IStatus status : entry.getValue()) {
                if (isShown(handler, status)) {
                    submultiStatus.add(status);
                }
            }
            if (submultiStatus.getChildren().length > 0) {
                retStatus.add(submultiStatus);
            }
        }
    }
    isShowWarningMsg = map.containsKey(IServerObjectRepositoryType.TYPE_VIEW) && (!map.containsKey(IServerObjectRepositoryType.TYPE_DATAMODEL));
    map.clear();
    return retStatus;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) DeployCategoryStatus(org.talend.mdm.repository.core.service.DeployService.DeployCategoryStatus) HashMap(java.util.HashMap) MultiStatus(org.eclipse.core.runtime.MultiStatus) IInteractiveHandler(org.talend.mdm.repository.core.service.IInteractiveHandler) ArrayList(java.util.ArrayList) List(java.util.List) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 3 with IInteractiveHandler

use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.

the class UndeployAction method getSelectedRepositoryViewObject.

protected List<IRepositoryViewObject> getSelectedRepositoryViewObject() {
    List<IRepositoryViewObject> viewObjs = new LinkedList<IRepositoryViewObject>();
    for (Object obj : getSelectedObject()) {
        if (obj instanceof IRepositoryViewObject) {
            IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
            ERepositoryObjectType type = viewObject.getRepositoryObjectType();
            if (type != null) {
                IInteractiveHandler handler = InteractiveService.findHandler(type);
                if (handler != null) {
                    List<IRepositoryViewObject> associatedObjects = handler.getAssociatedObjects(viewObject);
                    if (associatedObjects != null) {
                        for (IRepositoryViewObject associatedObj : associatedObjects) {
                            viewObjs.add(associatedObj);
                        }
                    }
                }
            }
            viewObjs.add(viewObject);
        }
    }
    return viewObjs;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IInteractiveHandler(org.talend.mdm.repository.core.service.IInteractiveHandler) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) LinkedList(java.util.LinkedList)

Example 4 with IInteractiveHandler

use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.

the class RepositoryResourceUtil method findAllViewObjects.

public static List<IRepositoryViewObject> findAllViewObjects(ERepositoryObjectType type, boolean useRepositoryViewObject, boolean withDeleted) {
    IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
    try {
        List<IRepositoryViewObject> allObjs = factory.getAll(type, withDeleted);
        List<IRepositoryViewObject> viewObjects = new LinkedList<IRepositoryViewObject>();
        for (IRepositoryViewObject viewObj : allObjs) {
            viewObj = assertViewObject(viewObj);
            Item item = viewObj.getProperty().getItem();
            ItemState state = item.getState();
            if (!state.isDeleted() || withDeleted) {
                try {
                    IInteractiveHandler handler = InteractiveService.findHandler(viewObj.getRepositoryObjectType());
                    if (handler != null) {
                        handler.assertPropertyIsInited(item);
                    }
                    if (useRepositoryViewObject) {
                        IRepositoryViewObject cacheViewObj = getCacheViewObject(viewObj.getProperty(), viewObj);
                        viewObjects.add(cacheViewObj);
                    } else {
                        viewObjects.add(viewObj);
                    }
                } catch (Exception e) {
                    log.error(e.getMessage(), e);
                }
            }
        }
        return viewObjects;
    } catch (PersistenceException e) {
        log.error(e.getMessage(), e);
    }
    return null;
}
Also used : ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) WorkspaceRootItem(org.talend.mdm.repository.model.mdmproperties.WorkspaceRootItem) Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) ItemState(org.talend.core.model.properties.ItemState) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IInteractiveHandler(org.talend.mdm.repository.core.service.IInteractiveHandler) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) LinkedList(java.util.LinkedList) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) LoginException(org.talend.commons.exception.LoginException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IOException(java.io.IOException) XtentisException(com.amalto.workbench.utils.XtentisException) FileNotFoundException(java.io.FileNotFoundException) PersistenceException(org.talend.commons.exception.PersistenceException)

Example 5 with IInteractiveHandler

use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.

the class BatchDeployJobCommand method execute.

@Override
public IStatus execute(Object params, IProgressMonitor monitor) {
    IStatus status = super.execute(params, monitor);
    // 
    MultiStatus ms = new MultiStatus(RepositoryPlugin.PLUGIN_ID, status.getSeverity(), Messages.BatchDeployJobCommand_deployJob, null);
    IInteractiveHandler handler = InteractiveService.findHandler(getViewObjectType());
    String typeLabel = handler.getLabel();
    if (status.isOK()) {
        runDeleteCmds(params, monitor, ms);
    }
    collectDeployStatus(status, ms, typeLabel);
    return ms;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) MultiStatus(org.eclipse.core.runtime.MultiStatus) IInteractiveHandler(org.talend.mdm.repository.core.service.IInteractiveHandler)

Aggregations

IInteractiveHandler (org.talend.mdm.repository.core.service.IInteractiveHandler)9 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 XtentisException (com.amalto.workbench.utils.XtentisException)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 IStatus (org.eclipse.core.runtime.IStatus)2 MultiStatus (org.eclipse.core.runtime.MultiStatus)2 Item (org.talend.core.model.properties.Item)2 ItemState (org.talend.core.model.properties.ItemState)2 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)2 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)2 OperationIgnoredException (com.amalto.workbench.utils.OperationIgnoredException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 WebServiceException (javax.xml.ws.WebServiceException)1 CoreException (org.eclipse.core.runtime.CoreException)1