added new fields to TransferDetails

This commit is contained in:
dartpopikyardo
2016-03-22 14:50:35 +03:00
parent 7c6328aa5e
commit 7b54b9042d
2 changed files with 32 additions and 1 deletions

View File

@@ -53,7 +53,12 @@ public class AccountQueryWorkflow implements CompoundEventHandler {
logger.info("**************** account version=" + fromAccountId + ", " + de.eventId().asString());
logger.info("**************** account version=" + toAccountId + ", " + de.eventId().asString());
AccountTransactionInfo ti = new AccountTransactionInfo(moneyTransferId, fromAccountId, toAccountId, toIntegerRepr(de.event().getDetails().getAmount()));
AccountTransactionInfo ti = new AccountTransactionInfo(moneyTransferId,
fromAccountId,
toAccountId,
toIntegerRepr(de.event().getDetails().getAmount()),
de.event().getDetails().getDate(),
de.event().getDetails().getDescription());
accountInfoUpdateService.addTransaction(eventId, fromAccountId, ti);

View File

@@ -3,21 +3,31 @@ package net.chrisrichardson.eventstore.javaexamples.banking.backend.queryside.ac
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.Date;
public class AccountTransactionInfo {
private String transactionId;
private String fromAccountId;
private String toAccountId;
private long amount;
private Date date;
private String description;
public AccountTransactionInfo() {
}
public AccountTransactionInfo(String transactionId, String fromAccountId, String toAccountId, long amount) {
this(transactionId, fromAccountId, toAccountId, amount, new Date(), "");
}
public AccountTransactionInfo(String transactionId, String fromAccountId, String toAccountId, long amount, Date date, String description) {
this.transactionId = transactionId;
this.fromAccountId = fromAccountId;
this.toAccountId = toAccountId;
this.amount = amount;
this.date = date;
this.description = description;
}
public String getTransactionId() {
@@ -52,6 +62,22 @@ public class AccountTransactionInfo {
this.amount = amount;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o);