package com.tenwa.message; import jbo.sys.MSG_CONFIG; import java.util.Base64; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.are.util.StringFunction; import com.amarsoft.awe.dw.handler.impl.CommonHandler; public class MsgTempletInfoHandler extends CommonHandler { @Override protected void initDisplayForAdd(BizObject bo) throws Exception { super.initDisplayForAdd(bo); String today = StringFunction.getTodayNow(); bo.setAttributeValue("INPUTTIME", today.split(" ")[0]); bo.setAttributeValue("UPDATETIME", today.split(" ")[0]); } @Override protected void initDisplayForEdit(BizObject bo) throws Exception { // TODO Auto-generated method stub super.initDisplayForEdit(bo); String today = StringFunction.getTodayNow(); bo.setAttributeValue("UPDATETIME", today.split(" ")[0]); } @Override protected void afterUpdate(JBOTransaction tx, BizObject bo) throws Exception { String today = StringFunction.getTodayNow(); bo.setAttributeValue("UPDATETIME", today.split(" ")[0]); } @Override protected void beforeInsert(JBOTransaction tx, BizObject bo) throws Exception { String today = StringFunction.getTodayNow(); String msgSql = bo.getAttribute(MSG_CONFIG.MSG_SQL).toString(); msgSql = msgSql.substring(7); bo.setAttributeValue(MSG_CONFIG.MSG_SQL, new String(Base64.getDecoder().decode(msgSql), "utf-8")); bo.setAttributeValue("UPDATETIME", today.split(" ")[0]); } @Override protected void beforeUpdate(JBOTransaction tx, BizObject bo) throws Exception { String today = StringFunction.getTodayNow(); String msgSql = bo.getAttribute(MSG_CONFIG.MSG_SQL).toString(); msgSql = msgSql.substring(7); bo.setAttributeValue(MSG_CONFIG.MSG_SQL, new String(Base64.getDecoder().decode(msgSql), "utf-8")); bo.setAttributeValue("UPDATETIME", today.split(" ")[0]); } }