r53418 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53417‎ | r53418 | r53419 >
Date:21:39, 17 July 2009
Author:daniel
Status:deferred
Tags:
Comment:
conveniance functions
Modified paths:
  • /trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/data/FeatureMapping.java (modified) (history)
  • /trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/data/FeatureSetValueMapper.java (modified) (history)
  • /trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/store/IntegratorSchema.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/data/FeatureMapping.java
@@ -5,6 +5,7 @@
66 import de.brightbyte.abstraction.MultiMapAbstractor;
77 import de.brightbyte.abstraction.PropertyAccessor;
88 import de.brightbyte.data.Functor;
 9+import de.brightbyte.data.Functors;
910 import de.brightbyte.wikiword.integrator.FeatureSetSourceDescriptor;
1011
1112 public class FeatureMapping extends PropertyMapping<FeatureSet> {
@@ -21,4 +22,8 @@
2223 String feature = source.getTweak(option, null);
2324 if (feature!=null) addMapping(field, feature, type, aggregator);
2425 }
 26+
 27+ public void addMapping(String field, String feature) {
 28+ addMapping(field, feature, Object.class, Functors.<String>firstElement());
 29+ }
2530 }
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/data/FeatureSetValueMapper.java
@@ -1,10 +1,25 @@
22 package de.brightbyte.wikiword.integrator.data;
33
 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+
411 public class FeatureSetValueMapper implements FeatureSetMangler {
512
613 protected FeatureMapping mapping;
714
 15+ public FeatureSetValueMapper() {
 16+ this(new FeatureMapping());
 17+ }
818
 19+ public FeatureSetValueMapper(FeatureMapping mapping) {
 20+ if (mapping==null) throw new NullPointerException();
 21+ this.mapping = mapping;
 22+ }
 23+
924 public FeatureSet apply(FeatureSet features) {
1025 FeatureSet ft = new DefaultFeatureSet();
1126
@@ -17,4 +32,20 @@
1833 return ft;
1934 }
2035
 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+
2152 }
Index: trunk/WikiWord/WikiWordIntegrator/src/main/java/de/brightbyte/wikiword/integrator/store/IntegratorSchema.java
@@ -1,7 +1,6 @@
22 package de.brightbyte.wikiword.integrator.store;
33
44 import java.sql.Connection;
5 -import java.sql.ResultSet;
65 import java.sql.SQLException;
76
87 import javax.sql.DataSource;
@@ -9,7 +8,6 @@
109 import de.brightbyte.db.DatabaseField;
1110 import de.brightbyte.db.DatabaseKey;
1211 import de.brightbyte.db.DatabaseTable;
13 -import de.brightbyte.db.EntityTable;
1412 import de.brightbyte.db.KeyType;
1513 import de.brightbyte.db.ReferenceField;
1614 import de.brightbyte.db.RelationTable;

Status & tagging log