Search in sources :

Example 1 with AnalysisHandler

use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.

the class RedundancyAnalysisDetailsPage method getAnalysisHandler.

public AnalysisHandler getAnalysisHandler() {
    AnalysisHandler analysisHandler = new AnalysisHandler();
    analysisHandler.setAnalysis(getCurrentModelElement());
    return analysisHandler;
}
Also used : AnalysisHandler(org.talend.dq.analysis.AnalysisHandler)

Example 2 with AnalysisHandler

use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.

the class AbstractFilterMetadataPage method getAnalysisHandler.

@Override
public AnalysisHandler getAnalysisHandler() {
    AnalysisHandler analysisHandler = new AnalysisHandler();
    analysisHandler.setAnalysis(getCurrentModelElement());
    return analysisHandler;
}
Also used : AnalysisHandler(org.talend.dq.analysis.AnalysisHandler)

Example 3 with AnalysisHandler

use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.

the class MatchWizardTest method testInitCWMResourceBuilder.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.wizard.analysis.column.MatchWizard#initCWMResourceBuilder()}.
 */
@Test
public void testInitCWMResourceBuilder() {
    AnalysisParameter anaParameter = new AnalysisParameter();
    // $NON-NLS-1$
    anaParameter.setName("analysis1");
    anaParameter.setAnalysisTypeName(AnalysisType.COLUMN.getName());
    MatchWizard matchWizard = new MatchWizard(anaParameter);
    // Default value should be 10000
    Analysis ana = (Analysis) matchWizard.initCWMResourceBuilder();
    AnalysisHandler anaHandler = AnalysisHandler.createHandler(ana);
    IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
    int maxRows = preferenceStore.getInt(PluginConstant.MAX_NB_ROWS_ANALYSIS_EDITOR);
    Assert.assertEquals(String.valueOf(maxRows), anaHandler.getDefaultLoadedRowCount());
    // after setting the value, result should be changed too
    // $NON-NLS-1$
    String rowCountValue = "100";
    TaggedValueHelper.setTaggedValue(ana, TaggedValueHelper.PREVIEW_ROW_NUMBER, rowCountValue);
    anaHandler = AnalysisHandler.createHandler(ana);
    Assert.assertEquals(rowCountValue, anaHandler.getDefaultLoadedRowCount());
}
Also used : AnalysisHandler(org.talend.dq.analysis.AnalysisHandler) Analysis(org.talend.dataquality.analysis.Analysis) AnalysisParameter(org.talend.dq.analysis.parameters.AnalysisParameter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Test(org.junit.Test)

Example 4 with AnalysisHandler

use of org.talend.dq.analysis.AnalysisHandler 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 5 with AnalysisHandler

use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.

the class TdqAnalysisConnectionPoolTest method setUp.

/**
 * DOC yyin Comment method "setUp".
 *
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
    analysis = mock(Analysis.class);
    AnalysisContext context = mock(AnalysisContext.class);
    AnalysisResult result = mock(AnalysisResult.class);
    dataManager = mock(org.talend.core.model.metadata.builder.connection.Connection.class);
    ExecutionInformations resultMetadata = mock(ExecutionInformations.class);
    PowerMockito.mockStatic(AnalysisHandler.class);
    AnalysisHandler mockHandler = mock(AnalysisHandler.class);
    when(AnalysisHandler.createHandler(analysis)).thenReturn(mockHandler);
    when(mockHandler.getNumberOfConnectionsPerAnalysis()).thenReturn(5);
    when(context.getConnection()).thenReturn(dataManager);
    when(analysis.getContext()).thenReturn(context);
    when(analysis.getResults()).thenReturn(result);
    when(result.getResultMetadata()).thenReturn(resultMetadata);
    connPool = new TdqAnalysisConnectionPool(analysis, 5);
}
Also used : ExecutionInformations(org.talend.dataquality.analysis.ExecutionInformations) AnalysisHandler(org.talend.dq.analysis.AnalysisHandler) Analysis(org.talend.dataquality.analysis.Analysis) Connection(java.sql.Connection) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext) AnalysisResult(org.talend.dataquality.analysis.AnalysisResult) Before(org.junit.Before)

Aggregations

AnalysisHandler (org.talend.dq.analysis.AnalysisHandler)5 Analysis (org.talend.dataquality.analysis.Analysis)3 Connection (java.sql.Connection)1 IFile (org.eclipse.core.resources.IFile)1 IFolder (org.eclipse.core.resources.IFolder)1 CoreException (org.eclipse.core.runtime.CoreException)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Item (org.talend.core.model.properties.Item)1 Property (org.talend.core.model.properties.Property)1 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)1 AnalysisResult (org.talend.dataquality.analysis.AnalysisResult)1 ExecutionInformations (org.talend.dataquality.analysis.ExecutionInformations)1 Pattern (org.talend.dataquality.domain.pattern.Pattern)1 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)1 AnalysisParameter (org.talend.dq.analysis.parameters.AnalysisParameter)1