use of org.talend.dq.nodes.indicator.IIndicatorNode in project tdq-studio-se by Talend.
the class ModelElementIndicatorRule method match.
public static boolean match(IIndicatorNode node, ModelElementIndicator meIndicator, ExecutionLanguage language) {
IndicatorEnum indicatorType = node.getIndicatorEnum();
if (indicatorType == null) {
for (IIndicatorNode one : node.getChildren()) {
if (match(one, meIndicator, language)) {
return true;
}
}
return false;
}
IRepositoryNode rd = meIndicator.getModelElementRepositoryNode();
// return patternRule(indicatorType, ((MetadataColumnRepositoryObject) rd.getObject()).getTdColumn(), language);
return patternRule(indicatorType, RepositoryNodeHelper.getSubModelElement(rd), language, node);
}
use of org.talend.dq.nodes.indicator.IIndicatorNode in project tdq-studio-se by Talend.
the class IndicatorSelectDialog method updateIndicatorInfo.
public void updateIndicatorInfo(GridItem item) {
// $NON-NLS-1$
String DESCRIPTION = DefaultMessagesImpl.getString("IndicatorSelectDialog.description");
// $NON-NLS-1$
String PURPOSE = DefaultMessagesImpl.getString("IndicatorSelectDialog.purpose");
IIndicatorNode indicatorNode = ((IIndicatorNode) item.getData());
if (indicatorNode != null) {
Indicator indicator = indicatorNode.getIndicatorInstance();
if (indicator != null) {
IndicatorDefinition indicatorDefinition = indicator.getIndicatorDefinition();
if ("".equals(MetadataHelper.getPurpose(indicatorDefinition))) {
purposeLabel.setText(PURPOSE + " " + indicator.getName());
} else {
purposeLabel.setText(PURPOSE + " " + MetadataHelper.getPurpose(indicatorDefinition));
}
String description = DESCRIPTION + " " + MetadataHelper.getDescription(indicatorDefinition);
descriptionLabel.setText(description);
return;
}
}
purposeLabel.setText(PURPOSE + " " + item.getText());
descriptionLabel.setText(DESCRIPTION + " " + item.getText());
}
use of org.talend.dq.nodes.indicator.IIndicatorNode 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.dq.nodes.indicator.IIndicatorNode in project tdq-studio-se by Talend.
the class AbstractIndicatorSelectGrid method tickCell.
private void tickCell(Point cell, boolean tick) {
if (!getItem(cell.y).getCheckable(cell.x)) {
return;
}
if (cell.x == 1) {
for (int i = 2; i < getColumnCount(); i++) {
tickCell(new Point(i, cell.y), tick);
}
}
getItem(cell.y).setChecked(cell.x, tick);
getItem(cell.y).setGrayed(cell.x, false);
IIndicatorNode indicatorNode = (IIndicatorNode) getItem(cell.y).getData();
IndicatorEnum indicatorEnum = indicatorNode.getIndicatorEnum();
ModelElementIndicator meIndicator = (ModelElementIndicator) getColumn(cell.x).getData();
if (meIndicator != null && indicatorEnum != null) {
if (tick) {
if (IndicatorEnum.isSpecialIndicatorEnum(indicatorEnum)) {
meIndicator.addTempSpecialIndicator(indicatorEnum, indicatorNode.createNewIndicatorInstance());
} else {
meIndicator.addTempIndicatorEnum(indicatorEnum);
}
} else {
if (IndicatorEnum.isSpecialIndicatorEnum(indicatorEnum)) {
meIndicator.removeTempSpecialIndicator(indicatorNode.getIndicatorInstance());
} else {
meIndicator.removeTempIndicatorEnum(indicatorEnum);
}
}
}
// select the entire indicator category
if (getItem(cell.y).hasChildren()) {
for (GridItem child : getItem(cell.y).getItems()) {
tickCell(new Point(cell.x, indexOf(child)), tick);
}
}
}
use of org.talend.dq.nodes.indicator.IIndicatorNode in project tdq-studio-se by Talend.
the class AbstractIndicatorSelectGrid method createChildNodes.
/**
* recursively create tree nodes and checked the existing indicators.
*
* @param grid
* @param currentItem
* @param indicatorNode
*/
void createChildNodes(GridItem parentItem, GridItem currentItem, IIndicatorNode indicatorNode) {
Boolean[] hasCheckableInColumn = new Boolean[getColumnCount()];
for (int j = 1; j < getColumnCount(); j++) {
hasCheckableInColumn[j] = false;
}
for (int i = 0; i < indicatorNode.getChildren().length; i++) {
IIndicatorNode childNode = indicatorNode.getChildren()[i];
TalendGridItem childItem = new TalendGridItem(currentItem, SWT.NONE);
childItem.setImage(ImageLib.getImage(childNode.getImageName()));
if (childNode.hasChildren()) {
createChildNodes(currentItem, childItem, childNode);
}
childItem.setText(childNode.getLabel());
childItem.setData(childNode);
if (parentItem == null) {
childItem.setExpanded(true);
}
boolean hasCheckableInRow = false;
for (int j = 2; j < getColumnCount(); j++) {
// ignore indicator label column and row select column
IndicatorEnum indicatorEnum = childNode.getIndicatorEnum();
// DB columns
ModelElementIndicator meIndicator = null;
if (j - 2 < _modelElementIndicators.length) {
meIndicator = _modelElementIndicators[j - 2];
} else {
meIndicator = _modelElementIndicators[0];
}
// Enable/disable the check box
boolean isMatch = _dialog.isMatchCurrentIndicator(meIndicator, childNode);
childItem.setCheckable(j, isMatch);
if (isMatch) {
hasCheckableInRow = true;
hasCheckableInColumn[j] = true;
// Check the box if it is already selected
if (meIndicator != null && (meIndicator.tempContains(indicatorEnum) || meIndicator.specialTempContains(childNode.getIndicatorInstance()))) {
childItem.setChecked(j, true);
}
}
}
childItem.setCheckable(1, hasCheckableInRow);
}
boolean entireCategoryCheckable = false;
for (int j = 2; j < getColumnCount(); j++) {
if (hasCheckableInColumn[j]) {
entireCategoryCheckable = true;
} else {
currentItem.setCheckable(j, false);
}
}
currentItem.setCheckable(1, entireCategoryCheckable);
}
Aggregations