Commits

tbrugz committed e01a5e1

model: ExecutableObject: added get/set

Comments (0)

Files changed (6)

src/tbrugz/sqldump/SchemaModelScriptDumper.java

 		for(ExecutableObject eo: schemaModel.getExecutables()) {
 			// TODOne categorizedOut(eo.schemaName, eo.name, DBObjectType.EXECUTABLE,
 			if(eo.body!=null) {
-				categorizedOut(eo.getSchemaName(), eo.getName(), eo.type, 
-					"-- Executable: "+eo.type+" "+eo.getName()+"\n"
+				categorizedOut(eo.getSchemaName(), eo.getName(), eo.getType(), 
+					"-- Executable: "+eo.getType()+" "+eo.getName()+"\n"
 					+eo.getDefinition(dumpWithSchemaName)+"\n");
 			}
 			else {
-				log.debug("executable with no body (not dumped) ["+eo.getSchemaName()+"."+eo.getName()+"::"+eo.type+" ; package="+eo.packageName+"]");
+				log.debug("executable with no body (not dumped) ["+eo.getSchemaName()+"."+eo.getName()+"::"+eo.getType()+" ; package="+eo.getPackageName()+"]");
 			}
 		}
 

src/tbrugz/sqldump/dbmodel/ExecutableObject.java

 public class ExecutableObject extends DBObject {
 
 	//public String type;
-	public DBObjectType type;
+	DBObjectType type;
 	public String body;
 	public List<Grant> grants = new ArrayList<Grant>(); //XXX: should be Set<Grant>?
 
-	public String packageName;
-	public List<ExecutableParameter> params;
-	public ExecutableParameter returnParam;
+	String packageName;
+	List<ExecutableParameter> params;
+	ExecutableParameter returnParam;
 	
 	@Override
 	public String getDefinition(boolean dumpSchemaName) {
 			return false;
 		return true;
 	}
+
+	public DBObjectType getType() {
+		return type;
+	}
+
+	public void setType(DBObjectType type) {
+		this.type = type;
+	}
+
+	public String getPackageName() {
+		return packageName;
+	}
+
+	public void setPackageName(String packageName) {
+		this.packageName = packageName;
+	}
+
+	public List<ExecutableParameter> getParams() {
+		return params;
+	}
+
+	public void setParams(List<ExecutableParameter> params) {
+		this.params = params;
+	}
+
+	public ExecutableParameter getReturnParam() {
+		return returnParam;
+	}
+
+	public void setReturnParam(ExecutableParameter returnParam) {
+		this.returnParam = returnParam;
+	}
 	
 }

src/tbrugz/sqldump/dbmsfeatures/InformationSchemaFeatures.java

 				eo.setSchemaName( schemaPattern );
 				eo.setName( routineName );
 				try {
-					eo.type = DBObjectType.valueOf(Utils.normalizeEnumStringConstant(rs.getString(2)));
+					eo.setType( DBObjectType.valueOf(Utils.normalizeEnumStringConstant(rs.getString(2))) );
 				}
 				catch(IllegalArgumentException iae) {
 					log.warn("unknown object type: "+rs.getString(2));
-					eo.type = DBObjectType.EXECUTABLE;
+					eo.setType( DBObjectType.EXECUTABLE );
 				}
 				eo.returnType = rs.getString(3);
 				eo.externalLanguage = rs.getString(4);

src/tbrugz/sqldump/dbmsfeatures/InformationSchemaRoutine.java

 			}
 		}
 		
-		return "create or replace "+type+" "+getName()+"("
+		return "create or replace "+getType()+" "+getName()+"("
 				+(sb!=null?sb.toString():"")
 				+")\n  returns "+returnType+" as \n$BODY$"
 				+body+"$BODY$"

src/tbrugz/sqldump/dbmsfeatures/OracleFeatures.java

 				sb = new StringBuffer();
 				eo.setName( rs.getString(1) );
 				try {
-					eo.type = DBObjectType.valueOf(Utils.normalizeEnumStringConstant(rs.getString(2)));
+					eo.setType( DBObjectType.valueOf(Utils.normalizeEnumStringConstant(rs.getString(2))) );
 				}
 				catch(IllegalArgumentException iae) {
 					log.warn("unknown object type: "+rs.getString(2));
-					eo.type = DBObjectType.EXECUTABLE;
+					eo.setType( DBObjectType.EXECUTABLE );
 				}
 				
 				eo.setSchemaName(schemaPattern);
 				
-				if(grabExecutablePrivileges && !eo.type.equals(DBObjectType.PACKAGE_BODY)) {
+				if(grabExecutablePrivileges && !eo.getType().equals(DBObjectType.PACKAGE_BODY)) {
 					//XXX: optimize it: make one query instead of many
 					grabExecutablePrivileges(eo, schemaPattern, conn);
 				}
 				DBObjectType otype = DBObjectType.valueOf(objectType);
 				switch(otype) {
 				case PACKAGE:
-					eo.packageName = objectName;
+					eo.setPackageName(objectName);
 					eo.setName(subprogramName);
-					eo.type = DBObjectType.valueOf(subprogramType);
+					eo.setType(DBObjectType.valueOf(subprogramType));
 					break;
 				default: //top-level procedure or function
 					eo.setName(objectName);
-					eo.type = otype;
+					eo.setType(otype);
 				}
 				
 				model.getExecutables().add(eo);
 			}
 			//log.info("parameter: "+ep);
 			if(ep.position==0) {
-				eo.returnParam = ep;
+				eo.setReturnParam(ep);
 			}
 			else {
-				if(eo.params==null) {
-					eo.params = new ArrayList<ExecutableParameter>();
+				if(eo.getParams()==null) {
+					eo.setParams(new ArrayList<ExecutableParameter>());
 				}
-				eo.params.add(ep);
+				eo.getParams().add(ep);
 			}
 			paramCount++;
 		}

src/tbrugz/sqldump/dbmsfeatures/PostgreSQLFeatures.java

 			eo.setSchemaName( schemaPattern );
 			eo.setName( rs.getString(1) );
 			try {
-				eo.type = DBObjectType.valueOf(Utils.normalizeEnumStringConstant(rs.getString(2)));
+				eo.setType( DBObjectType.valueOf(Utils.normalizeEnumStringConstant(rs.getString(2))) );
 			}
 			catch(IllegalArgumentException iae) {
 				log.warn("unknown object type: "+rs.getString(2));
-				eo.type = DBObjectType.EXECUTABLE;
+				eo.setType( DBObjectType.EXECUTABLE );
 			}
 			eo.returnType = rs.getString(3);
 			eo.externalLanguage = rs.getString(4);