Search in sources :

Example 1 with PatternSwitch

use of org.talend.dataquality.domain.pattern.util.PatternSwitch in project tdq-studio-se by Talend.

the class UpdateSomePatternToMatchMysql method retirePattern.

/**
 * DOC rli Comment method "retireAnalysis".
 *
 * @param fileResource
 * @return
 */
private Pattern retirePattern(Resource fileResource) {
    EList<EObject> contents = fileResource.getContents();
    if (contents.isEmpty()) {
        // $NON-NLS-1$
        log.error(DefaultMessagesImpl.getString("UpdateSomePatternToMatchMysql_logErr", fileResource));
    }
    if (log.isDebugEnabled()) {
        // $NON-NLS-1$
        log.debug("No elements in contents " + contents.size());
    }
    PatternSwitch<Pattern> mySwitch = new PatternSwitch<Pattern>() {

        @Override
        public Pattern casePattern(Pattern object) {
            return object;
        }
    };
    Pattern pattern = null;
    if (contents != null && contents.size() != 0) {
        pattern = mySwitch.doSwitch(contents.get(0));
    }
    return pattern;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) EObject(org.eclipse.emf.ecore.EObject) PatternSwitch(org.talend.dataquality.domain.pattern.util.PatternSwitch)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 Pattern (org.talend.dataquality.domain.pattern.Pattern)1 PatternSwitch (org.talend.dataquality.domain.pattern.util.PatternSwitch)1