Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/importer/AnnotationsParser.java @ 765:763c4137d6e1
Added classification of annotation types. Needs testing!
flys-backend/trunk@2162 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 19 Jun 2011 12:26:12 +0000 |
parents | 8076f6a689d0 |
children | aa9e3da95c31 |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/AnnotationsParser.java Sat Jun 18 20:13:31 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/AnnotationsParser.java Sun Jun 19 12:26:12 2011 +0000 @@ -31,15 +31,30 @@ protected HashMap<String, ImportAttribute> attributes; protected HashMap<String, ImportPosition> positions; protected TreeSet<ImportAnnotation> annotations; + protected AnnotationClassifier classifier; public AnnotationsParser() { + this(null); + } + + public AnnotationsParser(AnnotationClassifier classifier) { attributes = new HashMap<String, ImportAttribute>(); positions = new HashMap<String, ImportPosition>(); annotations = new TreeSet<ImportAnnotation>(); + this.classifier = classifier; } public void parseFile(File file) throws IOException { log.info("parsing km file: '" + file + "'"); + + ImportAnnotationType defaultIAT = null; + + if (classifier != null) { + defaultIAT = classifier.classifyFile( + file.getName(), + classifier.getDefaultType()); + } + LineNumberReader in = null; try { in = @@ -124,7 +139,9 @@ ImportRange range = new ImportRange(from, to); - ImportAnnotationType type = null; // TODO: do classification + ImportAnnotationType type = classifier != null + ? classifier.classifyDescription(line, defaultIAT) + : null; ImportAnnotation annotation = new ImportAnnotation( attribute, position, range, edge, type);