Search in sources :

Example 31 with Pattern

use of org.talend.dataquality.domain.pattern.Pattern in project tdq-studio-se by Talend.

the class RespositoryDetailView method createFileDetail.

private boolean createFileDetail(boolean is, IFile fe2) {
    if (fe2.getFileExtension().equals(FactoriesUtil.PATTERN)) {
        Pattern pattern = PatternResourceFileHelper.getInstance().findPattern(fe2);
        createPatternDetail(pattern);
        is = false;
    } else if (fe2.getFileExtension().equals(FactoriesUtil.ANA)) {
        Analysis ana = AnaResourceFileHelper.getInstance().findAnalysis(fe2);
        createAnaysisDetail(ana);
        is = false;
    } else if (fe2.getFileExtension().equals(FactoriesUtil.REP)) {
        TdReport rep = RepResourceFileHelper.getInstance().findReport(fe2);
        createReportDetail(rep);
        is = false;
    } else if (fe2.getFileExtension().equals(FactoriesUtil.SQL)) {
        createSqlFileDetail(fe2);
        is = false;
    }
    return is;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) Analysis(org.talend.dataquality.analysis.Analysis) TdReport(org.talend.dataquality.reports.TdReport)

Example 32 with Pattern

use of org.talend.dataquality.domain.pattern.Pattern 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)

Example 33 with Pattern

use of org.talend.dataquality.domain.pattern.Pattern in project tdq-studio-se by Talend.

the class ResourceViewLabelProvider method decorateImage.

@Override
protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) {
    ImageDescriptor image = super.decorateImage(input, element);
    if (element instanceof IFile) {
        IFile file = (IFile) element;
        String fileExtension = file.getFileExtension();
        // MOD qiongli 2010-9-7,bug 14698,add 'try...catch'
        try {
            if (FactoriesUtil.isPatternFile(fileExtension)) {
                image = ImageLib.getImageDescriptor(ImageLib.PATTERN_REG);
                Pattern pattern = PatternResourceFileHelper.getInstance().findPattern(file);
                if (pattern != null) {
                    if (!TaggedValueHelper.getValidStatus(pattern)) {
                        image = ImageLib.createInvalidIconDes(ImageLib.PATTERN_REG);
                    }
                }
            } else if (FactoriesUtil.isReportFile(fileExtension)) {
                image = ImageLib.getImageDescriptor(ImageLib.REPORT_OBJECT);
            } else if (FactoriesUtil.isUDIFile(fileExtension)) {
                image = ImageLib.getImageDescriptor(ImageLib.IND_DEFINITION);
                IndicatorDefinition udi = IndicatorResourceFileHelper.getInstance().findIndDefinition(file);
                if (udi != null) {
                    boolean validStatus = TaggedValueHelper.getValidStatus(udi) | UDIHelper.isUDIValid(udi);
                    if (!validStatus) {
                        image = ImageLib.createInvalidIconDes(ImageLib.IND_DEFINITION);
                    }
                }
            } else if (FactoriesUtil.isAnalysisFile(fileExtension)) {
                // ADD qiongli 2010-8-9,feature 14252
                Analysis analysis = AnaResourceFileHelper.getInstance().findAnalysis(file);
                if (analysis != null) {
                    AnalysisHandler analysisHandler = new AnalysisHandler();
                    analysisHandler.setAnalysis(analysis);
                    if (analysisHandler.getResultMetadata().getExecutionNumber() != 0) {
                        if (!analysisHandler.getResultMetadata().isLastRunOk()) {
                            image = ImageLib.createErrorIcon(image);
                        } else if (analysisHandler.getResultMetadata().isOutThreshold()) {
                            image = ImageLib.createInvalidIcon(image);
                        }
                    }
                }
            }
        } catch (Exception exc) {
            log.error(exc, exc);
            image = ImageLib.getImageDescriptor(ImageLib.DELETE_ACTION);
        }
        if (FactoriesUtil.isEmfFile(fileExtension)) {
            Property property = PropertyHelper.getProperty(file);
            if (property != null) {
                Item item = property.getItem();
                Boolean lockByOthers = ProxyRepositoryManager.getInstance().isLockByOthers(item);
                Boolean lockByUserOwn = ProxyRepositoryManager.getInstance().isLockByUserOwn(item);
                if (lockByOthers || lockByUserOwn) {
                    // $NON-NLS-1$
                    log.info(property.getLabel() + " is locked");
                    image = ImageLib.createLockedIcon(image);
                }
            }
        }
    } else if (element instanceof IFolder) {
        IFolder folder = (IFolder) element;
        if (ResourceManager.isMetadataFolder(folder)) {
            image = ImageLib.getImageDescriptor(ImageLib.METADATA);
        } else if (ResourceManager.isLibrariesFolder(folder)) {
            image = ImageLib.getImageDescriptor(ImageLib.LIBRARIES);
        } else if (ResourceManager.isDataProfilingFolder(folder)) {
            image = ImageLib.getImageDescriptor(ImageLib.DATA_PROFILING);
        } else if (ResourceManager.isDBConnectionFolder(folder)) {
            image = ImageLib.getImageDescriptor(ImageLib.CONNECTION);
        } else if (ResourceManager.isExchangeFolder(folder)) {
            image = ImageLib.getImageDescriptor(ImageLib.EXCHANGE);
        } else if (ResourceManager.isFileDelimitedFolder(folder)) {
            image = ImageLib.getImageDescriptor(ImageLib.FILE_DELIMITED);
        }
    }
    return image;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) AnalysisHandler(org.talend.dq.analysis.AnalysisHandler) IFile(org.eclipse.core.resources.IFile) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) CoreException(org.eclipse.core.runtime.CoreException) Item(org.talend.core.model.properties.Item) Analysis(org.talend.dataquality.analysis.Analysis) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Property(org.talend.core.model.properties.Property) IFolder(org.eclipse.core.resources.IFolder)

Example 34 with Pattern

use of org.talend.dataquality.domain.pattern.Pattern in project tdq-studio-se by Talend.

the class PatternRepNode method getChildren.

@Override
public List<IRepositoryNode> getChildren() {
    List<IRepositoryNode> languageElement = new ArrayList<IRepositoryNode>();
    IRepositoryViewObject object = this.getObject();
    TDQPatternItem patternItem = (TDQPatternItem) object.getProperty().getItem();
    Pattern pattern = patternItem.getPattern();
    EList<PatternComponent> components = pattern.getComponents();
    for (PatternComponent component : components) {
        RegularExpression re = (RegularExpression) component;
        Expression expression = re.getExpression();
        String language = expression.getLanguage();
        PatternLanguageRepNode plrn = new PatternLanguageRepNode(this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
        plrn.setRegularExpression(re);
        plrn.setId(language);
        plrn.setLabel(language);
        languageElement.add(plrn);
    }
    // MOD gdbu 2011-7-11 bug : 22204
    return filterResultsIfAny(languageElement);
// ~22204
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Expression(orgomg.cwm.objectmodel.core.Expression) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PatternComponent(org.talend.dataquality.domain.pattern.PatternComponent) TDQPatternItem(org.talend.dataquality.properties.TDQPatternItem)

Example 35 with Pattern

use of org.talend.dataquality.domain.pattern.Pattern in project tdq-studio-se by Talend.

the class IndicatorTreeModelBuilder method createLeafNode.

/**
 * Create leafNode by the type of indiEnum
 *
 * @param label
 * @param indiEnum
 * @return
 */
private static IIndicatorNode createLeafNode(String label, IndicatorEnum indiEnum, ModelElement modelElement) {
    IIndicatorNode indicatorNode = null;
    if (IndicatorEnum.RegexpMatchingIndicatorEnum == indiEnum || IndicatorEnum.SqlPatternMatchingIndicatorEnum == indiEnum) {
        indicatorNode = new PatternNode(label, (Pattern) modelElement);
    } else if (IndicatorEnum.UserDefinedIndicatorEnum == indiEnum) {
        indicatorNode = new UDINode(label);
    } else {
        return indicatorNode;
    }
    indicatorNode.setIndicatorEnum(indiEnum);
    return indicatorNode;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) PatternNode(org.talend.dq.nodes.indicator.impl.PatternNode) UDINode(org.talend.dq.nodes.indicator.impl.UDINode)

Aggregations

Pattern (org.talend.dataquality.domain.pattern.Pattern)75 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)27 Test (org.junit.Test)19 TdExpression (org.talend.cwm.relational.TdExpression)18 Domain (org.talend.dataquality.domain.Domain)16 Analysis (org.talend.dataquality.analysis.Analysis)15 PatternComponent (org.talend.dataquality.domain.pattern.PatternComponent)15 IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)14 ArrayList (java.util.ArrayList)13 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)13 IFile (org.eclipse.core.resources.IFile)11 TDQPatternItem (org.talend.dataquality.properties.TDQPatternItem)10 Expression (orgomg.cwm.objectmodel.core.Expression)10 IFolder (org.eclipse.core.resources.IFolder)9 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)9 Indicator (org.talend.dataquality.indicators.Indicator)9 Item (org.talend.core.model.properties.Item)7 TdColumn (org.talend.cwm.relational.TdColumn)7 RegexpMatchingIndicator (org.talend.dataquality.indicators.RegexpMatchingIndicator)6 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)6