Skip to content

Commit bd3515f

Browse files
committed
Transaction metadata tags updated
Signed-off-by: Kestutis Gudynas <[email protected]>
1 parent 090c7ee commit bd3515f

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/metadata/MetadataBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ public static void addTransaction(final TxFunction txFunction, final String cont
207207

208208
final ArrayList<TransactionType> tags = new ArrayList<TransactionType>();
209209
tags.add(txFunction.getType());
210+
if (txFunction.getType() == TransactionType.SUBMIT) { // add deprecated tags
211+
tags.add(TransactionType.INVOKE);
212+
} else {
213+
tags.add(TransactionType.QUERY);
214+
}
210215

211216
final Map<String, Serializable> contract = contractMap.get(contractName);
212217
@SuppressWarnings("unchecked")

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/routing/TransactionType.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,23 @@
77

88
public enum TransactionType {
99
/**
10-
*
11-
*/
12-
INVOKE,
10+
*
11+
*/
12+
INVOKE, //deprecated
1313
/**
14-
*
15-
*/
16-
QUERY,
14+
*
15+
*/
16+
QUERY, //deprecated
1717
/**
18-
*
19-
*/
20-
DEFAULT
18+
*
19+
*/
20+
DEFAULT, //deprecated
21+
/**
22+
*
23+
*/
24+
SUBMIT,
25+
/**
26+
*
27+
*/
28+
EVALUATE
2129
}

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/routing/impl/TxFunctionImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public final class TxFunctionImpl implements TxFunction {
2929
private final Method method;
3030
private String name;
3131
private TransactionType type;
32+
private TransactionType typeDeprecated;
3233
private final Routing routing;
3334
private TypeSchema returnSchema;
3435
private List<ParameterDefinition> paramsList = new ArrayList<>();
@@ -89,10 +90,10 @@ public TxFunctionImpl(final Method m, final ContractDefinition contract) {
8990
this.method = m;
9091
if (m.getAnnotation(Transaction.class) != null) {
9192
logger.debug("Found Transaction method: " + m.getName());
92-
if (m.getAnnotation(Transaction.class).submit()) {
93-
this.type = TransactionType.INVOKE;
93+
if (m.getAnnotation(Transaction.class).intent() == Transaction.TYPE.SUBMIT) {
94+
this.type = TransactionType.SUBMIT;
9495
} else {
95-
this.type = TransactionType.QUERY;
96+
this.type = TransactionType.EVALUATE;
9697
}
9798

9899
final String txnName = m.getAnnotation(Transaction.class).name();

0 commit comments

Comments
 (0)