use of org.talend.dataquality.domain.pattern.Pattern in project tdq-studio-se by Talend.
the class RespositoryDetailView method createFileDetail.
private boolean createFileDetail(boolean is, IFile fe2) {
if (fe2.getFileExtension().equals(FactoriesUtil.PATTERN)) {
Pattern pattern = PatternResourceFileHelper.getInstance().findPattern(fe2);
createPatternDetail(pattern);
is = false;
} else if (fe2.getFileExtension().equals(FactoriesUtil.ANA)) {
Analysis ana = AnaResourceFileHelper.getInstance().findAnalysis(fe2);
createAnaysisDetail(ana);
is = false;
} else if (fe2.getFileExtension().equals(FactoriesUtil.REP)) {
TdReport rep = RepResourceFileHelper.getInstance().findReport(fe2);
createReportDetail(rep);
is = false;
} else if (fe2.getFileExtension().equals(FactoriesUtil.SQL)) {
createSqlFileDetail(fe2);
is = false;
}
return is;
}
use of org.talend.dataquality.domain.pattern.Pattern in project tdq-studio-se by Talend.
the class RespositoryDetailView method createTechnicalDetail.
private void createTechnicalDetail(IRepositoryViewObject reposViewObj) {
// MOD klliu the DQRepositoryview unified with tos, so refactor as follow bug 19154 2011-02-28
if (reposViewObj.getProperty() != null) {
Item item = reposViewObj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
createTechnicalDetail(conn);
} else if (item instanceof TDQAnalysisItem) {
Analysis analysis = ((TDQAnalysisItem) item).getAnalysis();
createTechnicalDetail(analysis);
} else if (item instanceof TDQPatternItem) {
Pattern pattern = ((TDQPatternItem) item).getPattern();
createTechnicalDetail(pattern);
} else if (item instanceof TDQReportItem) {
Report report = ((TDQReportItem) item).getReport();
createTechnicalDetail(report);
}
}
}
use of org.talend.dataquality.domain.pattern.Pattern 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.domain.pattern.Pattern in project tdq-studio-se by Talend.
the class PatternRepNode method getChildren.
@Override
public List<IRepositoryNode> getChildren() {
List<IRepositoryNode> languageElement = new ArrayList<IRepositoryNode>();
IRepositoryViewObject object = this.getObject();
TDQPatternItem patternItem = (TDQPatternItem) object.getProperty().getItem();
Pattern pattern = patternItem.getPattern();
EList<PatternComponent> components = pattern.getComponents();
for (PatternComponent component : components) {
RegularExpression re = (RegularExpression) component;
Expression expression = re.getExpression();
String language = expression.getLanguage();
PatternLanguageRepNode plrn = new PatternLanguageRepNode(this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
plrn.setRegularExpression(re);
plrn.setId(language);
plrn.setLabel(language);
languageElement.add(plrn);
}
// MOD gdbu 2011-7-11 bug : 22204
return filterResultsIfAny(languageElement);
// ~22204
}
use of org.talend.dataquality.domain.pattern.Pattern in project tdq-studio-se by Talend.
the class IndicatorTreeModelBuilder method createLeafNode.
/**
* Create leafNode by the type of indiEnum
*
* @param label
* @param indiEnum
* @return
*/
private static IIndicatorNode createLeafNode(String label, IndicatorEnum indiEnum, ModelElement modelElement) {
IIndicatorNode indicatorNode = null;
if (IndicatorEnum.RegexpMatchingIndicatorEnum == indiEnum || IndicatorEnum.SqlPatternMatchingIndicatorEnum == indiEnum) {
indicatorNode = new PatternNode(label, (Pattern) modelElement);
} else if (IndicatorEnum.UserDefinedIndicatorEnum == indiEnum) {
indicatorNode = new UDINode(label);
} else {
return indicatorNode;
}
indicatorNode.setIndicatorEnum(indiEnum);
return indicatorNode;
}
Aggregations