1 23 24 package examples.invoice.persistclass; 25 26 import examples.invoice.persistclass.AddressAccessor; 27 import org.objectweb.jorm.api.PAccessor; 28 import org.objectweb.jorm.api.PBinding; 29 import org.objectweb.jorm.api.PException; 30 31 34 public class Address implements PAccessor, AddressAccessor, AddressIdPNG { 35 private String name; 36 private String street; 37 private String zip; 38 private String town; 39 private String country; 40 private PBinding pBinding; 41 42 public String pnGetAdrname(Object ctx) throws PException { 43 return name; 44 } 45 46 public String pnGetAdrtown(Object ctx) throws PException { 47 return town; 48 } 49 50 public String pnGetAdrstreet(Object ctx) throws PException { 51 return street; 52 } 53 54 public PBinding getPBinding() { 55 return pBinding; 56 } 57 58 61 public Address(Object conn, PBinding pb, String n, String s, String z, String t, String c) throws PException { 62 pBinding = pb; 63 name = n; 64 street = s; 65 zip = (z == null) ? "38000" : z; 66 town = (t == null) ? "Grenoble" : t; 67 country = (c == null) ? "France" : c; 68 pBinding.export(conn, this); 69 pBinding.write(conn, this); 70 } 71 72 75 public Address(Object conn, PBinding pb) throws PException { 76 pBinding = pb; 77 pb.read(conn, this); 78 } 79 80 83 public void delete(Object conn) throws PException { 84 pBinding.unexport(conn); 85 pBinding.write(conn, this); 86 pBinding = null; 87 } 88 89 92 public String toPrintable() throws PException { 93 return "ID: [" + pBinding.getPName().encodeString() + "] - VALUE: [name: " + name + ", street: " + street + ", zip: " + zip + ", town: " + town + ", country: " + country + "]"; 94 } 95 96 98 public Object getMemoryInstance() { 99 return this; 100 } 101 102 104 public void paSetName(String val) throws PException { 106 name = val; 107 } 108 109 public String paGetName() throws PException { 110 return name; 111 } 112 113 public void paSetZip(String val) throws PException { 115 zip = val; 116 } 117 118 public String paGetZip() throws PException { 119 return zip; 120 } 121 122 public void paSetTown(String val) throws PException { 124 town = val; 125 } 126 127 public String paGetTown() throws PException { 128 return town; 129 } 130 131 public void paSetCountry(String val) throws PException { 133 country = val; 134 } 135 136 public String paGetCountry() throws PException { 137 return country; 138 } 139 140 public void paSetStreet(String val) throws PException { 142 street = val; 143 } 144 145 public String paGetStreet() throws PException { 146 return street; 147 } 148 } 149 | Popular Tags |