1 package com.teamkonzept.field.db; 2 3 import com.teamkonzept.db.*; 4 import de.webman.util.legacy.Legacy; 5 6 import java.sql.*; 7 8 16 public class TKContentValueTableData extends TKDBTableData{ 17 18 21 public int content_id; 22 23 26 public int content_node_id; 27 public int idx; 28 public String value; 29 public Integer mediaID; 30 31 32 public TKContentValueTableData( ) 33 { 34 } 35 36 public TKContentValueTableData( int content_id, int content_node_id, int idx, String value) 37 { 38 this(content_id, content_node_id, idx, value, null); 39 } 40 41 public TKContentValueTableData( int content_id, int content_node_id, int idx, String value, Integer mediaID) 42 { 43 this.content_id = content_id; 44 this.content_node_id = content_node_id; 45 this.idx = idx; 46 this.value = value; 47 this.mediaID = mediaID; 48 } 49 50 public TKContentValueTableData ( ResultSet r ) 51 throws SQLException 52 { 53 this.content_id = r.getInt("CONTENT_ID"); 54 this.content_node_id = r.getInt("CONTENT_NODE_ID"); 55 this.idx = r.getInt("IDX"); 56 57 if( TKDBManager.getDBVendor() == QueryConstants.ORACLE) { 62 Clob clob = r.getClob("VALUE"); if (clob != null) 64 { 65 this.value = clob.getSubString(1, (int) clob.length()); 66 } 67 } 68 else { 69 this.value = r.getString("VALUE"); 70 } 71 if (Legacy.getInstance().isEmptyStringEnabled()) 80 { 81 if (this.value == null || this.value.equals(" ")) 82 { 83 this.value = ""; } 85 } 86 else 87 { 88 if (this.value == null || this.value.equals(QueryConstants.EMPTY_STRING_VALUE)) 89 { 90 this.value = ""; } 92 } 93 94 int id = r.getInt(MEDIA_ID); 95 if(!r.wasNull()){ 96 this.mediaID = new Integer (id); 97 } 98 99 } 100 101 public void updatePrimary (TKDBVectorData dbData) { 102 103 TKContentDBData cdata = (TKContentDBData) dbData; 104 content_id = cdata.content_id; 105 } 106 107 public void insertIntoQuery(TKQuery query) 108 throws SQLException 109 { 110 query.setQueryParams("CONTENT_ID", new Integer (content_id)); 111 query.setQueryParams("CONTENT_NODE_ID", new Integer (content_node_id)); 112 query.setQueryParams("IDX", new Integer (idx)); 113 if (Legacy.getInstance().isEmptyStringEnabled()) 125 { 126 query.setQueryParams("VALUE", (value.length() == 0 ? " " : value)); } 128 else 129 { 130 query.setQueryParams("VALUE", (value.length() == 0 ? QueryConstants.EMPTY_STRING_VALUE : value)); } 132 query.setQueryParams(MEDIA_ID, mediaID); 134 } 135 136 public TKDBTableData newFromResultSet( ResultSet r ) 137 throws SQLException 138 { 139 return new TKContentValueTableData( r ); 140 } 141 142 public String toString() 143 { 144 return "( CONTENT_ID="+String.valueOf( content_id ) 145 + ", CONTENT_NODE_ID="+String.valueOf( content_node_id ) 146 + ", IDX="+String.valueOf( idx ) 147 + ", VALUE="+value 148 + ", MEDIA_ID=" + mediaID 149 + ")<BR>"; 150 } 151 152 } 155 | Popular Tags |