use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.
the class ResourceUtils method createAnalysis.
public static Analysis createAnalysis(Indicator indicator) {
AnalysisParameters createAnalysisParameters = AnalysisFactory.eINSTANCE.createAnalysisParameters();
setUUID(null, createAnalysisParameters);
createAnalysisParameters.setAnalysisType(AnalysisType.MULTIPLE_COLUMN);
Analysis createAnalysis = AnalysisFactory.eINSTANCE.createAnalysis();
setUUID(null, createAnalysis);
AnalysisContext createAnalysisContext = AnalysisFactory.eINSTANCE.createAnalysisContext();
setUUID(null, createAnalysisContext);
// $NON-NLS-1$
MetadataColumn createMetadataColumn = createMetadataColumn("columnName");
createAnalysisContext.getAnalysedElements().add(createMetadataColumn);
createAnalysis.setContext(createAnalysisContext);
AnalysisResult createAnalysisResult = AnalysisFactory.eINSTANCE.createAnalysisResult();
setUUID(null, createAnalysisResult);
ExecutionInformations createExecutionInformations = AnalysisFactory.eINSTANCE.createExecutionInformations();
setUUID(null, createExecutionInformations);
createAnalysisResult.setResultMetadata(createExecutionInformations);
createAnalysisResult.getIndicators().add(indicator);
indicator.setAnalyzedElement(createMetadataColumn);
createAnalysis.setResults(createAnalysisResult);
createAnalysis.setParameters(createAnalysisParameters);
// $NON-NLS-1$
createAnalysis.setName("anaName");
// $NON-NLS-1$
MetadataHelper.setAuthor(createAnalysis, "shenze");
createAnalysis.setCreationDate(new Date(System.currentTimeMillis()));
setUUID(null, indicator);
return createAnalysis;
}
use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.
the class AnalysisHelper method setAnalysisType.
/**
* Method "setAnalysisType".
*
* @param analysis an analysis
* @param analysisType the type to set to the analysis
*/
public static void setAnalysisType(Analysis analysis, AnalysisType analysisType) {
AnalysisParameters parameters = analysis.getParameters();
if (parameters == null) {
parameters = AnalysisFactory.eINSTANCE.createAnalysisParameters();
analysis.setParameters(parameters);
}
parameters.setAnalysisType(analysisType);
}
use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.
the class AnalysisHelper method getStringDataFilter.
/**
* DOC xqliu Comment method "getStringDataFilter".
*
* @param analysis
* @param index 0 for DataFilterA, 1 for DataFilterB
* @return
*/
public static String getStringDataFilter(Analysis analysis, int index) {
AnalysisParameters parameters = analysis.getParameters();
if (parameters == null) {
return null;
}
EList<Domain> dataFilters = parameters.getDataFilter();
// remove existing filters
if (dataFilters == null || dataFilters.isEmpty()) {
return null;
}
int i = 0;
for (Domain domain : dataFilters) {
if (domain == null) {
continue;
}
EList<RangeRestriction> ranges = domain.getRanges();
for (RangeRestriction rangeRestriction : ranges) {
BooleanExpressionNode expressions = rangeRestriction.getExpressions();
if (expressions == null) {
continue;
}
Expression expression = expressions.getExpression();
if (expression == null) {
continue;
}
if (i == index) {
// MOD klliu 2011-07-14 bug 23150 solve an NPE
String body = expression.getBody();
if (body == null) {
continue;
}
// ~
return body.trim();
} else if (i > index) {
return null;
}
}
i++;
}
return null;
}
use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.
the class AnalysisImpl method basicSetParameters.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetParameters(AnalysisParameters newParameters, NotificationChain msgs) {
AnalysisParameters oldParameters = parameters;
parameters = newParameters;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AnalysisPackage.ANALYSIS__PARAMETERS, oldParameters, newParameters);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations