1 64 65 package com.jcorporate.expresso.ext.dbobj.regobj; 66 67 import com.jcorporate.expresso.core.db.DBConnection; 68 import com.jcorporate.expresso.core.db.DBException; 69 import com.jcorporate.expresso.core.dbobj.RequestContext; 70 import com.jcorporate.expresso.core.misc.DateTime; 71 import com.jcorporate.expresso.services.dbobj.RegistrationDBObject; 72 73 80 public class Address extends RegistrationDBObject { 81 82 87 public Address() throws DBException { 88 super(); 89 } 90 91 92 98 public Address(DBConnection myConnection) throws DBException { 99 super(myConnection); 100 } 101 102 103 110 public Address(int uid) throws DBException { 111 super(uid); 112 } 113 114 121 public Address(RequestContext request) throws DBException { 122 super(request); 123 } 124 125 128 public void add() throws DBException { 129 setField("AddedOn", DateTime.getDateTimeForDB(this.getDataContext())); 130 setField("UpdatedOn", DateTime.getDateTimeForDB(this.getDataContext())); 131 132 super.add(); 133 134 135 } 136 137 138 142 public void setupFields() throws DBException { 143 setTargetTable("SMPREGAD"); 144 setDescription("Home or Business Mailing Address"); 145 setCharset("ISO-8859-1"); 146 147 148 addField("AddressID", "auto-inc", 0, false, "Street ID"); 149 addField("ExpUid", "int", 0, false, "Person ID Number"); 150 addField("Street1", "varchar", 100, false, "Street Address"); 151 addField("Street2", "varchar", 100, true, "Street Address (continued)"); 152 addField("City", "varchar", 40, false, "City"); 153 addField("State", "varchar", 40, false, "State/Province/Region"); 154 addField("Zip", "varchar", 40, false, "ZIP/Postal Code"); 155 addField("Country", "varchar", 40, false, "Country"); 156 157 addField("AddedOn", "datetime", 0, true, "Added On"); 158 addField("UpdatedOn", "datetime", 0, true, "Updated On"); 159 setReadOnly("AddedOn"); 160 setReadOnly("UpdatedOn"); 161 162 163 setReadOnly("AddressID"); 164 addKey("AddressID"); 165 setLookupObject("ExpUid", "com.jcorporate.expresso.security.dbobj.DefaultUserInfo"); 166 addKey("ExpUid"); 167 168 } 169 170 173 174 175 public void update() throws DBException { 176 setField("UpdatedOn", DateTime.getDateTimeForDB(this.getDataContext())); 177 super.update(); 178 179 } 180 } | Popular Tags |