2424import org .fisco .bcos .sdk .contract .precompiled .callback .PrecompiledCallback ;
2525import org .fisco .bcos .sdk .contract .precompiled .crud .common .Condition ;
2626import org .fisco .bcos .sdk .contract .precompiled .crud .common .Entry ;
27- import org .fisco .bcos .sdk .contract .precompiled .model .PrecompiledAddress ;
2827import org .fisco .bcos .sdk .crypto .keypair .CryptoKeyPair ;
2928import org .fisco .bcos .sdk .model .PrecompiledConstant ;
3029import org .fisco .bcos .sdk .model .PrecompiledRetCode ;
3534import org .fisco .bcos .sdk .transaction .model .exception .ContractException ;
3635import org .fisco .bcos .sdk .utils .StringUtils ;
3736
37+ /** This class not support in FISCO BCOS 3.0.0 rc1 Do not use it. */
38+ @ Deprecated
3839public class TableCRUDService {
3940 private final Client client ;
4041 private final TablePrecompiled tablePrecompiled ;
4142 private static final String ValueFieldsDelimiter = "," ;
4243
44+ @ Deprecated
4345 public TableCRUDService (Client client , CryptoKeyPair credential ) {
44- this .client = client ;
45- this .tablePrecompiled =
46- TablePrecompiled .load (
47- client .isWASM ()
48- ? PrecompiledAddress .TABLEFACTORY_PRECOMPILED_NAME
49- : PrecompiledAddress .TABLEFACTORY_PRECOMPILED_ADDRESS ,
50- client ,
51- credential );
46+ this .client = null ;
47+ this .tablePrecompiled = null ;
48+ // this.client = client;
49+ // this.tablePrecompiled =
50+ // TablePrecompiled.load(
51+ // client.isWASM()
52+ // ? PrecompiledAddress.TABLEFACTORY_PRECOMPILED_NAME
53+ // : PrecompiledAddress.TABLEFACTORY_PRECOMPILED_ADDRESS,
54+ // client,
55+ // credential);
5256 }
5357
58+ @ Deprecated
5459 public static String convertValueFieldsToString (List <String > valueFields ) {
5560 return StringUtils .join (valueFields , ValueFieldsDelimiter );
5661 }
5762
63+ @ Deprecated
5864 public void checkKey (String key ) throws ContractException {
5965 if (key .length () > PrecompiledConstant .TABLE_KEY_MAX_LENGTH ) {
6066 throw new ContractException (PrecompiledRetCode .OVER_TABLE_KEY_LENGTH_LIMIT );
6167 }
6268 }
6369
70+ @ Deprecated
6471 public RetCode createTable (String tableName , String keyFieldName , List <String > valueFields )
6572 throws ContractException {
6673 checkKey (keyFieldName );
@@ -69,11 +76,13 @@ public RetCode createTable(String tableName, String keyFieldName, List<String> v
6976 tablePrecompiled .createTable (tableName , keyFieldName , valueFieldsString ));
7077 }
7178
79+ @ Deprecated
7280 public RetCode insert (String tableName , Entry fieldNameToValue ) throws ContractException {
7381 return ReceiptParser .parseTransactionReceipt (
7482 tablePrecompiled .insert (tableName , fieldNameToValue .getTablePrecompiledEntry ()));
7583 }
7684
85+ @ Deprecated
7786 public RetCode update (String tableName , Entry fieldNameToValue , Condition condition )
7887 throws ContractException {
7988 return ReceiptParser .parseTransactionReceipt (
@@ -83,11 +92,13 @@ public RetCode update(String tableName, Entry fieldNameToValue, Condition condit
8392 condition .getTableCondition ()));
8493 }
8594
95+ @ Deprecated
8696 public RetCode remove (String tableName , Condition condition ) throws ContractException {
8797 return ReceiptParser .parseTransactionReceipt (
8898 tablePrecompiled .remove (tableName , condition .getTableCondition ()));
8999 }
90100
101+ @ Deprecated
91102 public List <Map <String , String >> select (String tableName , Condition condition )
92103 throws ContractException {
93104 try {
@@ -106,6 +117,7 @@ public List<Map<String, String>> select(String tableName, Condition condition)
106117 }
107118 }
108119
120+ @ Deprecated
109121 public static List <Map <String , String >> parseSelectResult (
110122 List <TablePrecompiled .Entry > selectResult ) throws JsonProcessingException {
111123 List <Map <String , String >> result = new ArrayList <>();
@@ -130,6 +142,7 @@ private List<Map<String, String>> getTableDesc(String tableName) throws Contract
130142 return tableDescList ;
131143 }
132144
145+ @ Deprecated
133146 public List <Map <String , String >> desc (String tableName ) throws ContractException {
134147 try {
135148 return getTableDesc (tableName );
@@ -138,6 +151,7 @@ public List<Map<String, String>> desc(String tableName) throws ContractException
138151 }
139152 }
140153
154+ @ Deprecated
141155 private TransactionCallback createTransactionCallback (PrecompiledCallback callback ) {
142156 return new TransactionCallback () {
143157 @ Override
@@ -156,12 +170,14 @@ public void onResponse(TransactionReceipt receipt) {
156170 };
157171 }
158172
173+ @ Deprecated
159174 public void asyncInsert (String tableName , Entry entry , PrecompiledCallback callback )
160175 throws ContractException {
161176 this .tablePrecompiled .insert (
162177 tableName , entry .getTablePrecompiledEntry (), createTransactionCallback (callback ));
163178 }
164179
180+ @ Deprecated
165181 public void asyncUpdate (
166182 String tableName , Entry entry , Condition condition , PrecompiledCallback callback )
167183 throws ContractException {
@@ -172,6 +188,7 @@ public void asyncUpdate(
172188 createTransactionCallback (callback ));
173189 }
174190
191+ @ Deprecated
175192 public void asyncRemove (String tableName , Condition condition , PrecompiledCallback callback )
176193 throws ContractException {
177194 this .tablePrecompiled .remove (
0 commit comments