use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnAnalysisDetailsPage method canRun.
@Override
protected ReturnCode canRun() {
// ADD xqliu 2010-01-22 bug 11200
ReturnCode checkMdmExecutionEngine = checkMdmExecutionEngine();
if (!checkMdmExecutionEngine.isOk()) {
return checkMdmExecutionEngine;
}
if (checkJUDIUpdate()) {
recomputeIndicators();
computePagination();
}
// ~
ModelElementIndicator[] modelElementIndicators = treeViewer.getModelElementIndicator();
if (modelElementIndicators == null || modelElementIndicators.length == 0) {
return new ReturnCode(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.NoColumnAssigned", analysisHandler.getName()), // $NON-NLS-1$
false);
}
for (ModelElementIndicator modelElementIndicator : modelElementIndicators) {
if (modelElementIndicator.getIndicators().length == 0) {
// $NON-NLS-1$
return new ReturnCode(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.NoIndicatorAssigned"), false);
}
}
return new ReturnCode(true);
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnSetAnalysisDetailsPage method saveAnalysis.
/**
* @param outputFolder
* @throws DataprofilerCoreException
*/
@Override
public void saveAnalysis() throws DataprofilerCoreException {
columnSetAnalysisHandler.changeDefaultRowLoaded(rowLoadedText.getText());
columnSetAnalysisHandler.changeSampleDataShowWay(sampleDataShowWayCombo.getText());
// columnSetAnalysisHandler.setName(columnSetAnalysisHandler.getName().replace(" ", ""));
for (Domain domain : getCurrentModelElement().getParameters().getDataFilter()) {
domain.setName(getCurrentModelElement().getName());
}
// ~
columnSetAnalysisHandler.clearAnalysis();
simpleStatIndicator.getAnalyzedColumns().clear();
allMatchIndicator.getAnalyzedColumns().clear();
// set execute engine
Analysis analysis = columnSetAnalysisHandler.getAnalysis();
analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
// set data filter
columnSetAnalysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
// save analysis
List<IRepositoryNode> repositoryNodes = treeViewer.getColumnSetMultiValueList();
Connection tdProvider = null;
IRepositoryViewObject reposObject = null;
if (repositoryNodes != null && repositoryNodes.size() != 0) {
ConnectionItem item = (ConnectionItem) repositoryNodes.get(0).getObject().getProperty().getItem();
tdProvider = item.getConnection();
if (tdProvider.eIsProxy()) {
// Resolve the connection again
tdProvider = (Connection) EObjectHelper.resolveObject(tdProvider);
}
analysis.getContext().setConnection(tdProvider);
List<ModelElement> columnList = new ArrayList<ModelElement>();
for (IRepositoryNode rd : repositoryNodes) {
reposObject = rd.getObject();
columnList.add(((MetadataColumnRepositoryObject) reposObject).getTdColumn());
}
simpleStatIndicator.getAnalyzedColumns().addAll(columnList);
columnSetAnalysisHandler.addIndicator(columnList, simpleStatIndicator);
// ~ MOD mzhao feature 13040. 2010-05-21
allMatchIndicator.getCompositeRegexMatchingIndicators().clear();
ModelElementIndicator[] modelElementIndicator = treeViewer.getModelElementIndicator();
if (modelElementIndicator != null) {
for (ModelElementIndicator modelElementInd : modelElementIndicator) {
Indicator[] inds = modelElementInd.getPatternIndicators();
for (Indicator ind : inds) {
if (ind instanceof RegexpMatchingIndicator) {
// MOD yyi 2011-06-15 22419:column set pattern for MDM
IRepositoryViewObject obj = modelElementInd.getModelElementRepositoryNode().getObject();
ModelElement analyzedElt = ((MetadataColumnRepositoryObject) obj).getTdColumn();
ind.setAnalyzedElement(analyzedElt);
allMatchIndicator.getCompositeRegexMatchingIndicators().add((RegexpMatchingIndicator) ind);
}
}
}
}
if (allMatchIndicator.getCompositeRegexMatchingIndicators().size() > 0) {
allMatchIndicator.getAnalyzedColumns().addAll(columnList);
columnSetAnalysisHandler.addIndicator(columnList, allMatchIndicator);
}
// ~
} else {
analysis.getContext().setConnection(null);
}
TaggedValueHelper.setTaggedValue(getCurrentModelElement(), TaggedValueHelper.IS_USE_SAMPLE_DATA, isRunWithSampleData.toString());
// save the number of connections per analysis
this.saveNumberOfConnectionsPerAnalysis();
// 2011.1.12 MOD by zhsne to unify anlysis and connection id when saving.
this.nameText.setText(columnSetAnalysisHandler.getName());
// TDQ-5581,if has removed emlements(patten),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 AbstractAnalysisMetadataPage method openColumnsSelectionDialog.
/**
* open the column selection dialog.
*/
public void openColumnsSelectionDialog() {
if (connCombo != null) {
reloadDataproviderAndFillConnCombo();
}
RepositoryNode connNode = getConnComboSelectNode();
List<IRepositoryNode> reposViewObjList = new ArrayList<IRepositoryNode>();
for (ModelElementIndicator modelElementIndicator : currentModelElementIndicators) {
reposViewObjList.add(modelElementIndicator.getModelElementRepositoryNode());
}
ColumnsSelectionDialog dialog = new ColumnsSelectWithConstraintDialog(this, null, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.columnSelection"), reposViewObjList, connNode, // $NON-NLS-1$
DefaultMessagesImpl.getString(// $NON-NLS-1$
"ColumnMasterDetailsPage.columnSelections"));
if (dialog.open() == Window.OK) {
Object[] modelElements = dialog.getResult();
setTreeViewInput(modelElements);
// TDQ-11590: automatically refresh the data table after we select column with the "select columns" dialog.
refreshPreviewData();
// TDQ-11590~
}
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ModelElementIndicatorHelper method getModelElementFromMEIndicator.
/**
* Convert from ModelElementIndicators to ModelElement
*
* @param ModelElementIndicators
* @return
*/
public static ModelElement[] getModelElementFromMEIndicator(ModelElementIndicator[] ModelElementIndicators) {
if (ModelElementIndicators == null) {
return new ModelElement[0];
}
ModelElement[] selectedColumns = new ModelElement[ModelElementIndicators.length];
int index = 0;
for (ModelElementIndicator modelElemIndi : ModelElementIndicators) {
IRepositoryViewObject currentObject = modelElemIndi.getModelElementRepositoryNode().getObject();
if (ISubRepositoryObject.class.isInstance(currentObject)) {
selectedColumns[index++] = ((ISubRepositoryObject) currentObject).getModelElement();
}
}
return selectedColumns;
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class DateFrequencyStateUtilTest method setUp.
@Before
public void setUp() throws Exception {
mapVal2Freq = new HashMap<Object, Long>();
mapVal2Freq.put(1993, 4L);
mapVal2Freq.put(1994, 23L);
mapVal2Freq.put(1996, 15L);
mapVal2Freq.put(1999, 11L);
yearLowFrequencyIndicator = IndicatorsFactory.eINSTANCE.createYearLowFrequencyIndicator();
yearLowFrequencyIndicator.setValueToFreq(mapVal2Freq);
yearLowFrequencyIndicator.setComputed(true);
units = new ArrayList<IndicatorUnit>();
ModelElementIndicator modelElementIndicator = UnitTestBuildHelper.createModelElementIndicator();
ColumnIndicatorUnit columnIndicatorUnit = new ColumnIndicatorUnit(IndicatorEnum.YearLowFrequencyIndicatorEnum, yearLowFrequencyIndicator, modelElementIndicator);
units.add(columnIndicatorUnit);
}
Aggregations