Search in sources :

Example 96 with IndicatorDefinition

use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.

the class UDIUtils method createUdiCheckedTreeSelectionDialog.

/**
 * DOC xqliu Comment method "createUdiCheckedTreeSelectionDialog".
 *
 * @param meIndicator
 * @return
 */
public static CheckedTreeSelectionDialog createUdiCheckedTreeSelectionDialog(ModelElementIndicator meIndicator) {
    CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(null, new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
    dialog.addFilter(new FolderObjFilter());
    DQRepositoryNode udiDialogInputData = AnalysisUtils.getSelectDialogInputData(EResourceConstant.USER_DEFINED_INDICATORS);
    dialog.setInput(udiDialogInputData);
    dialog.setValidator(new ISelectionStatusValidator() {

        public IStatus validate(Object[] selection) {
            for (Object patte : selection) {
                if (patte instanceof SysIndicatorDefinitionRepNode) {
                    SysIndicatorDefinitionRepNode udiNode = (SysIndicatorDefinitionRepNode) patte;
                    IndicatorDefinition indicatorDefinition = udiNode.getIndicatorDefinition();
                    boolean validStatus = TaggedValueHelper.getValidStatus(indicatorDefinition);
                    if (!validStatus) {
                        return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString(// $NON-NLS-1$
                        "AnalysisColumnTreeViewer.chooseValidUdis"));
                    }
                }
            }
            return new // $NON-NLS-1$
            Status(// $NON-NLS-1$
            IStatus.OK, // $NON-NLS-1$
            PlatformUI.PLUGIN_ID, // $NON-NLS-1$
            IStatus.OK, // $NON-NLS-1$
            "", null);
        }
    });
    dialog.setContainerMode(true);
    dialog.setInitialSelections(getUDIFilesByIndicator(udiDialogInputData, meIndicator));
    // $NON-NLS-1$
    dialog.setTitle(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udiSelector"));
    // $NON-NLS-1$
    dialog.setMessage(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udis"));
    dialog.setSize(80, 30);
    return dialog;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) FolderObjFilter(org.talend.dataprofiler.core.ui.filters.FolderObjFilter) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) DQRepositoryViewLabelProvider(org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider)

Example 97 with IndicatorDefinition

use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.

the class FileSystemImportWriter method checkDependency.

/**
 * DOC bZhou Comment method "checkDependency".
 *
 * @param record
 */
private void checkDependency(ItemRecord record) {
    for (File depFile : record.getDependencySet()) {
        ModelElement melement = ItemRecord.getElement(depFile);
        if (melement != null && melement.eIsProxy()) {
            // TDQ-12410: if the dependency comes from reference project, we ingore it.
            if (!DqFileUtils.isFileUnderBasePath(depFile, getBasePath())) {
                continue;
            }
            // Indicator, don't add it into errors even if it is not exist
            if (melement instanceof IndicatorDefinition) {
                String uuid = ResourceHelper.getUUID(melement);
                if (IndicatorDefinitionFileHelper.isTechnialIndicator(uuid)) {
                    continue;
                }
            }
            InternalEObject inObject = (InternalEObject) melement;
            // $NON-NLS-1$ //$NON-NLS-2$
            record.addError("\"" + record.getName() + "\" missing dependented file : " + inObject.eProxyURI().toFileString());
        }
    }
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IFile(org.eclipse.core.resources.IFile) File(java.io.File) UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 98 with IndicatorDefinition

use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.

the class ImportWizardPage method getElements.

/**
 * DOC bZhou Comment method "getElements".
 *
 * @return
 */
public ItemRecord[] getElements() {
    List<ItemRecord> itemRecords = new ArrayList<ItemRecord>();
    Object[] checkedElements = repositoryTree.getCheckedElements();
    for (Object obj : checkedElements) {
        if (obj instanceof ItemRecord) {
            ItemRecord record = (ItemRecord) obj;
            // MOD qiongli 2012-4-20,add related subreport jrxml/jasper file to elements.
            File file = record.getFile();
            if (file.isFile()) {
                itemRecords.add(record);
                if (file.getName().endsWith(FactoriesUtil.JRXML)) {
                    addSubRepToElements(record, itemRecords);
                }
                // if it is Mean Indicator, import it's dependency Sum Indicator also
                // $NON-NLS-1$
                String meanIndicatorUuid = "_ccI48RF2Ed2PKb6nEJEvhw";
                ModelElement element = record.getElement();
                if (element != null && element instanceof IndicatorDefinition && meanIndicatorUuid.equals(ResourceHelper.getUUID(element))) {
                    File sumIndicatorFile = getSumIndicatorFile(element);
                    if (sumIndicatorFile != null) {
                        itemRecords.add(new ItemRecord(sumIndicatorFile, record.getRootFolderPath()));
                    }
                }
            }
        }
    }
    return itemRecords.toArray(new ItemRecord[itemRecords.size()]);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) ItemRecord(org.talend.dataprofiler.core.ui.imex.model.ItemRecord) ArrayList(java.util.ArrayList) File(java.io.File) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition)

Example 99 with IndicatorDefinition

use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.

the class UDIHelperTest method testContainsJavaUDI1.

/**
 * Test method for
 * {@link org.talend.dq.helper.UDIHelper#containsJavaUDI(org.talend.dataquality.indicators.definition.IndicatorDefinition)}
 * .
 */
@Test
public void testContainsJavaUDI1() {
    // prepare data
    IndicatorDefinition javaIndicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
    // $NON-NLS-1$
    TaggedValue calssNameTaggedValue = TaggedValueHelper.createTaggedValue(TaggedValueHelper.CLASS_NAME_TEXT, "calssName");
    // $NON-NLS-1$
    TaggedValue jarPathTaggedValue = TaggedValueHelper.createTaggedValue(TaggedValueHelper.CLASS_NAME_TEXT, "jarPath");
    javaIndicatorDefinition.getTaggedValue().add(calssNameTaggedValue);
    javaIndicatorDefinition.getTaggedValue().add(jarPathTaggedValue);
    // testMethod
    assertTrue(UDIHelper.containsJavaUDI(javaIndicatorDefinition));
}
Also used : TaggedValue(orgomg.cwm.objectmodel.core.TaggedValue) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) Test(org.junit.Test)

Example 100 with IndicatorDefinition

use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.

the class UDIHelperTest method testContainsJavaUDI2.

/**
 * Test method for
 * {@link org.talend.dq.helper.UDIHelper#containsJavaUDI(org.talend.dataquality.indicators.definition.IndicatorDefinition)}
 * .
 */
@Test
public void testContainsJavaUDI2() {
    // prepare data
    IndicatorDefinition javaIndicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
    // $NON-NLS-1$
    TaggedValue calssNameTaggedValue = TaggedValueHelper.createTaggedValue(TaggedValueHelper.CLASS_NAME_TEXT, "calssName");
    javaIndicatorDefinition.getTaggedValue().add(calssNameTaggedValue);
    // testMethod
    assertFalse(UDIHelper.containsJavaUDI(javaIndicatorDefinition));
}
Also used : TaggedValue(orgomg.cwm.objectmodel.core.TaggedValue) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) Test(org.junit.Test)

Aggregations

IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)141 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)37 Test (org.junit.Test)35 ArrayList (java.util.ArrayList)34 TdExpression (org.talend.cwm.relational.TdExpression)31 File (java.io.File)22 Analysis (org.talend.dataquality.analysis.Analysis)16 IFile (org.eclipse.core.resources.IFile)15 Property (org.talend.core.model.properties.Property)14 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)14 TDQIndicatorDefinitionItem (org.talend.dataquality.properties.TDQIndicatorDefinitionItem)14 PersistenceException (org.talend.commons.exception.PersistenceException)13 Indicator (org.talend.dataquality.indicators.Indicator)12 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)12 Path (org.eclipse.core.runtime.Path)10 IFolder (org.eclipse.core.resources.IFolder)9 BasicEList (org.eclipse.emf.common.util.BasicEList)9 TdColumn (org.talend.cwm.relational.TdColumn)9 UserDefIndicator (org.talend.dataquality.indicators.sql.UserDefIndicator)7 TDQAnalysisItem (org.talend.dataquality.properties.TDQAnalysisItem)7