use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AbstractPredefinedAnalysisAction method run.
@Override
public void run() {
// do something before open the wizard
if (preDo()) {
WizardDialog dialog = getPredefinedDialog();
if (dialog == null) {
dialog = getStandardAnalysisWizardDialog();
}
dialog.setPageSize(500, 340);
if (dialog.open() == Window.OK) {
ModelElementIndicator[] predefinedColumnIndicator = getPredefinedColumnIndicator();
if (predefinedColumnIndicator != null) {
ColumnAnalysisDetailsPage masterPage = getMasterPage();
if (masterPage != null) {
masterPage.refreshPreviewTable(predefinedColumnIndicator, false);
masterPage.refreshTheTree(predefinedColumnIndicator);
if (needChangeExecuteLanguageToJava()) {
masterPage.changeExecuteLanguageToJava(true);
}
masterPage.doSave(null);
}
}
}
}
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class OpenIndicatorSelectorAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
AbstractColumnDropTree treeViewer = page.getTreeViewer();
if (treeViewer instanceof AnalysisColumnTreeViewer) {
AnalysisColumnTreeViewer columnTreeViewer = (AnalysisColumnTreeViewer) treeViewer;
ModelElementIndicator[] modelElementIndicator = columnTreeViewer.openIndicatorSelectDialog(null);
if (modelElementIndicator != null) {
page.refreshCurrentTreeViewer(modelElementIndicator);
if (columnTreeViewer.isGridPreviewColumnMoved()) {
page.refreshPreviewTable(true);
}
}
}
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AbstractIndicatorSelectGrid method processNodeSelection.
/**
* recursively check if a entire row/column is selected/
*
* @param grid
* @param parentItem
* @param currentItem
*/
void processNodeSelection(GridItem parentItem, GridItem currentItem) {
if (currentItem.hasChildren()) {
// declare and initialize variables
Boolean[] allCheckedInColumn = new Boolean[getColumnCount()];
Boolean[] hasCheckedInColumn = new Boolean[getColumnCount()];
for (int j = 1; j < getColumnCount(); j++) {
allCheckedInColumn[j] = true;
hasCheckedInColumn[j] = false;
}
for (int i = 0; i < currentItem.getItemCount(); i++) {
GridItem childItem = currentItem.getItem(i);
// process the children of current item, this must be done before handling the current item
processNodeSelection(currentItem, childItem);
boolean allCheckedInRow = true;
boolean hasCheckedInRow = false;
boolean expanded = false;
for (int j = 2; j < getColumnCount(); j++) {
if (childItem.getChecked(j)) {
hasCheckedInRow = true;
hasCheckedInColumn[j] = true;
expanded = true;
if (childItem.getGrayed(j)) {
allCheckedInRow = false;
allCheckedInColumn[j] = false;
}
} else {
if (childItem.getCheckable(j)) {
allCheckedInRow = false;
allCheckedInColumn[j] = false;
}
}
}
childItem.setChecked(1, hasCheckedInRow);
childItem.setGrayed(1, hasCheckedInRow && !allCheckedInRow);
if (expanded) {
currentItem.setExpanded(true);
}
}
// process the selections of indicator category row
boolean entireCategoryChecked = true;
for (int j = 2; j < getColumnCount(); j++) {
if (currentItem.getCheckable(j)) {
if (hasCheckedInColumn[j]) {
hasCheckedInColumn[1] = true;
currentItem.setChecked(j, true);
} else {
currentItem.setChecked(j, false);
}
if (!allCheckedInColumn[j]) {
currentItem.setGrayed(j, hasCheckedInColumn[j]);
entireCategoryChecked = false;
} else {
currentItem.setGrayed(j, false);
}
// are selected
if (hasCheckedInColumn[j] && allCheckedInColumn[j]) {
IIndicatorNode indicatorNode = (IIndicatorNode) currentItem.getData();
IndicatorEnum indicatorEnum = indicatorNode.getIndicatorEnum();
ModelElementIndicator meIndicator = (ModelElementIndicator) getColumn(j).getData();
if (indicatorEnum != null && meIndicator != null && (indicatorEnum == IndicatorEnum.RangeIndicatorEnum || indicatorEnum == IndicatorEnum.IQRIndicatorEnum)) {
meIndicator.addTempIndicatorEnum(indicatorEnum);
}
}
}
}
if (currentItem.getCheckable(1)) {
currentItem.setChecked(1, hasCheckedInColumn[1]);
currentItem.setGrayed(1, hasCheckedInColumn[1] && !entireCategoryChecked);
}
}
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnAnalysisDetailsPage method saveAnalysis.
/**
* @param outputFolder
* @throws DataprofilerCoreException
*/
@Override
public void saveAnalysis() throws DataprofilerCoreException {
analysisHandler.changeDefaultRowLoaded(rowLoadedText.getText());
analysisHandler.changeSampleDataShowWay(sampleDataShowWayCombo.getText());
analysisHandler.clearAnalysis();
Analysis analysis = analysisHandler.getAnalysis();
for (Domain domain : getCurrentModelElement().getParameters().getDataFilter()) {
domain.setName(getCurrentModelElement().getName());
}
analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
// save the number of connections per analysis
this.saveNumberOfConnectionsPerAnalysis();
try {
// MOD zshen feature 12919 to save analysisParameter.
analysis.getParameters().setMaxNumberRows(Integer.parseInt(maxNumText.getText()));
} catch (NumberFormatException nfe) {
// $NON-NLS-1$
MessageDialogWithToggle.openError(// $NON-NLS-1$
null, // $NON-NLS-1$
DefaultMessagesImpl.getString("AbstractAnalysisMetadataPage.SaveAnalysis"), // $NON-NLS-1$
DefaultMessagesImpl.getString(// $NON-NLS-1$
"ColumnMasterDetailsPage.emptyField", // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.maxNumberLabel")));
maxNumText.setText(String.valueOf(analysis.getParameters().getMaxNumberRows()));
}
analysis.getParameters().setStoreData(drillDownCheck.getSelection());
// ~12919
ModelElementIndicator[] modelElementIndicators = this.getCurrentModelElementIndicators();
if (modelElementIndicators != null && modelElementIndicators.length != 0) {
Connection tdProvider = ModelElementIndicatorHelper.getTdDataProvider(modelElementIndicators[0]);
if (tdProvider.eIsProxy()) {
// Resolve the connection again
tdProvider = (Connection) EObjectHelper.resolveObject(tdProvider);
}
analysis.getContext().setConnection(tdProvider);
for (ModelElementIndicator modelElementIndicator : modelElementIndicators) {
IRepositoryViewObject reposObject = modelElementIndicator.getModelElementRepositoryNode().getObject();
ModelElement modelEle = null;
if (reposObject instanceof MetadataColumnRepositoryObject) {
modelEle = ((MetadataColumnRepositoryObject) reposObject).getTdColumn();
}
analysisHandler.addIndicator(modelEle, modelElementIndicator.getIndicators());
DataminingType type = MetadataHelper.getDataminingType(modelEle);
if (type == null) {
type = MetadataHelper.getDefaultDataminingType(modelElementIndicator.getJavaType());
}
analysisHandler.setDatamingType(type.getLiteral(), modelEle);
}
} else {
analysis.getContext().setConnection(null);
}
analysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
// 2011.1.12 MOD by zshen to unify anlysis and connection id when saving.
this.nameText.setText(analysisHandler.getName());
TaggedValueHelper.setTaggedValue(getCurrentModelElement(), TaggedValueHelper.IS_USE_SAMPLE_DATA, isRunWithSampleData.toString());
// TDQ-5581,if has removed emlements(patten/udi),should remove dependency each other before saving.
// MOD yyi 2012-02-08 TDQ-4621:Explicitly set true for updating dependencies.
ReturnCode saved = ElementWriterFactory.getInstance().createAnalysisWrite().save(getCurrentRepNode().getObject().getProperty().getItem(), true);
// MOD yyi 2012-02-03 TDQ-3602:Avoid to rewriting all analyzes after saving, no reason to update all analyzes
// which is depended in the referred connection.
// Extract saving log function.
// @see org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage#logSaved(ReturnCode)
logSaved(saved);
treeViewer.setDirty(false);
dataFilterComp.setDirty(false);
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnAnalysisDetailsPage method recomputeIndicators.
public void recomputeIndicators() {
analysisHandler = new ModelElementAnalysisHandler();
analysisHandler.setAnalysis(getCurrentModelElement());
// Handle JUDIs
UDIHelper.updateJUDIsForAnalysis(getCurrentModelElement());
stringDataFilter = analysisHandler.getStringDataFilterwithContext();
EList<ModelElement> analyzedColumns = analysisHandler.getAnalyzedColumns();
List<ModelElementIndicator> meIndicatorList = new ArrayList<ModelElementIndicator>();
ModelElementIndicator currentIndicator = null;
for (ModelElement element : analyzedColumns) {
TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
// MOD qiongli 2011-1-10,16796:delimitefile
MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
if (tdColumn == null && mdColumn == null) {
continue;
}
// MOD qiongli TDQ-7052 if the node is filtered ,it will be return null,so should create a new node.
RepositoryNode repNode = RepositoryNodeHelper.recursiveFind(element);
if (repNode == null) {
repNode = RepositoryNodeHelper.createRepositoryNode(element);
}
// MOD mzhao feature 15750, The column is recompute from the file, here create a new repository view object.
if (tdColumn == null && mdColumn != null) {
currentIndicator = ModelElementIndicatorHelper.createDFColumnIndicator(repNode);
} else if (tdColumn != null) {
currentIndicator = ModelElementIndicatorHelper.createModelElementIndicator(repNode);
}
DataminingType dataminingType = DataminingType.get(analysisHandler.getDatamingType(element));
MetadataHelper.setDataminingType(dataminingType == null ? DataminingType.NOMINAL : dataminingType, element);
Collection<Indicator> indicatorList = analysisHandler.getIndicators(element);
if (currentIndicator != null) {
currentIndicator.setIndicators(indicatorList.toArray(new Indicator[indicatorList.size()]));
meIndicatorList.add(currentIndicator);
}
}
currentModelElementIndicators = meIndicatorList.toArray(new ModelElementIndicator[meIndicatorList.size()]);
}
Aggregations