Examples of OTInteger


Examples of org.opentransactions.otjavalib.util.Utility.OTInteger

            // *******************************************************
            else {
                System.out.println("Utility.getAndProcessNymbox(): Error while trying to flush sent messages: Failed loading Nymbox for nym: " + nymID);
            }
            // -------------------------------------------------
            OTInteger nMsgSentRequestNumOut = new OTInteger(-1);
            OTInteger nReplySuccessOut = new OTInteger(-1);
            OTInteger nBalanceSuccessOut = new OTInteger(-1);
            OTInteger nTransSuccessOut = new OTInteger(-1);
            // -------------------------------------------------

            // PROCESS NYMBOX
            //
            // Returns:
            // -1 Error.
            //  0 Nymbox was empty -- nothing done. (bWasMsgSent = false)
            //  0 Transaction status == server reply received (bWasMsgSent = true),
            //    but the server reply says status==failed.
            // >0 If the Transaction status (from the server reply) is SUCCESS, then this function
            //    returns the REQUEST NUMBER from when it was originally sent.

            int nProcess = Helpers.processNymbox(serverID, nymID,
                    bWasMsgSent,
                    // ---------------
                    nMsgSentRequestNumOut,
                    nReplySuccessOut,
                    nBalanceSuccessOut,
                    nTransSuccessOut);
            switch (nProcess) {
                case (-1):
                    // Todo: might want to remove the sent message here, IF bMsgWasSent is true.
                    // (Just like case 0.)
                    //
                    System.out.println("Utility.getAndProcessNymbox(): Failure: Utility.processNymbox: error (-1). (It couldn't send. I give up.)");
                    return (-1); // (It didn't even send.)
                case (0):   // Nymbox was empty. (So we didn't send any process message because there was nothing to process.)
                    if (false == bWasMsgSent.getBooleanValue()) {
                        return 0; // success. done. (box was empty already.)
                    }                    // else: the message WAS sent, (the Nymbox was NOT empty)
                //       and then the server replied "success==FALSE"
                //       in its REPLY to that message! Thus we continue...
                default:
                    if (nProcess < 0) {
                        System.out.println("Utility.getAndProcessNymbox(): Failure:  unexpected: " + nProcess + ", when calling Utility.processNymbox. (I give up.)");
                        return (-1);
                    }
                    // (else break)
                    break; // Success!

            } // switch

            // bWasMsgSent.setBooleanValue(true);  // unnecessary -- set already by processNymbox call above.
            // ------------------------------------------ 
            // By this point, we definitely have a >0 request number from the sendProcessNymbox()
            // call, stored in nProcess (meaning the message WAS sent.) (Except in case of 0, see next line which fixes this:)
            //

            nProcess = nMsgSentRequestNumOut.getIntegerValue(); // Sometimes this could be 0 still, so we fix it here.
            final int nReplySuccess = nReplySuccessOut.getIntegerValue();
            final int nTransSuccess = nTransSuccessOut.getIntegerValue();
            final int nBalanceSuccess = nBalanceSuccessOut.getIntegerValue();

            // ------------------------------------------ 
            /*
            const
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.