empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1185525 - in /incubator/empire-db/trunk/empire-db-codegen: config.xml src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java src/main/java/org/apache/empire/db/codegen/WriterService.java
Date Tue, 18 Oct 2011 08:15:53 GMT
Author: doebele
Date: Tue Oct 18 08:15:52 2011
New Revision: 1185525

URL: http://svn.apache.org/viewvc?rev=1185525&view=rev
Log:
EMPIREDB-117
minor bugfix regarding camel casing

Modified:
    incubator/empire-db/trunk/empire-db-codegen/config.xml
    incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java
    incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/WriterService.java

Modified: incubator/empire-db/trunk/empire-db-codegen/config.xml
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/config.xml?rev=1185525&r1=1185524&r2=1185525&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/config.xml (original)
+++ incubator/empire-db/trunk/empire-db-codegen/config.xml Tue Oct 18 08:15:52 2011
@@ -58,6 +58,7 @@
 		<nestTables>true</nestTables>
 		<nestViews>false</nestViews>
 		<createRecordProperties>true</createRecordProperties>
+		<preserverCharacterCase>false</preserverCharacterCase>
 		<preserveRelationNames>false</preserveRelationNames>
 	</properties>
 	

Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java?rev=1185525&r1=1185524&r2=1185525&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java
Tue Oct 18 08:15:52 2011
@@ -211,6 +211,11 @@ public class CodeGenConfig extends XMLCo
 	private boolean createRecordProperties;
 	
 	/**
+	 * true if names of tables and views should not be camel-cased
+	 */
+	private boolean preserverCharacterCase = false;
+	
+	/**
 	 * true if names of foreign-key-relations should be preserved
 	 */
 	private boolean preserveRelationNames = false; 
@@ -483,6 +488,14 @@ public class CodeGenConfig extends XMLCo
 	public void setCreateRecordProperties(boolean createRecordProperties) {
 		this.createRecordProperties = createRecordProperties;
 	}
+	
+	public boolean isPreserverCharacterCase() {
+		return preserverCharacterCase;
+	}
+
+	public void setPreserverCharacterCase(boolean preserverCharacterCase) {
+		this.preserverCharacterCase = preserverCharacterCase;
+	}
 
 	public boolean isPreserveRelationNames() {
 		return preserveRelationNames;

Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/WriterService.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/WriterService.java?rev=1185525&r1=1185524&r2=1185525&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/WriterService.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/WriterService.java
Tue Oct 18 08:15:52 2011
@@ -284,15 +284,22 @@ public class WriterService {
 	 */
 	private String deriveClassName(String name)
 	{
+		// PreserverCharacterCase
+		if (config.isPreserverCharacterCase()) {
+			return name;
+		}
+		// Build camel case string
 		StringBuilder sb = new StringBuilder();
 		sb.append(Character.toUpperCase(name.charAt(0)));
 		// Tables might already be camel case. Let's skip this if no '_' anywhere.
+		/*
 		if(name.substring(1).indexOf('_') <= 0)
 		{
 			if(name.length() > 1)
-				sb.append(name.substring(1));
+				sb.append(name.substring(1).toLowerCase());
 			return sb.toString();
 		}
+		*/
 		boolean nextCharacterUppercase = false;
 		for (int i = 1; i < name.length(); i++) 
 		{



Mime
View raw message