use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class FrequencyTypeStateUtil method getNumberOfShown.
/**
* DOC yyin Comment method "getNumberOfShown".
*
* @param unit
* @param frequencyExt
* @return
*/
public static int getNumberOfShown(IndicatorUnit unit, FrequencyExt[] frequencyExt) {
int numOfShown = frequencyExt.length;
IndicatorParameters parameters = unit.getIndicator().getParameters();
if (parameters != null) {
if (parameters.getTopN() < numOfShown) {
numOfShown = parameters.getTopN();
}
}
return numOfShown;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class DateLowFrequencyIndicatorImpl method getParameters.
@Override
public IndicatorParameters getParameters() {
IndicatorParameters parameters = super.getParameters();
if (parameters == null) {
parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
}
DateParameters dateParameters = parameters.getDateParameters();
if (dateParameters == null) {
dateParameters = IndicatorsFactory.eINSTANCE.createDateParameters();
}
dateParameters.setDateAggregationType(DateGrain.DAY);
parameters.setDateParameters(dateParameters);
this.setParameters(parameters);
return parameters;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class IndicatorImpl method basicSetParameters.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetParameters(IndicatorParameters newParameters, NotificationChain msgs) {
IndicatorParameters oldParameters = parameters;
parameters = newParameters;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IndicatorsPackage.INDICATOR__PARAMETERS, oldParameters, newParameters);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class PossiblePhoneCountIndicatorImplTest method setUp.
@Before
public void setUp() throws Exception {
possiblePhoneCountIndicatorImpl = new PossiblePhoneCountIndicatorImpl();
IndicatorParameters createIndicatorParameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
TextParameters textParameters = IndicatorsFactory.eINSTANCE.createTextParameters();
textParameters.setCountryCode(java.util.Locale.CHINA.getCountry());
createIndicatorParameters.setTextParameter(textParameters);
possiblePhoneCountIndicatorImpl.setParameters(createIndicatorParameters);
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class RegexpMatchingIndicatorImplTest method testGetRegexsuccess.
/**
* Test method for {@link org.talend.dataquality.indicators.impl.RegexpMatchingIndicatorImpl#getJavaRegex()}.
*/
@Test
public void testGetRegexsuccess() {
// RegexpMatchingIndicator
RegexpMatchingIndicator createRegexpMatchingIndicator = IndicatorsFactory.eINSTANCE.createRegexpMatchingIndicator();
// ~RegexpMatchingIndicator
// IndicatorParameters
IndicatorParameters createIndicatorParameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
// ~IndicatorParameters
// Domain
Domain createDomain = DomainFactory.eINSTANCE.createDomain();
EList<Pattern> patterns = createDomain.getPatterns();
// ~Domain
// Pattern
Pattern createJavaPattern = PatternFactory.eINSTANCE.createPattern();
Pattern createSQLPattern = PatternFactory.eINSTANCE.createPattern();
Pattern createMSSQLPattern = PatternFactory.eINSTANCE.createPattern();
patterns.add(createJavaPattern);
patterns.add(createSQLPattern);
patterns.add(createMSSQLPattern);
// ~Pattern
// init java Pattern data
RegularExpression createJavaRegularExpression = PatternFactory.eINSTANCE.createRegularExpression();
TdExpression createJavaTdExpression = RelationalFactory.eINSTANCE.createTdExpression();
createJavaTdExpression.setBody(JavaRegex);
createJavaTdExpression.setLanguage("Java");
createJavaRegularExpression.setExpression(createJavaTdExpression);
createJavaRegularExpression.setExpressionType(ExpressionType.REGEXP.getLiteral());
EList<PatternComponent> components = createJavaPattern.getComponents();
components.add(createJavaRegularExpression);
// ~init java Pattern data
createIndicatorParameters.setDataValidDomain(createDomain);
createRegexpMatchingIndicator.setParameters(createIndicatorParameters);
// call getRegex()
String regexResult = createRegexpMatchingIndicator.getRegex();
String JavaRegex2 = JavaRegex.substring(1, JavaRegex.length() - 1);
// ~call getRegex()
Assert.assertTrue(JavaRegex2.equalsIgnoreCase(regexResult));
}
Aggregations