use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class TableAnalysisWizard method createAndSaveCWMFile.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.core.ui.wizard.analysis.AbstractAnalysisWizard#createAndSaveCWMFile(orgomg.cwm.objectmodel
* .core.ModelElement)
*/
@Override
public TypedReturnCode<Object> createAndSaveCWMFile(ModelElement cwmElement) {
Analysis analysis = (Analysis) cwmElement;
DataManager connection = analysis.getContext().getConnection();
if (connection != null) {
DependenciesHandler.getInstance().setDependencyOn(analysis, connection);
}
// MOD by hcheng for 7173:Broken dependency between analyses and connection
TypedReturnCode<Object> saveCWMFile = super.createAndSaveCWMFile(analysis);
if (saveCWMFile.isOk() && connection != null) {
ElementWriterFactory.getInstance().createDataProviderWriter().save(connection);
}
return saveCWMFile;
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class ResourceViewLabelProvider method decorateImage.
@Override
protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) {
ImageDescriptor image = super.decorateImage(input, element);
if (element instanceof IFile) {
IFile file = (IFile) element;
String fileExtension = file.getFileExtension();
// MOD qiongli 2010-9-7,bug 14698,add 'try...catch'
try {
if (FactoriesUtil.isPatternFile(fileExtension)) {
image = ImageLib.getImageDescriptor(ImageLib.PATTERN_REG);
Pattern pattern = PatternResourceFileHelper.getInstance().findPattern(file);
if (pattern != null) {
if (!TaggedValueHelper.getValidStatus(pattern)) {
image = ImageLib.createInvalidIconDes(ImageLib.PATTERN_REG);
}
}
} else if (FactoriesUtil.isReportFile(fileExtension)) {
image = ImageLib.getImageDescriptor(ImageLib.REPORT_OBJECT);
} else if (FactoriesUtil.isUDIFile(fileExtension)) {
image = ImageLib.getImageDescriptor(ImageLib.IND_DEFINITION);
IndicatorDefinition udi = IndicatorResourceFileHelper.getInstance().findIndDefinition(file);
if (udi != null) {
boolean validStatus = TaggedValueHelper.getValidStatus(udi) | UDIHelper.isUDIValid(udi);
if (!validStatus) {
image = ImageLib.createInvalidIconDes(ImageLib.IND_DEFINITION);
}
}
} else if (FactoriesUtil.isAnalysisFile(fileExtension)) {
// ADD qiongli 2010-8-9,feature 14252
Analysis analysis = AnaResourceFileHelper.getInstance().findAnalysis(file);
if (analysis != null) {
AnalysisHandler analysisHandler = new AnalysisHandler();
analysisHandler.setAnalysis(analysis);
if (analysisHandler.getResultMetadata().getExecutionNumber() != 0) {
if (!analysisHandler.getResultMetadata().isLastRunOk()) {
image = ImageLib.createErrorIcon(image);
} else if (analysisHandler.getResultMetadata().isOutThreshold()) {
image = ImageLib.createInvalidIcon(image);
}
}
}
}
} catch (Exception exc) {
log.error(exc, exc);
image = ImageLib.getImageDescriptor(ImageLib.DELETE_ACTION);
}
if (FactoriesUtil.isEmfFile(fileExtension)) {
Property property = PropertyHelper.getProperty(file);
if (property != null) {
Item item = property.getItem();
Boolean lockByOthers = ProxyRepositoryManager.getInstance().isLockByOthers(item);
Boolean lockByUserOwn = ProxyRepositoryManager.getInstance().isLockByUserOwn(item);
if (lockByOthers || lockByUserOwn) {
// $NON-NLS-1$
log.info(property.getLabel() + " is locked");
image = ImageLib.createLockedIcon(image);
}
}
}
} else if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
if (ResourceManager.isMetadataFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.METADATA);
} else if (ResourceManager.isLibrariesFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.LIBRARIES);
} else if (ResourceManager.isDataProfilingFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.DATA_PROFILING);
} else if (ResourceManager.isDBConnectionFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.CONNECTION);
} else if (ResourceManager.isExchangeFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.EXCHANGE);
} else if (ResourceManager.isFileDelimitedFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.FILE_DELIMITED);
}
}
return image;
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class MatchWizard method initCWMResourceBuilder.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.wizard.analysis.column.ColumnSetWizard#initCWMResourceBuilder()
*/
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
// New blocking key indicator.
Indicator blockKeyIndicator = ColumnsetFactory.eINSTANCE.createBlockKeyIndicator();
analysis.getResults().getIndicators().add(blockKeyIndicator);
// Match rule indicator
RecordMatchingIndicator matchRuleIndicator = ColumnsetFactory.eINSTANCE.createRecordMatchingIndicator();
MatchRuleDefinition matchRuleDefinition = RulesFactory.eINSTANCE.createMatchRuleDefinition();
matchRuleIndicator.setBuiltInMatchRuleDefinition(matchRuleDefinition);
analysis.getResults().getIndicators().add(matchRuleIndicator);
// default loaded row count
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
int maxRows = preferenceStore.getInt(PluginConstant.MAX_NB_ROWS_ANALYSIS_EDITOR);
TaggedValueHelper.setTaggedValue(analysis, TaggedValueHelper.PREVIEW_ROW_NUMBER, String.valueOf(maxRows));
return analysis;
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AnalysisFilterWizard method createAndSaveCWMFile.
@Override
public TypedReturnCode<Object> createAndSaveCWMFile(ModelElement cwmElement) {
Analysis analysis = (Analysis) cwmElement;
// MOD klliu feature 15750 connection property define
// MOD qiongli 2011-2-24,bug 17588,add dependency.
DataManager connection = analysis.getContext().getConnection();
DependenciesHandler.getInstance().setDependencyOn(analysis, connection);
ConnectionItem connectionItem = (ConnectionItem) getParameter().getConnectionRepNode().getObject().getProperty().getItem();
TypedReturnCode<Object> saveCWMFile = super.createAndSaveCWMFile(analysis);
// MOD by hcheng for 7173:Broken dependency between analyses and connection
if (saveCWMFile.isOk()) {
// ProxyRepositoryViewObject.fetchAllRepositoryViewObjects(Boolean.TRUE, Boolean.TRUE);
// MOD yyi 2012-02-08 TDQ-4621:Explicitly set true for updating dependencies.
ElementWriterFactory.getInstance().createDataProviderWriter().save(connectionItem, true);
}
return saveCWMFile;
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AnalysisFilterWizard method initCWMResourceBuilder.
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
EList<Domain> dataFilters = analysis.getParameters().getDataFilter();
if ((getParameter().getTableFilter() != null) && (!getParameter().getTableFilter().equals(PluginConstant.EMPTY_STRING))) {
DomainHelper.setDataFilterTablePattern(dataFilters, getParameter().getTableFilter());
}
if ((getParameter().getViewFilter() != null) && (!getParameter().getViewFilter().equals(PluginConstant.EMPTY_STRING))) {
DomainHelper.setDataFilterViewPattern(dataFilters, getParameter().getViewFilter());
}
return analysis;
}
Aggregations