Skip to content
Snippets Groups Projects
Commit 5957a479 authored by roxanne.grant's avatar roxanne.grant
Browse files

Clearer toString message with parameters of event

parent 417cf665
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 20 deletions
...@@ -23,6 +23,6 @@ public abstract class Event implements Serializable{ ...@@ -23,6 +23,6 @@ public abstract class Event implements Serializable{
@Override @Override
public String toString(){ public String toString(){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
return dateFormat.format(this.date).toString(); return dateFormat.format(this.date).toString() + " " + this.getClass().getSimpleName() + " n°(" + this.id +")";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventAccountCreated extends Event{ ...@@ -10,6 +10,6 @@ public class EventAccountCreated extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Account created n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventAccountCredited extends Event{ ...@@ -10,6 +10,6 @@ public class EventAccountCredited extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Account credited n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventAccountDoesntExist extends Event{ ...@@ -10,6 +10,6 @@ public class EventAccountDoesntExist extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Account n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -19,6 +19,6 @@ public class EventAddProductQuantity extends Event{ ...@@ -19,6 +19,6 @@ public class EventAddProductQuantity extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Credit an account n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+" ( product id =" + this.idProduct+", quantity ordered = "+this.quantity+" )\n";
} }
} }
\ No newline at end of file
...@@ -15,6 +15,6 @@ public class EventCreateAccount extends Event{ ...@@ -15,6 +15,6 @@ public class EventCreateAccount extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Create Account n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+ " ( account name = "+this.name+" )\n";
} }
} }
\ No newline at end of file
...@@ -18,6 +18,6 @@ public class EventCreateProduct extends Event{ ...@@ -18,6 +18,6 @@ public class EventCreateProduct extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Product created n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+ " ( name of product = "+this.name+", price of product = "+this.price+" )\n";
} }
} }
\ No newline at end of file
...@@ -21,6 +21,6 @@ public class EventCreditAccepted extends Event{ ...@@ -21,6 +21,6 @@ public class EventCreditAccepted extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Credit accepted n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+ " ( id of account = "+this.idAccount+", price of product = "+this.price+" )\n";
} }
} }
\ No newline at end of file
...@@ -18,6 +18,6 @@ public class EventCreditAnAccount extends Event{ ...@@ -18,6 +18,6 @@ public class EventCreditAnAccount extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Credit an account n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+" ( id of account = "+this.idAccount+", amount credited = "+this.amount+" )\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventCreditRefused extends Event{ ...@@ -10,6 +10,6 @@ public class EventCreditRefused extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Credit refused n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventCreditWithdrawn extends Event{ ...@@ -10,6 +10,6 @@ public class EventCreditWithdrawn extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Credit withdrawn n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventOrderCancelled extends Event{ ...@@ -10,6 +10,6 @@ public class EventOrderCancelled extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Order cancelled n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -18,6 +18,6 @@ public class EventOrderCreated extends Event{ ...@@ -18,6 +18,6 @@ public class EventOrderCreated extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Order created n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+" ( id of account = "+this.idAccount+" )\n";
} }
} }
\ No newline at end of file
...@@ -21,6 +21,6 @@ public class EventOrderPlaced extends Event{ ...@@ -21,6 +21,6 @@ public class EventOrderPlaced extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Order placed n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+" ( id of account = "+this.idAccount+", price of order = "+this.price+" )\n";
} }
} }
\ No newline at end of file
...@@ -9,7 +9,9 @@ public class EventOrderPrepared extends Event{ ...@@ -9,7 +9,9 @@ public class EventOrderPrepared extends Event{
public EventOrderPrepared(int id, String msg, int idAccount, double price){ public EventOrderPrepared(int id, String msg, int idAccount, double price){
super(id, msg); super(id, msg);
this.idAccount = idAccount;
this.price = price; this.price = price;
} }
public int idAccount(){ return this.idAccount; } public int idAccount(){ return this.idAccount; }
...@@ -17,6 +19,6 @@ public class EventOrderPrepared extends Event{ ...@@ -17,6 +19,6 @@ public class EventOrderPrepared extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Order prepared n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+" ( id of account = "+this.idAccount+", price of order = "+this.price+" )\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventOrderSent extends Event{ ...@@ -10,6 +10,6 @@ public class EventOrderSent extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Order sent n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventProductCreated extends Event{ ...@@ -10,6 +10,6 @@ public class EventProductCreated extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Product created n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventProductDoesntExist extends Event{ ...@@ -10,6 +10,6 @@ public class EventProductDoesntExist extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Product n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventProductOutOfStock extends Event{ ...@@ -10,6 +10,6 @@ public class EventProductOutOfStock extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Product is out of stock n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ public class EventProductQuantityAdded extends Event{ ...@@ -10,6 +10,6 @@ public class EventProductQuantityAdded extends Event{
@Override @Override
public String toString(){ public String toString(){
return "\n"+super.toString()+" : Product quantity added n°(" + this.id +"): "+this.msg+"\n"; return "\n"+super.toString()+" : "+this.msg+"\n";
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment