Menu

Commit [r3096]  Maximize  Restore  History

Added method setPsudoDatabase for usage of the database model builder for models that do not represent a database

hotzst 2010-02-18

changed /trunk/ch.sahits.model/src/ch/sahits/model/internal/java/GeneratedJavaDBClassBuilder.java
changed /trunk/ch.sahits.model/src/ch/sahits/model/internal/java/JavaDataBaseTableBuilder.java
changed /trunk/ch.sahits.model/src/ch/sahits/model/java/IGeneratedJavaDBClassBuilder.java
changed /trunk/ch.sahits.model/src/ch/sahits/model/java/db/IJavaDataBaseTableBuilder.java
/trunk/ch.sahits.model/src/ch/sahits/model/internal/java/GeneratedJavaDBClassBuilder.java Diff Switch to side-by-side view
--- a/trunk/ch.sahits.model/src/ch/sahits/model/internal/java/GeneratedJavaDBClassBuilder.java
+++ b/trunk/ch.sahits.model/src/ch/sahits/model/internal/java/GeneratedJavaDBClassBuilder.java
@@ -13,6 +13,8 @@
 	 * Name of the database product
 	 */
 	String dbProductName=null;
+	/** Flag indicating the pseudo database use */
+	private boolean pseudoDB=false;
 	/**
 	 * Set the database product name
 	 * @param dbProductName
@@ -38,7 +40,7 @@
 	@Override
 	protected void validate() {
 		super.validate();
-		if (dbProductName==null) throw new NullPointerException("The database product may not be null");
+		if (dbProductName==null && !pseudoDB) throw new NullPointerException("The database product may not be null");
 	}
 	/**
 	 * Initialize the builder with a model
@@ -50,6 +52,14 @@
 		this.dbProductName(model.getDbProductName());
 		return this;
 	}
-	
+	/**
+	 * Set a flag that indicates, that the structures of a database is used but not
+	 * its fully internal representation. This takes effect ven validating the builder
+	 * before the build method is completed
+	 * @param isPseudoDatabase
+	 */
+	public void setPseudeDatabase(boolean isPseudoDatabase){
+		this.pseudoDB=isPseudoDatabase;
+	}
 
 }
/trunk/ch.sahits.model/src/ch/sahits/model/internal/java/JavaDataBaseTableBuilder.java Diff Switch to side-by-side view
--- a/trunk/ch.sahits.model/src/ch/sahits/model/internal/java/JavaDataBaseTableBuilder.java
+++ b/trunk/ch.sahits.model/src/ch/sahits/model/internal/java/JavaDataBaseTableBuilder.java
@@ -7,8 +7,6 @@
 import ch.sahits.model.db.IBasicDataBaseTable;
 import ch.sahits.model.db.IDatabaseTableField;
 import ch.sahits.model.db.IDatabaseTableIndex;
-import ch.sahits.model.java.IGeneratedJavaDBClass2;
-import ch.sahits.model.java.IGeneratedJavaDBClassBuilder;
 import ch.sahits.model.java.db.IJavaDataBaseTableBuilder;
 import ch.sahits.model.java.db.IJavaDatabaseTable;
 /**
@@ -53,6 +51,8 @@
 	 * List of all indexes for this table
 	 */
 	public List<IDatabaseTableIndex> indexes=new ArrayList<IDatabaseTableIndex>();
+	/** Flag indicating the pseudo database use */
+	private boolean pseudoDB=false;
 	/**
 	 * Set the database name
 	 * @param dbName
@@ -153,7 +153,7 @@
 //		if (host==null) throw new NullPointerException("The host may not be null");
 //		if (password==null) throw new NullPointerException("The password may not be null");
 //		if (port==null) throw new NullPointerException("The port may not be null");
-		if (tableName==null) throw new NullPointerException("The table name may not be null"); //$NON-NLS-1$
+		if (tableName==null && !pseudoDB) throw new NullPointerException("The table name may not be null"); //$NON-NLS-1$
 //		if (userName==null) throw new NullPointerException("The user name may not be null");
 	}
 	/**
@@ -225,6 +225,16 @@
 		}
 		return null;
 	}
-	
+	/**
+	 * Set a flag that indicates, that the structures of a database is used but not
+	 * its fully internal representation. This takes effect ven validating the builder
+	 * before the build method is completed
+	 * @param isPseudoDatabase
+	 */
+	@Override
+	public void setPseudeDatabase(boolean isPseudoDatabase){
+		super.setPseudeDatabase(isPseudoDatabase);
+		this.pseudoDB=isPseudoDatabase;
+	}	
 
 }
/trunk/ch.sahits.model/src/ch/sahits/model/java/IGeneratedJavaDBClassBuilder.java Diff Switch to side-by-side view
--- a/trunk/ch.sahits.model/src/ch/sahits/model/java/IGeneratedJavaDBClassBuilder.java
+++ b/trunk/ch.sahits.model/src/ch/sahits/model/java/IGeneratedJavaDBClassBuilder.java
@@ -19,5 +19,12 @@
 	 * @return this
 	 */
 	public IGeneratedJavaDBClassBuilder databaseTable(IGeneratedJavaDBClass2 model);
+	/**
+	 * Set a flag that indicates, that the structures of a database is used but not
+	 * its fully internal representation. This takes effect ven validating the builder
+	 * before the build method is completed
+	 * @param isPseudoDatabase
+	 */
+	public void setPseudeDatabase(boolean isPseudoDatabase);
 
 }
\ No newline at end of file
/trunk/ch.sahits.model/src/ch/sahits/model/java/db/IJavaDataBaseTableBuilder.java Diff Switch to side-by-side view
Loading...
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.