@Override
 public boolean handle(Object data) {
   super.handle(data);
   if (data == null) {
     return false;
   }
   try {
     PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
     IndicatorParameters indParameters = this.getParameters();
     TextParameters textParameters =
         indParameters == null ? null : indParameters.getTextParameter();
     String country = IndicatorHelper.getCountryCodeByParameter(textParameters);
     PhoneNumber phoneNumeber = phoneUtil.parse(data.toString(), country);
     // It only checks the length of phone numbers. In particular, it doesn't check starting digits
     // of the
     // number.
     if (phoneUtil.isPossibleNumber(phoneNumeber)) {
       this.possiblePhoneCount++;
       if (checkMustStoreCurrentRow() || this.checkMustStoreCurrentRow(drillDownValueCount)) {
         this.mustStoreRow = true;
       }
     }
   } catch (NumberParseException e) {
     return false;
   }
   return true;
 }
Ejemplo n.º 2
0
 /**
  * DOC xqliu Comment method "createUserDefIndicator".
  *
  * @param indicatorDefinition
  * @param pattern
  * @return
  */
 public static Indicator createUserDefIndicator(
     IndicatorDefinition indicatorDefinition, Pattern pattern) {
   UserDefIndicator indicator = IndicatorSqlFactory.eINSTANCE.createUserDefIndicator();
   IndicatorParameters indicParams = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
   Domain validData = DomainFactory.eINSTANCE.createDomain();
   validData.getPatterns().add(pattern);
   indicParams.setDataValidDomain(validData);
   indicator.setParameters(indicParams);
   indicator.setName(UDIHelper.getMatchingIndicatorName(indicatorDefinition, pattern));
   return indicator;
 }
Ejemplo n.º 3
0
  public static List<Pattern> getPatterns(Analysis analysis) {
    List<Pattern> rets = new ArrayList<Pattern>();
    EList<Indicator> indicators = analysis.getResults().getIndicators();
    for (Indicator indicator : indicators) {
      if (indicator instanceof PatternMatchingIndicator) {
        IndicatorParameters parameters = ((PatternMatchingIndicator) indicator).getParameters();
        if (null != parameters && null != parameters.getDataValidDomain()) {
          rets.addAll(parameters.getDataValidDomain().getPatterns());
        }
      }
      // MOD scorreia 2009-10-07 User defined matching indicator is NOT a pattern matching
      // indicator.
      // else if (indicator instanceof UserDefIndicator) {
      // if
      // (IndicatorCategoryHelper.isUserDefMatching(getIndicatorCategory(indicator.getIndicatorDefinition())))
      // {
      // rets.addAll(((UserDefIndicator)
      // indicator).getParameters().getDataValidDomain().getPatterns());
      // }
      // }

      // MOD yyi 2010-08-03 14292 Add dependency for children indicator in Column Set analysis
      if (indicator instanceof AllMatchIndicator) {
        EList<RegexpMatchingIndicator> list =
            ((AllMatchIndicator) indicator).getCompositeRegexMatchingIndicators();
        for (RegexpMatchingIndicator pattern : list) {
          IndicatorParameters parameters = pattern.getParameters();
          if (null != parameters && null != parameters.getDataValidDomain()) {
            rets.addAll(parameters.getDataValidDomain().getPatterns());
          }
        }
      }
      // ~
    }
    return rets;
  }