Added money to Product
This commit is contained in:
parent
d9d15d2428
commit
9e8627cb86
@ -118,6 +118,8 @@ public class NodeBase implements ChannelObserver {
|
||||
return SignatureManager.validateSignature(transaction);
|
||||
}
|
||||
|
||||
public MonetaryAmount getMoney() { return money; }
|
||||
|
||||
@Override
|
||||
public void update(Requirement requirement) {
|
||||
if (!requirement.getCreator().equals(this))
|
||||
|
||||
@ -2,11 +2,15 @@ package cz.cvut.fel.sit.omo.foodchain.product;
|
||||
|
||||
import cz.cvut.fel.sit.omo.foodchain.operation.OperationBase;
|
||||
|
||||
import javax.money.Monetary;
|
||||
import javax.money.MonetaryAmount;
|
||||
|
||||
public class Product
|
||||
{
|
||||
private ProductState productState;
|
||||
private ProductType productType;
|
||||
private OperationBase currentOperation;
|
||||
private MonetaryAmount money;
|
||||
|
||||
private String name;
|
||||
|
||||
@ -20,6 +24,15 @@ public class Product
|
||||
this.name = name;
|
||||
this.productType = productType;
|
||||
this.productState = ProductState.AVAILABLE;
|
||||
this.money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(0).create();
|
||||
}
|
||||
|
||||
public Product(String name, ProductType productType, MonetaryAmount money)
|
||||
{
|
||||
this.name = name;
|
||||
this.productType = productType;
|
||||
this.productState = ProductState.AVAILABLE;
|
||||
this.money = money;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -33,6 +46,15 @@ public class Product
|
||||
this.name = name;
|
||||
this.productType = productType;
|
||||
this.productState = productState;
|
||||
this.money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(0).create();
|
||||
}
|
||||
|
||||
public Product(String name, ProductType productType, ProductState productState, MonetaryAmount money)
|
||||
{
|
||||
this.name = name;
|
||||
this.productType = productType;
|
||||
this.productState = productState;
|
||||
this.money = money;
|
||||
}
|
||||
|
||||
// "State machine methods"
|
||||
@ -121,4 +143,8 @@ public class Product
|
||||
{
|
||||
this.currentOperation = currentOperation;
|
||||
}
|
||||
|
||||
public MonetaryAmount getMoney() { return money; }
|
||||
|
||||
public void setMoney(MonetaryAmount money) { this.money = money; }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user