/**
* Retrieve the instance service info.
*/
public InstanceServiceInfo getInstanceServiceInfo() {
InstanceServiceInfo retVal = null;
Connection connection = null;
try {
int stopped = 0;
int suspended = 0;
int running = 0;
int completed = 0;
String sql = "select * from bpm_instance";
connection = getConnection();
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery( sql );
while( result.next() ) {
int status = result.getInt( "status" );
switch( status ) {
case Instance.STATUS_STOPPED:
stopped++;
break;
case Instance.STATUS_SUSPENDED:
suspended++;
break;
case Instance.STATUS_RUNNING:
running++;
break;
case Instance.STATUS_COMPLETE:
completed++;
break;
}
}
result.close();
statement.close();
retVal = new InstanceServiceInfo( running, suspended, stopped,
completed );
}
catch( SQLException e ) {
throw new RuntimeException( e );
}