Search in sources :

Example 1 with AbstractSvnRepositoryService

use of org.talend.dataprofiler.core.service.AbstractSvnRepositoryService in project tdq-studio-se by Talend.

the class CreateHiveTableActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    if (!isShowMenu()) {
        return;
    }
    AbstractSvnRepositoryService svnReposService = GlobalServiceRegister.getDefault().getSvnRepositoryService(AbstractSvnRepositoryService.class);
    if (svnReposService != null && svnReposService.isReadonly()) {
        return;
    }
    RepositoryNode node = (RepositoryNode) getFirstRepositoryNode();
    if (node != null) {
        IAction action = null;
        if (node instanceof HDFSOfHCConnectionNode) {
            action = HadoopClusterUtils.getDefault().createActionOfHiveTable(node);
            menu.add(action);
        }
    }
}
Also used : AbstractSvnRepositoryService(org.talend.dataprofiler.core.service.AbstractSvnRepositoryService) IAction(org.eclipse.jface.action.IAction) HDFSOfHCConnectionNode(org.talend.dq.nodes.hadoopcluster.HDFSOfHCConnectionNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 2 with AbstractSvnRepositoryService

use of org.talend.dataprofiler.core.service.AbstractSvnRepositoryService in project tdq-studio-se by Talend.

the class CreateAnalysisOnHDFSActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    if (!isShowMenu()) {
        return;
    }
    AbstractSvnRepositoryService svnReposService = GlobalServiceRegister.getDefault().getSvnRepositoryService(AbstractSvnRepositoryService.class);
    if (svnReposService != null && svnReposService.isReadonly()) {
        return;
    }
    RepositoryNode node = (RepositoryNode) getFirstRepositoryNode();
    if (node != null) {
        IAction action = null;
        if (node instanceof HDFSOfHCConnectionNode) {
            action = new CreateAnalysisOnHDFSAction(node);
            menu.add(action);
        }
    }
}
Also used : AbstractSvnRepositoryService(org.talend.dataprofiler.core.service.AbstractSvnRepositoryService) IAction(org.eclipse.jface.action.IAction) HDFSOfHCConnectionNode(org.talend.dq.nodes.hadoopcluster.HDFSOfHCConnectionNode) RepositoryNode(org.talend.repository.model.RepositoryNode) CreateAnalysisOnHDFSAction(org.talend.dataprofiler.core.ui.action.actions.CreateAnalysisOnHDFSAction)

Example 3 with AbstractSvnRepositoryService

use of org.talend.dataprofiler.core.service.AbstractSvnRepositoryService in project tdq-studio-se by Talend.

the class CreateHiveOfHCActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    // MOD mzhao user readonly role on svn repository mode.
    AbstractSvnRepositoryService svnReposService = GlobalServiceRegister.getDefault().getSvnRepositoryService(AbstractSvnRepositoryService.class);
    if (svnReposService != null && svnReposService.isReadonly()) {
        return;
    }
    // MOD gdbu 2011-4-1 bug 20051
    RepositoryNode node = (RepositoryNode) getFirstRepositoryNode();
    if (node != null) {
        if (HadoopClusterUtils.getDefault().hideAction(node)) {
            return;
        }
        // ~20051
        IAction action = null;
        if (node instanceof HadoopClusterConnectionRepNode || node instanceof HiveOfHCFolderRepNode) {
            action = new CreateHiveOfHCAction(node);
            menu.add(action);
        }
    }
}
Also used : HiveOfHCFolderRepNode(org.talend.dq.nodes.hadoopcluster.HiveOfHCFolderRepNode) AbstractSvnRepositoryService(org.talend.dataprofiler.core.service.AbstractSvnRepositoryService) IAction(org.eclipse.jface.action.IAction) CreateHiveOfHCAction(org.talend.dataprofiler.core.ui.action.actions.CreateHiveOfHCAction) RepositoryNode(org.talend.repository.model.RepositoryNode) HadoopClusterConnectionRepNode(org.talend.dq.nodes.hadoopcluster.HadoopClusterConnectionRepNode)

Example 4 with AbstractSvnRepositoryService

use of org.talend.dataprofiler.core.service.AbstractSvnRepositoryService in project tdq-studio-se by Talend.

the class FileSystemImportWriter method write.

/*
     * After check the conflicts of the imported object, calling this method (from ImportWizard) replace the conflicts
     * object in the records if the record is valid; then call the finish to do migrate. OR: merge the conflict system
     * indicators if valid.(overwrite)
     * 
     * @see
     * org.talend.dataprofiler.core.ui.imex.model.IImexWriter#write(org.talend.dataprofiler.core.ui.imex.model.ItemRecord
     * [], org.eclipse.core.runtime.IProgressMonitor)
     */
public void write(ItemRecord[] records, IProgressMonitor monitor) {
    if (monitor == null) {
        monitor = new NullProgressMonitor();
    }
    final ItemRecord[] fRecords = records;
    final IProgressMonitor fMonitor = monitor;
    need2MergeModelElementMap.clear();
    allImportItems.clear();
    RepositoryWorkUnit<Object> workUnit = new // $NON-NLS-1$
    RepositoryWorkUnit<Object>(// $NON-NLS-1$
    "Import TDQ Element") {

        @Override
        protected void run() {
            try {
                for (ItemRecord record : fRecords) {
                    if (fMonitor.isCanceled()) {
                        break;
                    }
                    Map<IPath, IPath> toImportMap = mapping(record);
                    // $NON-NLS-1$
                    fMonitor.subTask("Importing " + record.getName());
                    if (record.isValid()) {
                        boolean isDeleted = false;
                        // $NON-NLS-1$
                        log.info("Importing " + record.getFile().getAbsolutePath());
                        // Delete the conflict node before import.
                        IRepositoryViewObject object = record.getConflictObject();
                        boolean isDelete = true;
                        ModelElement modEle = record.getElement();
                        if (object != null) {
                            // is a system indicator definition, (using its UUid to find this SI not label)
                            if (isIndicatorDefinition(modEle)) {
                                if (isDQRule(modEle)) {
                                    if (isParserRule(modEle)) {
                                        mergeParserRule(record, (TDQBusinessRuleItem) object.getProperty().getItem());
                                        isDelete = false;
                                    } else if (isWhereRule(modEle)) {
                                    // do nothing here now
                                    }
                                } else if (isMatchRuleDefinition(modEle)) {
                                // do nothing here now
                                } else {
                                    // System Indicator and UDI need merge
                                    TDQIndicatorDefinitionItem indItem = (TDQIndicatorDefinitionItem) object.getProperty().getItem();
                                    mergeSystemIndicator(record, indItem);
                                    // only add it when it is UDIndicatorDefinition
                                    if (record.getElement() instanceof UDIndicatorDefinition) {
                                        need2MergeModelElementMap.put(indItem, record.getElement());
                                    }
                                    isDelete = false;
                                }
                            } else if (isPattern(modEle)) {
                                TDQPatternItem patternItem = (TDQPatternItem) object.getProperty().getItem();
                                mergePattern(record, patternItem);
                                need2MergeModelElementMap.put(patternItem, record.getElement());
                                isDelete = false;
                            } else {
                                // remove the dependency of the object
                                EObjectHelper.removeDependencys(PropertyHelper.getModelElement(object.getProperty()));
                                isDeleted = true;
                                // delete the object
                                ProxyRepositoryFactory.getInstance().deleteObjectPhysical(object);
                            }
                        }
                        if (isDelete) {
                            updateFiles.clear();
                            updateFilesCoverd.clear();
                            for (IPath resPath : toImportMap.keySet()) {
                                IPath desPath = toImportMap.get(resPath);
                                ResourceSet resourceSet = ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().resourceSet;
                                synchronized (resourceSet) {
                                    write(resPath, desPath);
                                    allCopiedFiles.add(desPath.toFile());
                                }
                                allImportItems.add(desPath);
                                // TDQ-12180
                                if (isDeleted) {
                                    AbstractSvnRepositoryService svnReposService = GlobalServiceRegister.getDefault().getSvnRepositoryService(AbstractSvnRepositoryService.class);
                                    if (svnReposService != null) {
                                        svnReposService.addIfImportOverride(desPath);
                                    }
                                }
                            }
                            for (File file : updateFiles) {
                                update(file, false);
                            }
                            for (File file : updateFilesCoverd) {
                                update(file, true);
                            }
                        }
                    } else {
                        for (String error : record.getErrors()) {
                            log.error(error);
                        }
                    }
                    fMonitor.worked(1);
                }
                finish(fRecords, fMonitor);
            } catch (Exception e) {
                log.error(e, e);
            }
        }
    };
    workUnit.setAvoidUnloadResources(Boolean.TRUE);
    ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
    // after above workUnit executed, the imported items will worked, than can do merge/update about UDI and Pattern
    RepositoryWorkUnit<Object> workUnitFinish = new // $NON-NLS-1$
    RepositoryWorkUnit<Object>(// $NON-NLS-1$
    "Finish Import TDQ Element") {

        @Override
        protected void run() throws LoginException, PersistenceException {
            try {
                postFinish();
            } catch (IOException e) {
                log.error(e, e);
            }
        }
    };
    workUnitFinish.setAvoidUnloadResources(Boolean.TRUE);
    ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnitFinish);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) IPath(org.eclipse.core.runtime.IPath) AbstractSvnRepositoryService(org.talend.dataprofiler.core.service.AbstractSvnRepositoryService) UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) RepositoryWorkUnit(org.talend.repository.RepositoryWorkUnit) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) IOException(java.io.IOException) TDQPatternItem(org.talend.dataquality.properties.TDQPatternItem) CoreException(org.eclipse.core.runtime.CoreException) LoginException(org.talend.commons.exception.LoginException) IOException(java.io.IOException) PersistenceException(org.talend.commons.exception.PersistenceException) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) EObject(org.eclipse.emf.ecore.EObject) IFile(org.eclipse.core.resources.IFile) File(java.io.File)

Example 5 with AbstractSvnRepositoryService

use of org.talend.dataprofiler.core.service.AbstractSvnRepositoryService in project tdq-studio-se by Talend.

the class CreateHDFSActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    // MOD mzhao user readonly role on svn repository mode.
    AbstractSvnRepositoryService svnReposService = GlobalServiceRegister.getDefault().getSvnRepositoryService(AbstractSvnRepositoryService.class);
    if (svnReposService != null && svnReposService.isReadonly()) {
        return;
    }
    // MOD gdbu 2011-4-1 bug 20051
    RepositoryNode node = (RepositoryNode) getFirstRepositoryNode();
    if (node != null) {
        // ~20051
        IAction action = null;
        if (node instanceof HadoopClusterConnectionRepNode || node instanceof HDFSOfHCFolderRepNode) {
            action = new CreateHDFSAction(node);
            menu.add(action);
        }
    }
}
Also used : HDFSOfHCFolderRepNode(org.talend.dq.nodes.hadoopcluster.HDFSOfHCFolderRepNode) AbstractSvnRepositoryService(org.talend.dataprofiler.core.service.AbstractSvnRepositoryService) IAction(org.eclipse.jface.action.IAction) CreateHDFSAction(org.talend.dataprofiler.core.ui.action.actions.CreateHDFSAction) RepositoryNode(org.talend.repository.model.RepositoryNode) HadoopClusterConnectionRepNode(org.talend.dq.nodes.hadoopcluster.HadoopClusterConnectionRepNode)

Aggregations

AbstractSvnRepositoryService (org.talend.dataprofiler.core.service.AbstractSvnRepositoryService)5 IAction (org.eclipse.jface.action.IAction)4 RepositoryNode (org.talend.repository.model.RepositoryNode)4 HDFSOfHCConnectionNode (org.talend.dq.nodes.hadoopcluster.HDFSOfHCConnectionNode)2 HadoopClusterConnectionRepNode (org.talend.dq.nodes.hadoopcluster.HadoopClusterConnectionRepNode)2 File (java.io.File)1 IOException (java.io.IOException)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 IPath (org.eclipse.core.runtime.IPath)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 EObject (org.eclipse.emf.ecore.EObject)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 LoginException (org.talend.commons.exception.LoginException)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 CreateAnalysisOnHDFSAction (org.talend.dataprofiler.core.ui.action.actions.CreateAnalysisOnHDFSAction)1 CreateHDFSAction (org.talend.dataprofiler.core.ui.action.actions.CreateHDFSAction)1