Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/data/FeatureMapping.java |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | import de.brightbyte.abstraction.MultiMapAbstractor; |
7 | 7 | import de.brightbyte.abstraction.PropertyAccessor; |
8 | 8 | import de.brightbyte.data.Functor; |
| 9 | +import de.brightbyte.data.Functors; |
9 | 10 | import de.brightbyte.wikiword.integrator.FeatureSetSourceDescriptor; |
10 | 11 | |
11 | 12 | public class FeatureMapping extends PropertyMapping<FeatureSet> { |
— | — | @@ -21,4 +22,8 @@ |
22 | 23 | String feature = source.getTweak(option, null); |
23 | 24 | if (feature!=null) addMapping(field, feature, type, aggregator); |
24 | 25 | } |
| 26 | + |
| 27 | + public void addMapping(String field, String feature) { |
| 28 | + addMapping(field, feature, Object.class, Functors.<String>firstElement()); |
| 29 | + } |
25 | 30 | } |
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/data/FeatureSetValueMapper.java |
— | — | @@ -1,10 +1,25 @@ |
2 | 2 | package de.brightbyte.wikiword.integrator.data; |
3 | 3 | |
| 4 | +import java.util.Collection; |
| 5 | + |
| 6 | +import de.brightbyte.abstraction.PropertyAccessor; |
| 7 | +import de.brightbyte.data.Functor; |
| 8 | +import de.brightbyte.data.Functors; |
| 9 | +import de.brightbyte.wikiword.integrator.FeatureSetSourceDescriptor; |
| 10 | + |
4 | 11 | public class FeatureSetValueMapper implements FeatureSetMangler { |
5 | 12 | |
6 | 13 | protected FeatureMapping mapping; |
7 | 14 | |
| 15 | + public FeatureSetValueMapper() { |
| 16 | + this(new FeatureMapping()); |
| 17 | + } |
8 | 18 | |
| 19 | + public FeatureSetValueMapper(FeatureMapping mapping) { |
| 20 | + if (mapping==null) throw new NullPointerException(); |
| 21 | + this.mapping = mapping; |
| 22 | + } |
| 23 | + |
9 | 24 | public FeatureSet apply(FeatureSet features) { |
10 | 25 | FeatureSet ft = new DefaultFeatureSet(); |
11 | 26 | |
— | — | @@ -17,4 +32,20 @@ |
18 | 33 | return ft; |
19 | 34 | } |
20 | 35 | |
| 36 | + public <T> void addMapping(String field, FeatureSetSourceDescriptor source, String option, Class<T> type, Functor<?, ? extends Collection<?>> aggregator) { |
| 37 | + mapping.addMapping(field, source, option, type, aggregator); |
| 38 | + } |
| 39 | + |
| 40 | + public void addMapping(String field, PropertyAccessor<FeatureSet, ?> accessor) { |
| 41 | + mapping.addMapping(field, accessor); |
| 42 | + } |
| 43 | + |
| 44 | + public <T> void addMapping(String field, String feature, Class<T> type, Functor<?, ? extends Collection<?>> aggregator) { |
| 45 | + mapping.addMapping(field, feature, type, aggregator); |
| 46 | + } |
| 47 | + |
| 48 | + public <T> void addMapping(String field, String feature) { |
| 49 | + mapping.addMapping(field, feature); |
| 50 | + } |
| 51 | + |
21 | 52 | } |
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/store/IntegratorSchema.java |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | package de.brightbyte.wikiword.integrator.store; |
3 | 3 | |
4 | 4 | import java.sql.Connection; |
5 | | -import java.sql.ResultSet; |
6 | 5 | import java.sql.SQLException; |
7 | 6 | |
8 | 7 | import javax.sql.DataSource; |
— | — | @@ -9,7 +8,6 @@ |
10 | 9 | import de.brightbyte.db.DatabaseField; |
11 | 10 | import de.brightbyte.db.DatabaseKey; |
12 | 11 | import de.brightbyte.db.DatabaseTable; |
13 | | -import de.brightbyte.db.EntityTable; |
14 | 12 | import de.brightbyte.db.KeyType; |
15 | 13 | import de.brightbyte.db.ReferenceField; |
16 | 14 | import de.brightbyte.db.RelationTable; |