Search in sources :

Example 36 with IndicatorParameters

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;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters)

Example 37 with IndicatorParameters

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;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) DateParameters(org.talend.dataquality.indicators.DateParameters)

Example 38 with IndicatorParameters

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;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters)

Example 39 with IndicatorParameters

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);
}
Also used : TextParameters(org.talend.dataquality.indicators.TextParameters) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) Before(org.junit.Before)

Example 40 with IndicatorParameters

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));
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) TdExpression(org.talend.cwm.relational.TdExpression) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) PatternComponent(org.talend.dataquality.domain.pattern.PatternComponent) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) Domain(org.talend.dataquality.domain.Domain) Test(org.junit.Test)

Aggregations

IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)65 Domain (org.talend.dataquality.domain.Domain)27 DateParameters (org.talend.dataquality.indicators.DateParameters)15 Test (org.junit.Test)14 TdColumn (org.talend.cwm.relational.TdColumn)14 Pattern (org.talend.dataquality.domain.pattern.Pattern)14 TdExpression (org.talend.cwm.relational.TdExpression)13 TextParameters (org.talend.dataquality.indicators.TextParameters)12 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)10 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)10 Indicator (org.talend.dataquality.indicators.Indicator)9 ArrayList (java.util.ArrayList)8 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)8 Expression (orgomg.cwm.objectmodel.core.Expression)8 RegexpMatchingIndicator (org.talend.dataquality.indicators.RegexpMatchingIndicator)7 UserDefIndicator (org.talend.dataquality.indicators.sql.UserDefIndicator)7 PhoneNumberUtil (com.google.i18n.phonenumbers.PhoneNumberUtil)6 PhoneNumber (com.google.i18n.phonenumbers.Phonenumber.PhoneNumber)6 Analysis (org.talend.dataquality.analysis.Analysis)6 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)6