Search in sources :

Example 1 with RippleServer

use of org.opentransactions.otapi.RippleServer 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 2 with RippleServer

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

the class StorageHelper method getRippleServerList.

private static void getRippleServerList(WalletData walletData, HashMap dataMap) {
    long count = walletData.GetRippleServerCount();
    for (int i = 0; i < count; i++) {
        RippleServer rippleServer = walletData.GetRippleServer(i);
        if (rippleServer == null) {
            continue;
        }
        String[] data = new String[3];
        data[0] = rippleServer.getGui_label();
        data[1] = "RippleAccount";
        data[2] = rippleServer.getServer_id();
        dataMap.put(data[2], data);
    }
}
Also used : RippleServer(org.opentransactions.otapi.RippleServer)

Example 3 with RippleServer

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

the class StorageHelper method removeRippleServer.

private static boolean removeRippleServer(WalletData walletData, String serverID) {
    boolean status = false;
    for (int i = 0; i < walletData.GetRippleServerCount(); i++) {
        RippleServer rippleServer = walletData.GetRippleServer(i);
        if (rippleServer == null) {
            continue;
        }
        if (serverID.equals(rippleServer.getServer_id())) {
            walletData.RemoveRippleServer(i);
            status = otapi.StoreObject(walletData, "moneychanger", "gui_wallet.dat");
            System.out.println("removeOtherTabServer status otapi.StoreObject:" + status);
            break;
        }
    }
    return status;
}
Also used : RippleServer(org.opentransactions.otapi.RippleServer)

Example 4 with RippleServer

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

the class StorageHelper method editRippleServerLabel.

private static boolean editRippleServerLabel(WalletData walletData, String serverID, String newLabel) {
    boolean status = false;
    for (int i = 0; i < walletData.GetRippleServerCount(); i++) {
        RippleServer rippleServer = walletData.GetRippleServer(i);
        if (rippleServer == null) {
            continue;
        }
        if (serverID.equals(rippleServer.getServer_id())) {
            rippleServer.setGui_label(newLabel);
            status = otapi.StoreObject(walletData, "moneychanger", "gui_wallet.dat");
            System.out.println("editOtherTabServerLabel status otapi.StoreObject:" + status);
            break;
        }
    }
    return status;
}
Also used : RippleServer(org.opentransactions.otapi.RippleServer)

Example 5 with RippleServer

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

the class RippleAccount method loadServerDetails.

public String[] loadServerDetails(String serverID) {
    String[] details = null;
    WalletData walletData = Helpers.getWalletData();
    if (walletData == null) {
        System.out.println("loadServerDetails - walletData returns null");
        return null;
    }
    for (int i = 0; i < walletData.GetRippleServerCount(); i++) {
        RippleServer rippleServer = walletData.GetRippleServer(i);
        if (rippleServer == null) {
            continue;
        }
        System.out.println("serverID:" + serverID + " rippleServer.getServer_id():" + rippleServer.getServer_id());
        if (serverID.equals(rippleServer.getServer_id())) {
            details = new String[5];
            details[0] = rippleServer.getServer_host() == null ? "" : rippleServer.getServer_host();
            details[1] = rippleServer.getNamefield_id() == null || rippleServer.getNamefield_id().trim().length() < 1 ? Configuration.getRippleUsernameID() : rippleServer.getNamefield_id();
            details[2] = rippleServer.getPassfield_id() == null || rippleServer.getPassfield_id().trim().length() < 1 ? Configuration.getRipplePasswordID() : rippleServer.getPassfield_id();
            details[3] = rippleServer.getRipple_username() == null ? "" : rippleServer.getRipple_username();
            details[4] = rippleServer.getRipple_password() == null ? "" : rippleServer.getRipple_password();
            break;
        }
    }
    return details;
}
Also used : RippleServer(org.opentransactions.otapi.RippleServer) WalletData(org.opentransactions.otapi.WalletData)

Aggregations

RippleServer (org.opentransactions.otapi.RippleServer)5 WalletData (org.opentransactions.otapi.WalletData)2 Storable (org.opentransactions.otapi.Storable)1