
org.jpos.transaction.TransactionStatusEvent Maven / Gradle / Ivy
Go to download
jPOS is an ISO-8583 based financial transaction
library/framework that can be customized and
extended in order to implement financial interchanges.
/*
* jPOS Project [http://jpos.org]
* Copyright (C) 2000-2014 Alejandro P. Revilla
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package org.jpos.transaction;
import java.io.Serializable;
public class TransactionStatusEvent {
int session;
long id;
long timestamp;
String info;
State state;
Serializable context;
public enum State {
READY(0),
PREPARING(1),
PREPARING_FOR_ABORT(2),
COMMITING(3),
ABORTING(4),
DONE(5),
PAUSED(6);
int state;
String[] stateAsString = new String[] {
"Ready", "Preparing", "Preparing for abort", "Commiting", "Aborting", "Done", "Paused"
};
State (int state) {
this.state = state;
}
public String toString () {
return stateAsString [state];
}
public int intValue() {
return state;
}
}
public TransactionStatusEvent (int session, State state, long id, String info, Serializable context) {
super();
this.session = session;
this.state = state;
this.id = id;
this.info = info;
this.context = context;
timestamp = System.nanoTime();
}
public String toString() {
return String.format("%02d %08d %s %s", session, id, state.toString(), info);
}
public int getSession() {
return session;
}
public long getId() {
return id;
}
public String getInfo() {
return info;
}
public State getState() {
return state;
}
public String getStateAsString () {
return state.toString();
}
public Serializable getContext(){
return context;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy