Search in sources :

Example 1 with WalletData

use of org.opentransactions.otapi.WalletData in project otapij by FellowTraveler.

the class StorageHelper method editOtherTabServerLabel.

public static boolean editOtherTabServerLabel(String serverID, String newLabel, String type) {
    boolean status = false;
    WalletData walletData = Helpers.getWalletData();
    if (walletData == null) {
        System.out.println("editOtherTabServerLabel - walletData returns null");
        return false;
    }
    System.out.println("TYPE:" + type);
    if ("BitcoinAccount".equalsIgnoreCase(type)) {
        status = editBitcoinServerLabel(walletData, serverID, newLabel);
    }
    if ("RippleAccount".equalsIgnoreCase(type)) {
        status = editRippleServerLabel(walletData, serverID, newLabel);
    }
    return status;
}
Also used : WalletData(org.opentransactions.otapi.WalletData)

Example 2 with WalletData

use of org.opentransactions.otapi.WalletData in project otapij by FellowTraveler.

the class StorageHelper method addRippleServer.

//Ripple,Loom
public static String addRippleServer(String label, String url, String user, String pwd, String userTextID, String pwdTextID) {
    String serverID = Helpers.generateID();
    WalletData walletData = Helpers.getWalletData();
    if (walletData == null) {
        System.out.println("addRippleServer - walletData returns null");
        return null;
    }
    RippleServer rippleServer = null;
    Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_RIPPLE_SERVER);
    if (storable != null) {
        rippleServer = RippleServer.ot_dynamic_cast(storable);
        if (rippleServer != null) {
            rippleServer.setServer_host(url);
            rippleServer.setRipple_password(pwd);
            rippleServer.setRipple_username(user);
            rippleServer.setNamefield_id(userTextID);
            rippleServer.setPassfield_id(pwdTextID);
            rippleServer.setGui_label(label);
            rippleServer.setServer_id(serverID);
            rippleServer.setServer_type("Ripple");
            boolean status = walletData.AddRippleServer(rippleServer);
            System.out.println("status walletData.AddRippleServer:" + status);
            status = otapi.StoreObject(walletData, "moneychanger", "gui_wallet.dat");
            System.out.println("status otapi.StoreObject:" + status);
            System.out.println("addRippleServer - serverID:" + serverID);
        }
    }
    return serverID;
}
Also used : RippleServer(org.opentransactions.otapi.RippleServer) WalletData(org.opentransactions.otapi.WalletData) Storable(org.opentransactions.otapi.Storable)

Example 3 with WalletData

use of org.opentransactions.otapi.WalletData in project otapij by FellowTraveler.

the class StorageHelper method addBitcoinServer.

//Other Tab
public static String addBitcoinServer(String label, String host, String user, String pwd, String port) {
    String serverID = Helpers.generateID();
    WalletData walletData = Helpers.getWalletData();
    if (walletData == null) {
        System.out.println("addBitcoinServer - walletData returns null");
        return null;
    }
    BitcoinServer btcServer = null;
    Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_BITCOIN_SERVER);
    if (storable != null) {
        btcServer = BitcoinServer.ot_dynamic_cast(storable);
        if (btcServer != null) {
            btcServer.setServer_host(host);
            btcServer.setBitcoin_password(pwd);
            btcServer.setBitcoin_username(user);
            btcServer.setServer_port(port);
            btcServer.setGui_label(label);
            btcServer.setServer_id(serverID);
            btcServer.setServer_type("Bitcoin");
            boolean status = walletData.AddBitcoinServer(btcServer);
            System.out.println("status walletData.AddBitcoinServer:" + status);
            status = otapi.StoreObject(walletData, "moneychanger", "gui_wallet.dat");
            System.out.println("status otapi.StoreObject:" + status);
            System.out.println("addBitcoinServer - serverID:" + serverID);
        }
    }
    return serverID;
}
Also used : BitcoinServer(org.opentransactions.otapi.BitcoinServer) WalletData(org.opentransactions.otapi.WalletData) Storable(org.opentransactions.otapi.Storable)

Example 4 with WalletData

use of org.opentransactions.otapi.WalletData in project otapij by FellowTraveler.

the class StorageHelper method getOtherTabServerList.

public static Map getOtherTabServerList(String type) {
    WalletData walletData = Helpers.getWalletData();
    HashMap dataMap = new HashMap();
    if (walletData == null) {
        System.out.println("getOtherTabServerList walletData returns null");
        return dataMap;
    }
    if ("Bitcoin".equalsIgnoreCase(type)) {
        getBitcoinServerList(walletData, dataMap);
    }
    if ("Ripple".equalsIgnoreCase(type)) {
        getRippleServerList(walletData, dataMap);
    }
    if ("ALL".equalsIgnoreCase(type)) {
        getBitcoinServerList(walletData, dataMap);
        getRippleServerList(walletData, dataMap);
    }
    return dataMap;
}
Also used : HashMap(java.util.HashMap) WalletData(org.opentransactions.otapi.WalletData)

Example 5 with WalletData

use of org.opentransactions.otapi.WalletData in project otapij by FellowTraveler.

the class StorageHelper method removeOtherTabServer.

public static boolean removeOtherTabServer(String serverID, String type) {
    boolean status = false;
    WalletData walletData = Helpers.getWalletData();
    if (walletData == null) {
        System.out.println("removeOtherTabServer - walletData returns null");
        return false;
    }
    System.out.println("TYPE:" + type);
    if ("BitcoinAccount".equalsIgnoreCase(type)) {
        status = removeBitcoinServer(walletData, serverID);
    }
    if ("RippleAccount".equalsIgnoreCase(type)) {
        status = removeRippleServer(walletData, serverID);
    }
    return status;
}
Also used : WalletData(org.opentransactions.otapi.WalletData)

Aggregations

WalletData (org.opentransactions.otapi.WalletData)7 Storable (org.opentransactions.otapi.Storable)3 RippleServer (org.opentransactions.otapi.RippleServer)2 HashMap (java.util.HashMap)1 BitcoinServer (org.opentransactions.otapi.BitcoinServer)1