use of org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity in project tdq-studio-se by Talend.
the class WhereRuleStatisticsTableState method getDataEntity.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
*/
@Override
public ChartDataEntity[] getDataEntity() {
List<WhereRuleChartDataEntity> dataEnities = new ArrayList<WhereRuleChartDataEntity>();
for (TableIndicatorUnit unit : tableunits) {
if (IndicatorEnum.WhereRuleIndicatorEnum.equals(unit.getType())) {
double value = WhereRuleStatisticsStateUtil.getMatchValue(unit.getValue());
WhereRuleChartDataEntity entity = WhereRuleStatisticsStateUtil.createRuleDataEntity(unit, unit.getIndicatorName(), value, WhereRuleStatisticsStateUtil.getNotMatchValue(unit.getValue(), value, unit.geIndicatorCount()));
dataEnities.add(entity);
}
}
return dataEnities.toArray(new WhereRuleChartDataEntity[dataEnities.size()]);
}
use of org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity in project tdq-studio-se by Talend.
the class TableDynamicChartEventReceiver method clearValue.
@Override
public void clearValue() {
if (IndicatorEnum.RowCountIndicatorEnum.equals(this.getIndicatorType())) {
super.clearValue();
} else {
// clear the data before running.
if (dataset != null) {
TOPChartUtils.getInstance().setValue(dataset, 0.0, WhereRuleStatisticsStateTable.ROW_KEY_NOT_PASS, indicatorName);
TOPChartUtils.getInstance().setValue(dataset, 0.0, WhereRuleStatisticsStateTable.ROW_KEY_PASS, indicatorName);
}
if (tableViewer != null) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumMatch(NAN_STRING);
((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumNoMatch(NAN_STRING);
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
}
use of org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity in project tdq-studio-se by Talend.
the class WhereRuleStatisticsStateUtil method createRuleDataEntity.
/**
* DOC yyin Comment method "createRuleDataEntity".
*
* @param unit
* @param columnKey
* @param value
* @param valueNotM
* @return
*/
public static WhereRuleChartDataEntity createRuleDataEntity(TableIndicatorUnit unit, String columnKey, double value, double valueNotM) {
WhereRuleChartDataEntity entity = new WhereRuleChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(columnKey);
entity.setNumMatch(String.valueOf(value));
entity.setNumNoMatch(String.valueOf(valueNotM));
// ADD xqliu 2010-03-10 feature 10834
entity.setToolTip(WhereRuleStatisticsStateUtil.getUnitToolTip(unit));
// ~
return entity;
}
use of org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method getAllColumnNodes.
/**
* get All the Column level Nodes.
*
* @param selectedNodes
* @return
*/
public static IRepositoryNode[] getAllColumnNodes(Object[] selectedNodes) {
List<IRepositoryNode> list = new ArrayList<IRepositoryNode>();
if (selectedNodes == null || selectedNodes.length == 0) {
return list.toArray(new IRepositoryNode[list.size()]);
}
Object firstElement = selectedNodes[0];
if (firstElement instanceof IRepositoryNode) {
IRepositoryNode repNode = (IRepositoryNode) firstElement;
IRepositoryViewObject repViewObject = repNode.getObject();
if (repViewObject instanceof MetadataColumnRepositoryObject || repViewObject instanceof MetadataXmlElementType) {
IRepositoryNode[] column = new IRepositoryNode[selectedNodes.length];
for (int i = 0; i < selectedNodes.length; i++) {
column[i] = (IRepositoryNode) selectedNodes[i];
}
return column;
} else if (repViewObject instanceof MetadataTableRepositoryObject) {
for (Object currentObj : selectedNodes) {
IRepositoryNode columnSetNode = (IRepositoryNode) currentObj;
List<IRepositoryNode> children = columnSetNode.getChildren();
if (children.size() > 0) {
list.addAll(children.get(0).getChildren());
}
}
return list.toArray(new IRepositoryNode[list.size()]);
}
} else if (firstElement instanceof TdTable) {
TdTable table = (TdTable) firstElement;
EList<MetadataColumn> columns = table.getColumns();
for (MetadataColumn column : columns) {
RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(column);
list.add(recursiveFind);
}
return list.toArray(new IRepositoryNode[list.size()]);
} else if (firstElement instanceof WhereRuleChartDataEntity) {
// ADD msjian 2012-2-9 TDQ-4470: get columns from the join conditions
EList<JoinElement> joinConditions = ((WhereRuleChartDataEntity) firstElement).getIndicator().getJoinConditions();
if (joinConditions != null && joinConditions.size() > 0) {
JoinElement joinElement = joinConditions.get(0);
list.add(RepositoryNodeHelper.recursiveFind(joinElement.getColA()));
list.add(RepositoryNodeHelper.recursiveFind(joinElement.getColB()));
return list.toArray(new IRepositoryNode[list.size()]);
}
// TDQ-4470 ~
} else if (firstElement instanceof TdView) {
// Added yyin 20120522 TDQ-4945, support tdView
TdView view = (TdView) firstElement;
EList<MetadataColumn> columns = view.getColumns();
for (MetadataColumn column : columns) {
RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(column);
list.add(recursiveFind);
}
return list.toArray(new IRepositoryNode[list.size()]);
}
// ~
return null;
}
use of org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity in project tdq-studio-se by Talend.
the class TableDynamicChartEventReceiver method handle.
@Override
public boolean handle(Object value) {
if (value == null) {
return false;
}
if (IndicatorEnum.RowCountIndicatorEnum.equals(this.getIndicatorType())) {
super.handle(value);
} else {
Long count = getIndicator().getCount();
double valueMatch = WhereRuleStatisticsStateUtil.getMatchValue(value);
double valueNotmatch = WhereRuleStatisticsStateUtil.getNotMatchValue(value, valueMatch, count);
if (dataset != null) {
TOPChartUtils.getInstance().setValue(dataset, valueNotmatch, WhereRuleStatisticsStateTable.ROW_KEY_NOT_PASS, indicatorName);
TOPChartUtils.getInstance().setValue(dataset, valueMatch, WhereRuleStatisticsStateTable.ROW_KEY_PASS, indicatorName);
}
if (tableViewer != null) {
TableWithData input = (TableWithData) tableViewer.getInput();
if (input != null) {
ChartDataEntity[] dataEntities = input.getEnity();
((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumMatch(String.valueOf(valueMatch));
((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumNoMatch(String.valueOf(valueNotmatch));
tableViewer.getTable().clearAll();
tableViewer.setInput(input);
}
}
}
return true;
}
Aggregations