use of org.talend.dataprofiler.core.model.DelimitedFileIndicator in project tdq-studio-se by Talend.
the class IndicatorSelectDialog method isMatchCurrentIndicator.
public boolean isMatchCurrentIndicator(ModelElementIndicator currentIndicator, IIndicatorNode indicatorNode) {
boolean returnValueForCurrentIndicator = true;
IIndicatorNode parentNode = indicatorNode.getParent();
boolean isParentPhoneStatistics = parentNode != null && parentNode.getIndicatorInstance() != null && parentNode.getIndicatorInstance() instanceof PhoneNumbStatisticsIndicator;
if (!ModelElementIndicatorRule.match(indicatorNode, currentIndicator, this.language)) {
returnValueForCurrentIndicator = false;
}
Indicator indicatorInstance = indicatorNode.getIndicatorInstance();
if (null != indicatorInstance && !(indicatorInstance instanceof DatePatternFreqIndicator) && null != indicatorInstance.getIndicatorDefinition() && indicatorInstance.getIndicatorDefinition().getSqlGenericExpression().size() < 1 && ExecutionLanguage.SQL.equals(language) && !UDIHelper.isJavaUDI(indicatorInstance) && !indicatorNode.hasChildren() && !(currentIndicator instanceof DelimitedFileIndicator) && !isParentPhoneStatistics) {
returnValueForCurrentIndicator = false;
}
return returnValueForCurrentIndicator;
}
use of org.talend.dataprofiler.core.model.DelimitedFileIndicator in project tdq-studio-se by Talend.
the class ModelElementIndicatorHelper method getColumn.
/**
* Get column from modelElementIndicator
*
* @param modelElementIndicator
* @return MetadataColumn if convert is normal else return null
*/
public static final MetadataColumn getColumn(ModelElementIndicator modelElementIndicator) {
if (modelElementIndicator == null) {
return null;
}
ColumnIndicator switchColumnIndicator = switchColumnIndicator(modelElementIndicator);
if (switchColumnIndicator != null) {
return switchColumnIndicator.getTdColumn();
}
// TDQ-10198: support Delimited File connection column
DelimitedFileIndicator switchDelimitedFileIndicator = switchDelimitedFileIndicator(modelElementIndicator);
if (switchDelimitedFileIndicator != null) {
return switchDelimitedFileIndicator.getMetadataColumn();
}
return null;
}
use of org.talend.dataprofiler.core.model.DelimitedFileIndicator in project tdq-studio-se by Talend.
the class AnalysisColumnTreeViewer method addItemElements.
private void addItemElements(final ModelElementIndicator[] elements, boolean isExpandAll) {
for (ModelElementIndicator element : elements) {
final TreeItem treeItem = new TreeItem(tree, SWT.NONE);
treeItem.setImage(ImageLib.getImage(ImageLib.TD_COLUMN));
final ModelElementIndicator meIndicator = element;
treeItem.setText(0, ModelElementIndicatorHelper.getModelElementDisplayName(meIndicator));
treeItem.setData(MODELELEMENT_INDICATOR_KEY, meIndicator);
TreeEditor comboEditor = new TreeEditor(tree);
final CCombo combo = new CCombo(tree, SWT.BORDER);
for (DataminingType type : DataminingType.values()) {
// MODSCA 2008-04-10 use literal
combo.add(type.getLiteral());
// for presentation
}
final ModelElement modelElement = RepositoryNodeHelper.getSubModelElement(meIndicator.getModelElementRepositoryNode());
DataminingType dataminingType = MetadataHelper.getDataminingType(modelElement);
// MOD qiongli 2010-11-15 feature 16796
if (meIndicator instanceof DelimitedFileIndicator) {
dataminingType = MetadataHelper.getDefaultDataminingType(meIndicator.getJavaType());
}
if (dataminingType == null) {
combo.select(0);
} else {
combo.setText(dataminingType.getLiteral());
}
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
MetadataHelper.setDataminingType(DataminingType.get(combo.getText()), modelElement);
setDirty(true);
}
});
combo.setEditable(false);
comboEditor.minimumWidth = WIDTH1_CELL;
comboEditor.setEditor(combo, treeItem, 1);
TreeEditor addPatternEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label addPatternLabl = createTreeItemLabel(tree, ImageLib.ADD_PATTERN, "AnalysisColumnTreeViewer.addPattern");
// MOD mzhao feature:13040, 2010-05-21
addPatternLabl.addMouseListener(new PatternMouseAdapter(this, masterPage, meIndicator, treeItem));
addPatternEditor.minimumWidth = addPatternLabl.getImage().getBounds().width;
addPatternEditor.setEditor(addPatternLabl, treeItem, 2);
// ADD xqliu 2010-02-23 feature 11617
TreeEditor addUdiEditor = addColumnUdi(treeItem, meIndicator, 3);
// ~
TreeEditor delLabelEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisColumnTreeViewer.delete");
delLabel.setData(treeItem);
delLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
// // here is the delLable which is behind of column, so need to remove current column and it's all
// of
TreeItem currentTreeItem = (TreeItem) e.widget.getData();
removeSelectedElements(new TreeItem[] { currentTreeItem });
notifyObservers();
}
});
delLabelEditor.minimumWidth = delLabel.getImage().getBounds().width;
delLabelEditor.horizontalAlignment = SWT.CENTER;
delLabelEditor.setEditor(delLabel, treeItem, 4);
treeItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { comboEditor, delLabelEditor, addPatternEditor, addUdiEditor });
if (meIndicator.hasIndicators()) {
createIndicatorItems(treeItem, meIndicator.getIndicatorUnits());
}
treeItem.setExpanded(isExpandAll);
}
}
Aggregations