Search in sources :

Example 51 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class AbstractAnalysisWizard method openEditor.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.wizard.AbstractWizard#openEditor(org.talend.repository.model.IRepositoryNode)
     */
@Override
public void openEditor(IRepositoryNode repNode) {
    String editorID = null;
    AnalysisItemEditorInput analysisEditorInput = new AnalysisItemEditorInput(repNode);
    IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
    analysisEditorInput.setConnectionNode(connectionRepNode);
    // add support for match analysis editor
    Analysis analysis = (Analysis) analysisEditorInput.getModel();
    if (analysis.getParameters() != null && analysis.getParameters().getAnalysisType().equals(AnalysisType.MATCH_ANALYSIS)) {
        editorID = MatchAnalysisEditor.class.getName();
    } else {
        editorID = AnalysisEditor.class.getName();
    }
    CorePlugin.getDefault().openEditor(analysisEditorInput, editorID);
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) Analysis(org.talend.dataquality.analysis.Analysis) AnalysisItemEditorInput(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisItemEditorInput) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) MatchAnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.MatchAnalysisEditor) MatchAnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.MatchAnalysisEditor)

Example 52 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class AbstractAnalysisWizard method createAndSaveCWMFile.

public TypedReturnCode<Object> createAndSaveCWMFile(ModelElement cwmElement) {
    Analysis analysis = (Analysis) cwmElement;
    IFolder folder = parameter.getFolderProvider().getFolderResource();
    AnalysisWriter analysisWriter = ElementWriterFactory.getInstance().createAnalysisWrite();
    return analysisWriter.create(analysis, folder);
}
Also used : Analysis(org.talend.dataquality.analysis.Analysis) AnalysisWriter(org.talend.dq.writer.impl.AnalysisWriter) IFolder(org.eclipse.core.resources.IFolder)

Example 53 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class ReportSubFolderRepNode method buildChildrenAnalysis.

/**
 * build RepositoryNode(Analysis) children according to IResource array.
 *
 * @param analyses
 * @return
 */
private List<IRepositoryNode> buildChildrenAnalysis(List<Analysis> analyses) {
    List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
    for (Analysis analysis : analyses) {
        // MOD gdbu 2011-8-18 TDQ-3301
        Property anaEleProperty = PropertyHelper.getProperty(analysis);
        IRepositoryViewObject viewObject = null;
        if (anaEleProperty != null) {
            viewObject = new RepositoryViewObject(anaEleProperty);
        } else {
            // $NON-NLS-1$//$NON-NLS-2$
            log.error("Analysis [" + analysis.getName() + "] is proxy");
        }
        if (null == viewObject) {
            continue;
        }
        // ~TDQ-3301
        ReportAnalysisRepNode node = new ReportAnalysisRepNode(viewObject, this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
        node.setReport(this.getReport());
        node.setId(this.getReport().getName() + analysis.getName());
        nodes.add(node);
    }
    // MOD qiongli TDQ-4773,should clear outside the "if" conditon.
    this.getReportSubFolderChildren().clear();
    if (nodes.size() > 0) {
        this.getReportSubFolderChildren().addAll(nodes);
    }
    return this.getReportSubFolderChildren();
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) Analysis(org.talend.dataquality.analysis.Analysis) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Property(org.talend.core.model.properties.Property) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject)

Example 54 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class AnalysisSubFolderRepNode method getCount.

public String getCount() {
    IRepositoryViewObject anaViewObject = this.getParent().getObject();
    if (anaViewObject.getProperty() != null) {
        TDQAnalysisItem item = (TDQAnalysisItem) anaViewObject.getProperty().getItem();
        Analysis analysis = item.getAnalysis();
        AnalysisContext context = analysis.getContext();
        EList<ModelElement> analysedElements = context.getAnalysedElements();
        if (analysedElements.size() == 1) {
            ModelElement modelElement = analysedElements.get(0);
            if (modelElement instanceof DatabaseConnection) {
                EList<Package> dataPackage = ((DatabaseConnection) modelElement).getDataPackage();
                // $NON-NLS-1$ //$NON-NLS-2$
                return "(" + dataPackage.size() + ")";
            }
        }
        // $NON-NLS-1$ //$NON-NLS-2$
        return "(" + analysedElements.size() + ")";
    }
    // $NON-NLS-1$
    return "(0)";
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) Analysis(org.talend.dataquality.analysis.Analysis) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext) Package(orgomg.cwm.objectmodel.core.Package) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 55 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class AnalysisWriter method removeDependencies.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dq.writer.AElementPersistance#removeDependencies(org.talend.core.model.properties.Item)
     */
@Override
protected ReturnCode removeDependencies(Item item) {
    ReturnCode rc = new ReturnCode();
    TDQAnalysisItem anaItem = (TDQAnalysisItem) item;
    Analysis analysis = anaItem.getAnalysis();
    List<Property> clintDependency = DependenciesHandler.getInstance().getClintDependency(anaItem.getProperty());
    List<ModelElement> clientDepListByResultList = DependenciesHandler.getInstance().getClientDepListByResult(analysis);
    for (Property currentClient : clintDependency) {
        ModelElement modelElement = PropertyHelper.getModelElement(currentClient);
        if (!clientDepListByResultList.contains(modelElement)) {
            boolean isSuccess = DependenciesHandler.getInstance().removeDependenciesBetweenModel(analysis, modelElement);
            if (isSuccess) {
                try {
                    ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().saveResource(modelElement.eResource());
                } catch (PersistenceException e) {
                    log.error(e, e);
                    rc.setOk(false);
                    rc.setMessage(e.getMessage());
                }
            } else {
                rc.setOk(false);
                rc.setMessage(// $NON-NLS-1$
                Messages.getString(// $NON-NLS-1$
                "AnalysisWriter.CanNotFindDependencyElement", // $NON-NLS-1$
                analysis.getName(), modelElement.getName()));
            }
        }
    }
    return rc;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) TypedReturnCode(org.talend.utils.sugars.TypedReturnCode) ReturnCode(org.talend.utils.sugars.ReturnCode) Analysis(org.talend.dataquality.analysis.Analysis) PersistenceException(org.talend.commons.exception.PersistenceException) Property(org.talend.core.model.properties.Property) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Aggregations

Analysis (org.talend.dataquality.analysis.Analysis)137 Test (org.junit.Test)36 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)36 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)30 ArrayList (java.util.ArrayList)28 Property (org.talend.core.model.properties.Property)28 Indicator (org.talend.dataquality.indicators.Indicator)27 TDQAnalysisItem (org.talend.dataquality.properties.TDQAnalysisItem)27 AnalysisResult (org.talend.dataquality.analysis.AnalysisResult)26 PersistenceException (org.talend.commons.exception.PersistenceException)19 Connection (org.talend.core.model.metadata.builder.connection.Connection)18 ReturnCode (org.talend.utils.sugars.ReturnCode)18 Dependency (orgomg.cwm.objectmodel.core.Dependency)18 TdColumn (org.talend.cwm.relational.TdColumn)16 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)16 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)15 Pattern (org.talend.dataquality.domain.pattern.Pattern)15 IFile (org.eclipse.core.resources.IFile)14 File (java.io.File)12 IPath (org.eclipse.core.runtime.IPath)12