89d0c2df27e2049b43f0e045f4cc7c68bbf16279.svn-base 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package xin.glue.ui.G.G06;
  2. import java.util.ArrayList;
  3. import java.util.HashMap;
  4. import java.util.List;
  5. import java.util.Map;
  6. import com.posdata.glue.biz.activity.PosActivity;
  7. import com.posdata.glue.biz.constants.PosBizControlConstants;
  8. import com.posdata.glue.component.layout.PosMessageLayoutIF;
  9. import com.posdata.glue.context.PosContext;
  10. import com.posdata.glue.dao.vo.PosParameter;
  11. import com.posdata.glue.dao.vo.PosRow;
  12. import com.posdata.glue.dao.vo.PosRowSet;
  13. import com.posdata.glue.msg.PosMESMessageImpl;
  14. import com.posdata.glue.msg.PosMessageAttributeDefinition;
  15. import com.posdata.glue.msg.PosMessageDefinition;
  16. import com.posdata.glue.util.log.PosLog;
  17. import com.posdata.glue.util.log.PosLogFactory;
  18. public class XinMessageLayoutEdit extends PosActivity {
  19. private final PosLog log = PosLogFactory.getLogger(getClass());
  20. public String runActivity(PosContext context) {
  21. log.logInfo("======== XinMessageLayoutEdit start " );
  22. String[] TC_ID = (String[])context.get("TC_ID");
  23. log.logInfo("======== XinMessageLayoutEdit TC_ID:"+TC_ID[0] );
  24. List list = new ArrayList();
  25. String sSeqNo = null;
  26. String sMsgid = null;
  27. String sMsgName = null;
  28. String sMsgType = null;
  29. String sMsgLen = null;
  30. String sDataValue = null;
  31. PosParameter param1 = new PosParameter();
  32. param1.setWhereClauseParameter(0, TC_ID[0]);
  33. PosRowSet msgVO = this.getDao("mesdao").find("UIG060010_MSG_EDIT.select", param1);
  34. if ( msgVO.hasNext() ) {
  35. while(msgVO.hasNext()) {
  36. PosRow msgROW = msgVO.next();
  37. sSeqNo = (String)msgROW.getAttribute("SEQ_NO");
  38. sMsgid = (String)msgROW.getAttribute("MSG_ID");
  39. sMsgName = (String)msgROW.getAttribute("MSG_NAME");
  40. sMsgType = (String)msgROW.getAttribute("DATA_TYPE");
  41. sMsgLen = (String)msgROW.getAttribute("DATA_LEN");
  42. sDataValue = (String)msgROW.getAttribute("DATA_VALUE");
  43. /*
  44. int numSeq = Integer.parseInt(sSeqNo);
  45. if (numSeq < 10) {
  46. sSeqNo = "00"+sSeqNo;
  47. } else if (numSeq < 100) {
  48. sSeqNo = "0"+sSeqNo;
  49. }
  50. */
  51. HashMap map = new HashMap(200,6) ;
  52. list.add(map);
  53. map.put("SEQ_NO" , sSeqNo );
  54. map.put("MSG_ID" , sMsgid );
  55. map.put("MSG_NAME" , sMsgName );
  56. map.put("DATA_TYPE" , sMsgType );
  57. map.put("DATA_LEN" , sMsgLen );
  58. map.put("DATA_VALUE", sDataValue);
  59. }
  60. } else {
  61. PosMessageLayoutIF layout = (PosMessageLayoutIF) PosContext.getBeanFactory().getBeanObject("layout");
  62. PosContext ctx = new PosContext();
  63. PosMESMessageImpl message = new PosMESMessageImpl();
  64. message.setTCID(TC_ID[0]);
  65. ctx.setMessage(message);
  66. PosMessageDefinition def = layout.getAttributes(ctx);
  67. int attrsLength = def.getLength();
  68. for (int i=0; i<attrsLength; i++)
  69. {
  70. PosMessageAttributeDefinition attrDef = def.getAttribute(i);
  71. int iSeq = attrDef.getSeq();
  72. int iLen = attrDef.getLength();
  73. sSeqNo = String.valueOf(iSeq);
  74. sMsgLen = String.valueOf(iLen);
  75. int numSeq = Integer.parseInt(sSeqNo);
  76. if (numSeq < 10) {
  77. sSeqNo = "00"+sSeqNo;
  78. } else if (numSeq < 100) {
  79. sSeqNo = "0"+sSeqNo;
  80. }
  81. HashMap map = new HashMap(50,6) ;
  82. list.add(map);
  83. map.put("SEQ_NO", sSeqNo );
  84. map.put("MSG_ID", attrDef.getId() );
  85. map.put("MSG_NAME", attrDef.getName());
  86. map.put("DATA_TYPE", attrDef.getDatatype());
  87. map.put("DATA_LEN", sMsgLen);
  88. map.put("DATA_VALUE", " ");
  89. }
  90. }
  91. log.logInfo("======== displayMessageDefinitionOldVer context put :" );
  92. context.put("MessageEdit",list);
  93. return PosBizControlConstants.SUCCESS;
  94. }
  95. }