Skip to content

Commit

Permalink
Use lombok where sensible
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp99 committed May 16, 2024
1 parent 7cebd82 commit 21ce165
Show file tree
Hide file tree
Showing 30 changed files with 32 additions and 262 deletions.
4 changes: 2 additions & 2 deletions smart-contract/hyperledger-fabric/v2/java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ plugins {
application
id("com.github.johnrengelman.shadow") version "7.1.2"
id("com.diffplug.spotless") version "6.19.0"
id("io.freefair.lombok") version "8.6"
}

// java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } }
Expand All @@ -32,9 +33,8 @@ repositories {
}

dependencies {
implementation("ch.qos.logback:logback-core:1.5.6")
implementation("ch.qos.logback:logback-classic:1.5.6")
implementation("org.slf4j:slf4j-api:2.0.13")
testImplementation("org.slf4j:slf4j-simple:2.0.13")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.jcabi:jcabi-aspects:0.25.1")
implementation("org.aspectj:aspectjrt:1.9.19")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* SPDX-License-Identifier: Apache-2.0 */
package hu.bme.mit.ftsrg.chaincode.tpcc.api;

public final class NotFoundException extends Exception {
import lombok.experimental.StandardException;

NotFoundException(String message) {
super(message);
}
}
@StandardException
public final class NotFoundException extends Exception {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import hu.bme.mit.ftsrg.chaincode.tpcc.data.extra.*;
import hu.bme.mit.ftsrg.chaincode.tpcc.data.input.*;
import hu.bme.mit.ftsrg.chaincode.tpcc.data.output.*;
import hu.bme.mit.ftsrg.chaincode.tpcc.middleware.TPCCContext;
import hu.bme.mit.ftsrg.chaincode.tpcc.util.JSON;
import hu.bme.mit.ftsrg.hypernate.Registry;
import hu.bme.mit.ftsrg.hypernate.context.ContextWithRegistry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/* SPDX-License-Identifier: Apache-2.0 */
package hu.bme.mit.ftsrg.chaincode.tpcc.middleware;
package hu.bme.mit.ftsrg.chaincode.tpcc.api;

import hu.bme.mit.ftsrg.hypernate.context.ContextWithRegistry;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;

import hu.bme.mit.ftsrg.hypernate.middleware.LoggingStubMiddleware;
import hu.bme.mit.ftsrg.hypernate.middleware.WriteBackCachedChaincodeStubMiddleware;
import org.hyperledger.fabric.shim.ChaincodeStub;

/** Context specialized for the TPC-C chaincode implementation. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import hu.bme.mit.ftsrg.chaincode.MethodLogger;
import hu.bme.mit.ftsrg.chaincode.tpcc.data.entity.*;
import hu.bme.mit.ftsrg.chaincode.tpcc.data.input.*;
import hu.bme.mit.ftsrg.chaincode.tpcc.middleware.TPCCContext;
import hu.bme.mit.ftsrg.chaincode.tpcc.util.JSON;
import hu.bme.mit.ftsrg.hypernate.entity.EntityExistsException;
import hu.bme.mit.ftsrg.hypernate.entity.EntityNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the CUSTOMER table. */
@DataType
@EqualsAndHashCode
@DataType()
public class Customer implements Entity {
public final class Customer implements Entity {

/** The customer ID. Primary key. */
@KeyPart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the DISTRICT table. */
@DataType
@EqualsAndHashCode
@DataType()
public final class District implements Entity {

/** The district ID. Primary key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the HISTORY table. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class History implements Entity {

/** The customer ID. Primary key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the ITEM table. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class Item implements Entity {

/** The ID of the item. Primary key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the NEW-ORDER table. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class NewOrder implements Entity {

/** The order ID. Primary key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the ORDER table. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class Order implements Entity {

/** The order ID. Primary key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the ORDER-LINE table. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class OrderLine implements Entity {

/** The order ID associated with the order line. Primary key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the STOCK table. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class Stock implements Entity {

/** The ID of the item associated with the stock. Primary key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Essentially, the WAREHOUSE table. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public class Warehouse implements Entity {

/** The warehouse ID. Primary key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Class to encapsulate the <code>delivered</code> field's data of a {@link DeliveryOutput}. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class DeliveredOrder {

@Property(schema = {"minimum", "0"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.hyperledger.fabric.contract.annotation.Property;

/** Class to encapsulate the <code>items</code> field's data of a {@link NewOrderOutput}. */
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class ItemsData {

@Property(schema = {"minimum", "0"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
/**
* Class to encapsulate the <code>order_lines</code> field's data of a {@link OrderStatusOutput}.
*/
@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class OrderLineData {

@Property(schema = {"minimum", "0"})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* SPDX-License-Identifier: Apache-2.0 */
package hu.bme.mit.ftsrg.chaincode.tpcc.data.input;

import hu.bme.mit.ftsrg.chaincode.tpcc.middleware.TPCCContext;
import lombok.EqualsAndHashCode;
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class DeliveryInput {

/** The warehouse ID. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class NewOrderInput {

/** The warehouse ID. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class OrderStatusInput {

/** The warehouse ID. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class PaymentInput {

/** The warehouse ID. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class StockLevelInput {

/** The warehouse ID. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class DeliveryOutput {

@Property(schema = {"minimum", "0"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class NewOrderOutput {

@Property(schema = {"minimum", "0"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class OrderStatusOutput {

@Property(schema = {"minimum", "0"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class PaymentOutput {

@Property(schema = {"minimum", "0"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;

@EqualsAndHashCode
@DataType
@EqualsAndHashCode
public final class StockLevelOutput {

@Property(schema = {"minimum", "0"})
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 21ce165

Please sign in to comment.