IDRS Class Generator



The IDRS Class Generator is a utility that will increase your productivity while using the idrs by taking the bare bones information needed to collect information from a request and update/insert a record into the database. By placing a SQL statement for insert and update and the elements of a table into a text file this python based utility will create a full class ready for customization and use. For instance, if you are going to create a class to store a Person you would create a file like this :

4 INSERT INTO Person (ssn,firstName,mi,lastName,addr1,addr2,city,state,zip,email,phone) VALUES(?,?,?,?,?,?,?,?,?,?,?)
8 UPDATE Person SET ssn=?,firstName=?,mi=?,lastName=?,addr1=?,addr2=?,city=?,state=?,zip=?,email=?,phone=? WHERE ssn=?
18ssn String
2 firstName String
2 mi String
2 lastName String
2 addr1 String
2 addr2 String
2 city String
2 state String
2 zip String
2 email String
2 phone String
34 update boolean

Creates The Following Source Codes :
package com.insworld.web;

/**
 *Person
 */


import net.sourceforge.idrs.utils.*;
import java.io.*
import java.sql.*;
import net.sourceforge.idrs.utils.*;
import net.sourceforge.idrs.script.*;


public class Person extends CleanUp implements Serializable {

	protected transient String ssn;
	protected transient String firstName;
	protected transient String mi;
	protected transient String lastName;
	protected transient String addr1;
	protected transient String addr2;
	protected transient String city;
	protected transient String state;
	protected transient String zip;
	protected transient String email;
	protected transient String phone;
	protected transient boolean update;


	public Person() {
	
	
	}

	public void reInit() {
	
	}

	public void setSsn(String val) {
		this.ssn = val;
	}

	public String getSsn() {
		return this.ssn;
	}

	public void setFirstName(String val) {
		this.firstName = val;
	}

	public String getFirstName() {
		return this.firstName;
	}

	public void setMi(String val) {
		this.mi = val;
	}

	public String getMi() {
		return this.mi;
	}

	public void setLastName(String val) {
		this.lastName = val;
	}

	public String getLastName() {
		return this.lastName;
	}

	public void setAddr1(String val) {
		this.addr1 = val;
	}

	public String getAddr1() {
		return this.addr1;
	}

	public void setAddr2(String val) {
		this.addr2 = val;
	}

	public String getAddr2() {
		return this.addr2;
	}

	public void setCity(String val) {
		this.city = val;
	}

	public String getCity() {
		return this.city;
	}

	public void setState(String val) {
		this.state = val;
	}

	public String getState() {
		return this.state;
	}

	public void setZip(String val) {
		this.zip = val;
	}

	public String getZip() {
		return this.zip;
	}

	public void setEmail(String val) {
		this.email = val;
	}

	public String getEmail() {
		return this.email;
	}

	public void setPhone(String val) {
		this.phone = val;
	}

	public String getPhone() {
		return this.phone;
	}

	public void setUpdate(String val) {
		this.update = "true".eqaulsIgnoreCase(val);
	}

	public boolean getUpdate() {
		return this.update;
	}



	public Integer saveData(IDRSScript idrs, Connection con) throws Exception {
		PreparedStatement ps;

		if (this.update) {
			ps = con.prepareStatement("UPDATE Person SET ssn=?,firstName=?,mi=?,lastName=?,addr1=?,addr2=?,city=?,state=?,zip=?,email=?,phone=? WHERE ssn=?");
			jan.regStatement(ps);
			ps.setString(1,this.firstName);
			ps.setString(2,this.mi);
			ps.setString(3,this.lastName);
			ps.setString(4,this.addr1);
			ps.setString(5,this.addr2);
			ps.setString(6,this.city);
			ps.setString(7,this.state);
			ps.setString(8,this.zip);
			ps.setString(9,this.email);
			ps.setString(10,this.phone);
			ps.setString(11,this.ssn);
		}
		else {
			ps = con.prepareStatement("INSERT INTO Person (ssn,firstName,mi,lastName,addr1,addr2,city,state,zip,email,phone) VALUES(?,?,?,?,?,?,?,?,?,?,?)");
			jan.regStatement(ps);
			ps.setString(1,this.ssn);
			ps.setString(2,this.firstName);
			ps.setString(3,this.mi);
			ps.setString(4,this.lastName);
			ps.setString(5,this.addr1);
			ps.setString(6,this.addr2);
			ps.setString(7,this.city);
			ps.setString(8,this.state);
			ps.setString(9,this.zip);
			ps.setString(10,this.email);
			ps.setString(11,this.phone);
		}
		int result;

		try {
			result = ps.executeUpdate();
		}
		catch (Exception e) {
			this.isErr = true;
			this.error = "Patient Information Could Not Be Saved : " + e.toString();
			return false;
		}
		if (result < 1) {
			this.error = "Patient Information Could Not Be Saved";
			return false;
		}
		return true;

	}

}




Just 5 lines in a text file becomes 189 lines in a matter of seconds! The code generated is well formated and ready for use by developers. It may not allways generate classes ready immediatly for production use, but it does eliminate most of the repetetive code involved in creating IDRS classes.
For $50.00 You Will Get:


If you would like to purchase this useful tool, just click on the PayPal button below. On payment you will be emailed the script.