1 64 65 package com.jcorporate.expresso.services.controller.dbmaint; 66 67 import com.jcorporate.expresso.core.controller.ControllerException; 68 import com.jcorporate.expresso.core.controller.ControllerRequest; 69 import com.jcorporate.expresso.core.controller.ControllerResponse; 70 import com.jcorporate.expresso.core.controller.ErrorCollection; 71 import com.jcorporate.expresso.core.controller.NonHandleableException; 72 import com.jcorporate.expresso.core.controller.Output; 73 import com.jcorporate.expresso.core.dataobjects.DataObject; 74 import com.jcorporate.expresso.core.db.DBException; 75 76 77 85 public class UpdateDelete 86 extends UpdateBase { 87 public UpdateDelete() { 88 } 89 90 96 public UpdateDelete(String code, String descrip) { 97 super(code, descrip); 98 } 99 100 106 public void run(ControllerRequest req, ControllerResponse res) 107 throws NonHandleableException, ControllerException { 108 super.run(req, res); 109 110 DataObject myDBObj = this.getDataObject(); 111 ErrorCollection ee = new ErrorCollection(); 112 113 try { 114 retrieveMyDBObject(); 115 myDBObj.delete(); 116 showPrev = false; 117 showNext = false; 118 showUserName(""); 119 addOutput(new Output("title", "Data Deleted")); 120 addOutput(new Output("message", "Record Deleted")); 121 showKey(false); 122 showOptions(); 123 clearFormCache(); 124 } catch (DBException de) { 125 ee.addError(de.getMessage()); 126 } 127 if (ee.getErrorCount() > 0) { 128 res.saveErrors(ee); 129 setResponse(getController().newState("Update", req)); 130 131 } 133 } 134 135 136 } 137 138 | Popular Tags |