use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnWizard method openEditor.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.core.ui.wizard.analysis.AbstractAnalysisWizard#openEditor(org.talend.repository.model.IRepositoryNode
* )
*/
@Override
public void openEditor(IRepositoryNode repNode) {
super.openEditor(repNode);
if (this.selectionPage != null) {
AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editor != null) {
AbstractAnalysisMetadataPage masterPage = editor.getMasterPage();
List<IRepositoryNode> nodes = this.selectionPage.nodes;
if (nodes != null && nodes.size() > 0) {
// MOD msjian TDQ-6665 2013-1-7: after the wizard, make the editor is saved status
if (masterPage instanceof ColumnAnalysisDetailsPage) {
((ColumnAnalysisDetailsPage) masterPage).setTreeViewInput(nodes.toArray(new RepositoryNode[nodes.size()]));
ModelElementIndicator[] predefinedColumnIndicator = this.getPredefinedColumnIndicator();
if (predefinedColumnIndicator != null) {
((ColumnAnalysisDetailsPage) masterPage).refreshPreviewTable(predefinedColumnIndicator, false);
((ColumnAnalysisDetailsPage) masterPage).refreshTheTree(predefinedColumnIndicator);
}
// TDQ-12349: when the database can not support PatternFrequency, set to java engine automatically
if (this instanceof PatternFrequencyWizard && !RepNodeUtils.isSupportPatternFrequency(nodes)) {
masterPage.changeExecuteLanguageToJava(true);
}
// TDQ-12349~
} else if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
((ColumnSetAnalysisDetailsPage) masterPage).setTreeViewInput(nodes.toArray(new RepositoryNode[nodes.size()]));
} else {
masterPage.getTreeViewer().setInput(nodes.toArray(new RepositoryNode[nodes.size()]));
}
masterPage.doSave(new NullProgressMonitor());
// TDQ-6665~
}
}
}
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnWizard method composePredefinedColumnIndicator.
protected ModelElementIndicator[] composePredefinedColumnIndicator(IndicatorEnum[] allowedEnum) {
List<IRepositoryNode> nodes;
// from the right menu
if (selectionPage == null) {
nodes = Arrays.asList(((AnalysisLabelParameter) parameter).getColumnNodes());
} else {
// TDQ-11240: get all the column nodes
nodes = Arrays.asList(RepositoryNodeHelper.getAllColumnNodes(selectionPage.nodes.toArray(new IRepositoryNode[selectionPage.nodes.size()])));
}
ModelElementIndicator[] predefinedColumnIndicator = new ModelElementIndicator[nodes.size()];
for (int i = 0; i < nodes.size(); i++) {
IRepositoryNode columnNode = nodes.get(i);
ModelElementIndicator columnIndicator = ModelElementIndicatorHelper.createModelElementIndicator(columnNode);
for (IndicatorEnum oneEnum : allowedEnum) {
columnIndicator.addTempIndicatorEnum(oneEnum);
if (oneEnum.getChildren() != null) {
for (IndicatorEnum childEnum : oneEnum.getChildren()) {
// MOD by zshen:need language to decide DatePatternFrequencyIndicator whether can be choose by
// user.
IRepositoryViewObject object = columnNode.getObject();
ModelElement element = null;
if (object instanceof MetadataColumnRepositoryObject) {
element = ((MetadataColumnRepositoryObject) object).getTdColumn();
} else if (object instanceof MetadataXmlElementTypeRepositoryObject) {
element = ((MetadataXmlElementTypeRepositoryObject) object).getModelElement();
}
if (element != null && ModelElementIndicatorRule.patternRule(childEnum, element, ExecutionLanguage.SQL)) {
columnIndicator.addTempIndicatorEnum(childEnum);
}
}
}
}
columnIndicator.storeTempIndicator();
predefinedColumnIndicator[i] = columnIndicator;
}
return predefinedColumnIndicator;
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class CreateDateAnalysisAction method getPredefinedColumnIndicator.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.action.AbstractPredefinedAnalysisAction#getPredefinedColumnIndicator()
*/
@Override
protected ModelElementIndicator[] getPredefinedColumnIndicator() {
int count = 5;
if (isTimeType()) {
count = 3;
}
IndicatorEnum[] allwedEnumes = new IndicatorEnum[count];
allwedEnumes[0] = IndicatorEnum.CountsIndicatorEnum;
allwedEnumes[1] = IndicatorEnum.MinValueIndicatorEnum;
allwedEnumes[2] = IndicatorEnum.MaxValueIndicatorEnum;
if (count == 5) {
allwedEnumes[3] = IndicatorEnum.LowFrequencyIndicatorEnum;
allwedEnumes[4] = IndicatorEnum.FrequencyIndicatorEnum;
}
ModelElementIndicator[] returnColumnIndicator = composePredefinedColumnIndicator(allwedEnumes);
if (parameters != null) {
for (ModelElementIndicator columnIndicator : returnColumnIndicator) {
for (Indicator indicator : columnIndicator.getIndicators()) {
if (indicator instanceof FrequencyIndicator) {
if (indicator.getParameters().getDateParameters() != null) {
// TODO If we will never use the
// "parameters" parameter, why we
// add TimeSliceOptionPage and have
// this loop
indicator.getParameters().getDateParameters().setDateAggregationType(parameters.getDateParameters().getDateAggregationType());
}
}
}
}
}
return returnColumnIndicator;
}
Aggregations