use of org.talend.dataquality.helpers.ReportHelper.ReportType in project tdq-studio-se by Talend.
the class LocalRepositoryObjectCRUD method relocateJrxmlTemplates.
/**
* update user define jrxml template path.
*
* @param sourceNode
* @param targetNode
* @link {@link #moveReportRepNode(IRepositoryNode, IRepositoryNode)}
*/
private void relocateJrxmlTemplates(IRepositoryNode sourceNode, IRepositoryNode targetNode) {
IPath targetPath = RepositoryNodeHelper.getPath(targetNode);
IFolder targetFolder = ResourceManager.getRootProject().getFolder(targetPath);
TdReport rep = (TdReport) RepositoryNodeHelper.getModelElementFromRepositoryNode(sourceNode);
IPath jrxmlPath = null;
IPath relativePath = null;
ReportType reportType = null;
for (AnalysisMap anaMap : rep.getAnalysisMap()) {
reportType = ReportHelper.ReportType.getReportType(anaMap.getAnalysis(), anaMap.getReportType());
// Relocate the jrxml template path for user define type.
if (ReportHelper.ReportType.USER_MADE.equals(reportType)) {
jrxmlPath = RepResourceFileHelper.findCorrespondingFile(rep).getParent().getLocation().append(anaMap.getJrxmlSource());
// $NON-NLS-1$
relativePath = jrxmlPath.makeRelativeTo(targetFolder.getLocation().append("/"));
anaMap.setJrxmlSource(relativePath.toString());
}
}
}
use of org.talend.dataquality.helpers.ReportHelper.ReportType in project tdq-studio-se by Talend.
the class ItemRecord method computeDependencies.
/**
* DOC bZhou Comment method "computeDependencies".
*/
private void computeDependencies(ModelElement mElement) {
if (isJRXml()) {
Collection<TdReport> allReports = (Collection<TdReport>) RepResourceFileHelper.getInstance().getAllElement();
for (TdReport report : allReports) {
// MOD yyi 2012-02-20 TDQ-4545 TDQ-4701: Change to relative path comparing.
IPath pathRepFile = RepResourceFileHelper.findCorrespondingFile(report).getLocation();
IPath pathJrxmlFile = new Path(file.getPath());
String path = pathJrxmlFile.makeRelativeTo(pathRepFile).toString();
for (AnalysisMap anaMap : report.getAnalysisMap()) {
if (StringUtils.equals(path, anaMap.getJrxmlSource())) {
// TODO the File is jrxml, but the ModelElement is report ???
this.dependencySet.add(file);
}
}
}
} else if (mElement != null) {
if (mElement instanceof Connection) {
includeContextDependency((Connection) mElement);
return;
}
List<File> dependencyFile = getClintDependencyForExport(mElement);
for (File df : dependencyFile) {
ModelElement modelElement = getElement(df);
if (modelElement != null) {
File depFile = EObjectHelper.modelElement2File(modelElement);
if (depFile != null) {
this.dependencySet.add(depFile);
}
// MOD sizhaoliu 2013-04-13 TDQ-7082
if (modelElement instanceof IndicatorDefinition) {
if (modelElement instanceof UDIndicatorDefinition) {
includeJUDIDependencies((IndicatorDefinition) modelElement);
} else {
for (IndicatorDefinition definition : ((IndicatorDefinition) modelElement).getAggregatedDefinitions()) {
includeAggregatedDependencies(definition);
}
}
}
}
}
// MOD yyi 2012-02-20 TDQ-4545 TDQ-4701: Map user define jrxm templates with report.
if (mElement instanceof TdReport) {
TdReport rep = (TdReport) mElement;
for (AnalysisMap anaMap : rep.getAnalysisMap()) {
ReportType reportType = ReportHelper.ReportType.getReportType(anaMap.getAnalysis(), anaMap.getReportType());
boolean isUserMade = ReportHelper.ReportType.USER_MADE.equals(reportType);
if (isUserMade) {
traverseFolderAndAddJrxmlDependencies(getJrxmlFolderFromReport(rep, ResourceManager.getJRXMLFolder()));
}
}
} else if (mElement instanceof IndicatorDefinition) {
// MOD sizhaoliu 2013-04-13 TDQ-7082
IndicatorDefinition definition = (IndicatorDefinition) mElement;
if (definition instanceof UDIndicatorDefinition) {
includeJUDIDependencies(definition);
} else {
for (IndicatorDefinition defInd : definition.getAggregatedDefinitions()) {
includeAggregatedDependencies(defInd);
}
}
// folder
if (mElement instanceof MatchRuleDefinition) {
includeCustomMatcherJarDependencies((MatchRuleDefinition) mElement);
}
} else if (mElement instanceof Analysis && AnalysisType.MATCH_ANALYSIS == AnalysisHelper.getAnalysisType((Analysis) mElement)) {
includeCustomMatcherJarDependencies((Analysis) mElement);
}
}
}
use of org.talend.dataquality.helpers.ReportHelper.ReportType in project tdq-studio-se by Talend.
the class TdReportImpl method addAnalysis.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT addAnalysis(Analysis analysis)
*/
@Override
public boolean addAnalysis(Analysis analysis) {
// MOD yyin 20120530 TDQ-5050
// boolean added = this.getComponent().add(analysis);
// if (added) {
AnalysisMap createAnalysisMap = ReportsFactory.eINSTANCE.createAnalysisMap();
createAnalysisMap.setAnalysis(analysis);
// refresh by default
createAnalysisMap.setMustRefresh(true);
// MOD mzhao 2009-02-16 Basic type by default.
ReportType reportType2 = ReportType.getReportType(analysis, ReportHelper.BASIC);
if (reportType2 != null) {
createAnalysisMap.setReportType(reportType2.getLabel());
}
this.getAnalysisMap().add(createAnalysisMap);
// }
return true;
}
use of org.talend.dataquality.helpers.ReportHelper.ReportType in project tdq-studio-se by Talend.
the class EObjectHelper method isUsedByDeletedJrxml.
/**
* check if the anaMap comtains the Jrxml or not, by compare the jrxml's path with anaMap's jrxml source(when user
* mode)
*
* @param path the path of the jrxml saved in the analysis map
* @param anaMap the analysis map in the report.
* @return the analysis map used the current jrxml or not.
*/
private static boolean isUsedByDeletedJrxml(IPath path, AnalysisMap anaMap) {
ReportType reportType = ReportHelper.ReportType.getReportType(anaMap.getAnalysis(), anaMap.getReportType());
// compare the Jrxml path if the report has the user defined one.
if (ReportHelper.ReportType.USER_MADE.equals(reportType)) {
String jrxmlPath = anaMap.getJrxmlSource();
String deletedpath = path.removeFirstSegments(2).toString();
if (jrxmlPath.contains(deletedpath)) {
return true;
}
}
return false;
}
Aggregations