Search in sources :

Example 6 with TDQAnalysisItem

use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.

the class EMFSharedResourcesTest method createRealAnalysis.

private Item createRealAnalysis(String name, IFolder folder, Boolean isDelete) {
    IPath createPath = Path.EMPTY;
    if (folder != null) {
        createPath = new Path(folder.getFullPath().lastSegment());
    }
    Analysis analysis1 = AnalysisHelper.createAnalysis(name);
    TDQAnalysisItem item1 = PropertiesFactoryImpl.eINSTANCE.createTDQAnalysisItem();
    org.talend.core.model.properties.Property property1 = PropertiesFactory.eINSTANCE.createProperty();
    property1.setId(EcoreUtil.generateUUID());
    property1.setItem(item1);
    property1.setLabel(analysis1.getName());
    item1.setProperty(property1);
    item1.setAnalysis(analysis1);
    ItemState itemState = org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createItemState();
    itemState.setDeleted(isDelete);
    item1.setState(itemState);
    AnalysisResult analysisResult1 = AnalysisFactory.eINSTANCE.createAnalysisResult();
    analysis1.setResults(analysisResult1);
    try {
        ProxyRepositoryFactory.getInstance().create(item1, createPath, false);
    } catch (PersistenceException e) {
        fail(e.getMessage());
    }
    return item1;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) Analysis(org.talend.dataquality.analysis.Analysis) ItemState(org.talend.core.model.properties.ItemState) PersistenceException(org.talend.commons.exception.PersistenceException) AnalysisResult(org.talend.dataquality.analysis.AnalysisResult) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 7 with TDQAnalysisItem

use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.

the class UnitTestBuildHelper method createRealAnalysis.

/**
 * DOC qiongli Comment method "createRealAnalysis".
 *
 * @param name
 * @param folder
 * @param isDelete
 * @return
 */
public static Analysis createRealAnalysis(String name, IFolder folder, Boolean isDelete) {
    IPath createPath = Path.EMPTY;
    if (folder != null) {
        createPath = new Path(folder.getFullPath().lastSegment());
    }
    Analysis analysis1 = AnalysisHelper.createAnalysis(name);
    TDQAnalysisItem item1 = PropertiesFactoryImpl.eINSTANCE.createTDQAnalysisItem();
    org.talend.core.model.properties.Property property1 = PropertiesFactory.eINSTANCE.createProperty();
    property1.setId(EcoreUtil.generateUUID());
    property1.setItem(item1);
    property1.setLabel(analysis1.getName());
    item1.setProperty(property1);
    item1.setAnalysis(analysis1);
    ItemState itemState = org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createItemState();
    itemState.setDeleted(isDelete);
    item1.setState(itemState);
    AnalysisResult analysisResult1 = AnalysisFactory.eINSTANCE.createAnalysisResult();
    analysis1.setResults(analysisResult1);
    try {
        ProxyRepositoryFactory.getInstance().create(item1, createPath, false);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    return analysis1;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) Analysis(org.talend.dataquality.analysis.Analysis) ItemState(org.talend.core.model.properties.ItemState) PersistenceException(org.talend.commons.exception.PersistenceException) Property(org.talend.core.model.properties.Property) AnalysisResult(org.talend.dataquality.analysis.AnalysisResult) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 8 with TDQAnalysisItem

use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.

the class ResourceViewLabelProviderTest method createAnalysis.

private void createAnalysis(String name, IPath createPath, Boolean isDelete) {
    Analysis analysis1 = AnalysisHelper.createAnalysis(name);
    TDQAnalysisItem item1 = PropertiesFactoryImpl.eINSTANCE.createTDQAnalysisItem();
    org.talend.core.model.properties.Property property1 = PropertiesFactory.eINSTANCE.createProperty();
    property1.setId(EcoreUtil.generateUUID());
    property1.setItem(item1);
    property1.setLabel(analysis1.getName());
    item1.setProperty(property1);
    item1.setAnalysis(analysis1);
    ItemState itemState = org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createItemState();
    itemState.setDeleted(isDelete);
    item1.setState(itemState);
    AnalysisResult analysisResult1 = AnalysisFactory.eINSTANCE.createAnalysisResult();
    analysis1.setResults(analysisResult1);
    try {
        ProxyRepositoryFactory.getInstance().create(item1, createPath, false);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
}
Also used : Analysis(org.talend.dataquality.analysis.Analysis) ItemState(org.talend.core.model.properties.ItemState) PersistenceException(org.talend.commons.exception.PersistenceException) AnalysisResult(org.talend.dataquality.analysis.AnalysisResult) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 9 with TDQAnalysisItem

use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.

the class PropertyHelper method getModelElement.

/**
 * DOC bZhou Comment method "getModelElement".
 *
 * Get model element from property recognized by current system.
 *
 * @param property
 * @return
 */
public static ModelElement getModelElement(Property property) {
    Item item = property.getItem();
    assert item != null;
    ModelElement element = (ModelElement) new org.talend.core.model.properties.util.PropertiesSwitch() {

        @Override
        public Object caseDatabaseConnectionItem(DatabaseConnectionItem object) {
            return object.getConnection();
        }

        @Override
        public Object caseMDMConnectionItem(MDMConnectionItem object) {
            return object.getConnection();
        }

        @Override
        public Object caseDelimitedFileConnectionItem(DelimitedFileConnectionItem object) {
            return object.getConnection();
        }
    }.doSwitch(item);
    if (element == null) {
        element = new org.talend.dataquality.properties.util.PropertiesSwitch<ModelElement>() {

            @Override
            public ModelElement caseTDQReportItem(TDQReportItem object) {
                return object.getReport();
            }

            @Override
            public ModelElement caseTDQAnalysisItem(TDQAnalysisItem object) {
                return object.getAnalysis();
            }

            @Override
            public ModelElement caseTDQBusinessRuleItem(TDQBusinessRuleItem object) {
                return object.getDqrule();
            }

            /*
                 * (non-Javadoc)
                 * 
                 * @see
                 * org.talend.dataquality.properties.util.PropertiesSwitch#caseTDQMatchRuleItem(org.talend.dataquality
                 * .properties.TDQMatchRuleItem)
                 */
            @Override
            public ModelElement caseTDQMatchRuleItem(TDQMatchRuleItem object) {
                return object.getMatchRule();
            }

            @Override
            public ModelElement caseTDQIndicatorDefinitionItem(TDQIndicatorDefinitionItem object) {
                return object.getIndicatorDefinition();
            }

            @Override
            public ModelElement caseTDQPatternItem(TDQPatternItem object) {
                return object.getPattern();
            }
        }.doSwitch(item);
    }
    return element;
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) MDMConnectionItem(org.talend.core.model.properties.MDMConnectionItem) TDQPatternItem(org.talend.dataquality.properties.TDQPatternItem) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) DelimitedFileConnectionItem(org.talend.core.model.properties.DelimitedFileConnectionItem) Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem) TDQItem(org.talend.core.model.properties.TDQItem) TDQPatternItem(org.talend.dataquality.properties.TDQPatternItem) MDMConnectionItem(org.talend.core.model.properties.MDMConnectionItem) TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) TDQBusinessRuleItem(org.talend.dataquality.properties.TDQBusinessRuleItem) TDQReportItem(org.talend.dataquality.properties.TDQReportItem) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) TDQBusinessRuleItem(org.talend.dataquality.properties.TDQBusinessRuleItem) DelimitedFileConnectionItem(org.talend.core.model.properties.DelimitedFileConnectionItem) TDQReportItem(org.talend.dataquality.properties.TDQReportItem) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 10 with TDQAnalysisItem

use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.

the class RespositoryDetailView method createTechnicalDetail.

private void createTechnicalDetail(IRepositoryViewObject reposViewObj) {
    // MOD klliu the DQRepositoryview unified with tos, so refactor as follow bug 19154 2011-02-28
    if (reposViewObj.getProperty() != null) {
        Item item = reposViewObj.getProperty().getItem();
        if (item instanceof ConnectionItem) {
            Connection conn = ((ConnectionItem) item).getConnection();
            createTechnicalDetail(conn);
        } else if (item instanceof TDQAnalysisItem) {
            Analysis analysis = ((TDQAnalysisItem) item).getAnalysis();
            createTechnicalDetail(analysis);
        } else if (item instanceof TDQPatternItem) {
            Pattern pattern = ((TDQPatternItem) item).getPattern();
            createTechnicalDetail(pattern);
        } else if (item instanceof TDQReportItem) {
            Report report = ((TDQReportItem) item).getReport();
            createTechnicalDetail(report);
        }
    }
}
Also used : ContextItem(org.talend.core.model.properties.ContextItem) Item(org.talend.core.model.properties.Item) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) TDQPatternItem(org.talend.dataquality.properties.TDQPatternItem) TDQReportItem(org.talend.dataquality.properties.TDQReportItem) Pattern(org.talend.dataquality.domain.pattern.Pattern) Report(orgomg.cwmx.analysis.informationreporting.Report) TdReport(org.talend.dataquality.reports.TdReport) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Analysis(org.talend.dataquality.analysis.Analysis) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) FileConnection(org.talend.core.model.metadata.builder.connection.FileConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) TDQPatternItem(org.talend.dataquality.properties.TDQPatternItem) TDQReportItem(org.talend.dataquality.properties.TDQReportItem) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Aggregations

TDQAnalysisItem (org.talend.dataquality.properties.TDQAnalysisItem)33 Analysis (org.talend.dataquality.analysis.Analysis)26 PersistenceException (org.talend.commons.exception.PersistenceException)17 Property (org.talend.core.model.properties.Property)14 AnalysisResult (org.talend.dataquality.analysis.AnalysisResult)14 Item (org.talend.core.model.properties.Item)11 ItemState (org.talend.core.model.properties.ItemState)11 Path (org.eclipse.core.runtime.Path)9 Test (org.junit.Test)9 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)9 TDQIndicatorDefinitionItem (org.talend.dataquality.properties.TDQIndicatorDefinitionItem)9 TDQReportItem (org.talend.dataquality.properties.TDQReportItem)9 IPath (org.eclipse.core.runtime.IPath)7 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)7 TDQPatternItem (org.talend.dataquality.properties.TDQPatternItem)7 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)6 ReturnCode (org.talend.utils.sugars.ReturnCode)6 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)6 TDQBusinessRuleItem (org.talend.dataquality.properties.TDQBusinessRuleItem)5 TdReport (org.talend.dataquality.reports.TdReport)5