/** * Model Change of a monitored Table. Called after PO.beforeSave/PO.beforeDelete when you called * addModelChange for the table * * @param po persistent object * @param type TYPE_ * @return error message or null * @exception Exception if the recipient wishes the change to be not accept. */ public String modelChange(PO po, int type) throws Exception { if (po.get_TableName().equals("C_Order") && type == TYPE_CHANGE) { @SuppressWarnings("unused") MOrder order = (MOrder) po; if (log.isLoggable(Level.INFO)) log.info(po.toString()); } return null; } // modelChange
/** * Validate Document. Called as first step of DocAction.prepareIt when you called addDocValidate * for the table. Note that totals, etc. may not be correct. * * @param po persistent object * @param timing see TIMING_ constants * @return error message or null */ public String docValidate(PO po, int timing) { if (log.isLoggable(Level.INFO)) log.info(po.get_TableName() + " Timing: " + timing); // Ignore all after Complete events if (timing == TIMING_AFTER_COMPLETE) return null; if (timing == TIMING_BEFORE_PREPARE) { if (po.get_TableName().equals(MOrder.Table_Name)) { /** * Order Discount Example * MOrder order = (MOrder)po; String error = orderDiscount(order); * if (error != null) return error; /** Order Discount Example */ if (log.isLoggable(Level.INFO)) log.info(po.toString()); } } return null; } // docValidate