Menu

Commit [r836]  Maximize  Restore  History

Implement an example for the extension point ch.sahits.codegen.sql.manipulation

hotzst 2008-11-17

changed /examples/plugin.xml
added /examples/src/ch/sahits/codegen/example/CountryChanger.java
/examples/plugin.xml Diff Switch to side-by-side view
--- a/examples/plugin.xml
+++ b/examples/plugin.xml
@@ -7,5 +7,11 @@
             class="ch.sahits.codegen.xml.XMLParserWithoutDB">
       </xmlparser>
    </extension>
+   <extension
+         point="ch.sahits.codegen.sql.manipulation">
+      <manipulationClass
+            class="ch.sahits.codegen.example.CountryChanger">
+      </manipulationClass>
+   </extension>
 
 </plugin>
/examples/src/ch/sahits/codegen/example/CountryChanger.java Diff Switch to side-by-side view
--- a
+++ b/examples/src/ch/sahits/codegen/example/CountryChanger.java
@@ -0,0 +1,43 @@
+package ch.sahits.codegen.example;
+
+import ch.sahits.codegen.sql.generator.BasicDataManipulator;
+import ch.sahits.codegen.sql.generator.IFieldValueConverter;
+import ch.sahits.codegen.sql.model.ICurrentRecordSet;
+/**
+ * This is an example class that demonstrates the extension point
+ * ch.sahits.codegen.sql.manipulation using the Derby example
+ * databse Country
+ * @author Andi Hotz
+ * @since 1.1.0
+ */
+public class CountryChanger extends BasicDataManipulator {
+	/** This constructor must be supplied */
+	public CountryChanger(ICurrentRecordSet record) {
+		super(record);
+	}
+	/**
+	 * Register the fields to manipulate
+	 */
+	@Override
+	public void init() {
+		registerConverter("COUNTRY", new IFieldValueConverter(){
+			public String convert(Object input) {
+				return ((String)input).toLowerCase()+" changed to lower case";
+			}
+		});
+		registerConverter("COUNTRY_ISO_CODE ", new IFieldValueConverter(){
+			public String convert(Object input) {
+				return ((String)input).toLowerCase();
+			}
+		});
+		registerConverter("REGION ", new IFieldValueConverter(){
+			public String convert(Object input) {
+				return ((String)input).replace(' ', '_');
+			}
+		});
+	}
+	
+	
+	
+	
+}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.