softconnekt

Signed-off-by: BlurryFace04 <64888928+BlurryFace04@users.noreply.github.com>
This commit is contained in:
BlurryFace04 2023-05-25 04:33:28 +05:30 committed by GitHub
parent 5df2404b08
commit b8f2b0fa5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,52 +11,61 @@ import org.hyperledger.fabric.contract.annotation.Property;
import com.owlike.genson.annotation.JsonProperty; import com.owlike.genson.annotation.JsonProperty;
// license-key
// email
// mac-address
// device-id
// timestamp
@DataType() @DataType()
public final class Asset { public final class Asset {
@Property() @Property()
private final String assetID; private final String licenseKey;
@Property() @Property()
private final String color; private final String email;
@Property() @Property()
private final int size; private final String macAddress;
@Property() @Property()
private final String owner; private final String deviceID;
@Property() @Property()
private final int appraisedValue; private final String timestamp;
public String getAssetID() { public String getLicenseKey() {
return assetID; return licenseKey;
} }
public String getColor() { public String getEmail() {
return color; return email;
} }
public int getSize() { public int getMacAddress() {
return size; return macAddress;
} }
public String getOwner() { public String getDeviceID() {
return owner; return deviceID;
} }
public int getAppraisedValue() { public int getTimestamp() {
return appraisedValue; return timestamp;
} }
public Asset(@JsonProperty("assetID") final String assetID, @JsonProperty("color") final String color, public Asset(@JsonProperty("licenseKey") final String licenseKey,
@JsonProperty("size") final int size, @JsonProperty("owner") final String owner, @JsonProperty("email") final String email,
@JsonProperty("appraisedValue") final int appraisedValue) { @JsonProperty("macAddress") final String macAddress,
this.assetID = assetID; @JsonProperty("deviceID") final String deviceID,
this.color = color; @JsonProperty("timestamp") final String timestamp)
this.size = size; {
this.owner = owner; this.licenseKey = licenseKey;
this.appraisedValue = appraisedValue; this.email = email;
this.macAddress = macAddress;
this.deviceID = deviceID;
this.timestamp = timestamp;
} }
@Override @Override
@ -72,22 +81,18 @@ public final class Asset {
Asset other = (Asset) obj; Asset other = (Asset) obj;
return Objects.deepEquals( return Objects.deepEquals(
new String[] {getAssetID(), getColor(), getOwner()}, new String[] {getLicenseKey(), getEmail(), getMacAddress(), getDeviceID(), getTimestamp()},
new String[] {other.getAssetID(), other.getColor(), other.getOwner()}) new String[] {other.getLicenseKey(), other.getEmail(), other.getMacAddress(), other.getDeviceID(), other.getTimestamp()});
&&
Objects.deepEquals(
new int[] {getSize(), getAppraisedValue()},
new int[] {other.getSize(), other.getAppraisedValue()});
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(getAssetID(), getColor(), getSize(), getOwner(), getAppraisedValue()); return Objects.hash(getLicenseKey(), getEmail(), getMacAddress(), getDeviceID(), getTimestamp());
} }
@Override @Override
public String toString() { public String toString() {
return this.getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) + " [assetID=" + assetID + ", color=" return this.getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) + " [licenseKey=" + licenseKey + ", email="
+ color + ", size=" + size + ", owner=" + owner + ", appraisedValue=" + appraisedValue + "]"; + email + ", macAddress=" + macAddress + ", deviceID=" + deviceID + ", timestamp=" + timestamp + "]";
} }
} }