Search in sources :

Example 1 with InstrumentOption

use of blue.tools.blueShare.instruments.InstrumentOption in project blue by kunstmusik.

the class BlueShareRemoteCaller method getLatestTenInstruments.

public static InstrumentOption[] getLatestTenInstruments() throws XmlRpcException, IOException, ParseException {
    String result = (String) xrpc.execute("blueShare.getLatestTen", new Vector());
    Document doc = new Document(result);
    Element root = doc.getRoot();
    Elements instruments = root.getElements("instrument");
    InstrumentOption[] iOptions = new InstrumentOption[instruments.size()];
    int i = 0;
    int instrumentId;
    String screenName, name, type, description, category;
    Element temp;
    while (instruments.hasMoreElements()) {
        temp = instruments.next();
        instrumentId = Integer.parseInt(temp.getAttribute("instrumentId").getValue());
        screenName = temp.getElement("screenName").getTextString();
        name = temp.getElement("name").getTextString();
        type = temp.getElement("type").getTextString();
        description = temp.getElement("description").getTextString();
        category = temp.getElement("category").getTextString();
        iOptions[i] = new InstrumentOption(instrumentId, checkNullString(screenName), checkNullString(name), checkNullString(type), checkNullString(description), checkNullString(category));
        i++;
    }
    return iOptions;
}
Also used : InstrumentOption(blue.tools.blueShare.instruments.InstrumentOption) Element(electric.xml.Element) Document(electric.xml.Document) Elements(electric.xml.Elements) Vector(java.util.Vector)

Example 2 with InstrumentOption

use of blue.tools.blueShare.instruments.InstrumentOption in project blue by kunstmusik.

the class BlueShareRemoteCaller method getInstrumentOptions.

public static InstrumentOption[] getInstrumentOptions(BlueShareInstrumentCategory iCategory) throws IOException, XmlRpcException, ParseException {
    Vector v = new Vector();
    String result;
    Document doc;
    v.add(new Integer(iCategory.getCategoryId()));
    result = (String) xrpc.execute("blueShare.getInstrumentList", v);
    doc = new Document(result);
    Element root = doc.getRoot();
    Elements instruments = root.getElements("instrument");
    InstrumentOption[] iOptions = new InstrumentOption[instruments.size()];
    int i = 0;
    int instrumentId;
    String screenName, name, type, description, category;
    Element temp;
    while (instruments.hasMoreElements()) {
        temp = instruments.next();
        instrumentId = Integer.parseInt(temp.getAttribute("instrumentId").getValue());
        screenName = temp.getElement("screenName").getTextString();
        name = temp.getElement("name").getTextString();
        type = temp.getElement("type").getTextString();
        description = temp.getElement("description").getTextString();
        category = temp.getElement("category").getTextString();
        iOptions[i] = new InstrumentOption(instrumentId, checkNullString(screenName), checkNullString(name), checkNullString(type), checkNullString(description), checkNullString(category));
        i++;
    }
    return iOptions;
}
Also used : InstrumentOption(blue.tools.blueShare.instruments.InstrumentOption) Element(electric.xml.Element) Document(electric.xml.Document) Elements(electric.xml.Elements) Vector(java.util.Vector)

Example 3 with InstrumentOption

use of blue.tools.blueShare.instruments.InstrumentOption in project blue by kunstmusik.

the class BlueShareRemoteCaller method getInstrumentOptionsForUser.

public static InstrumentOption[] getInstrumentOptionsForUser(String username, String password) throws IOException, XmlRpcException, ParseException {
    Vector v = new Vector();
    String result;
    Document doc;
    v.add(username);
    v.add(password);
    result = (String) xrpc.execute("blueShare.getInstrumentListForUser", v);
    doc = new Document(result);
    Element root = doc.getRoot();
    Elements instruments = root.getElements("instrument");
    InstrumentOption[] iOptions = new InstrumentOption[instruments.size()];
    int i = 0;
    int instrumentId;
    String screenName, name, type, description, category;
    Element temp;
    while (instruments.hasMoreElements()) {
        temp = instruments.next();
        instrumentId = Integer.parseInt(temp.getAttribute("instrumentId").getValue());
        screenName = temp.getElement("screenName").getTextString();
        name = temp.getElement("name").getTextString();
        type = temp.getElement("type").getTextString();
        description = temp.getElement("description").getTextString();
        category = temp.getElement("category").getTextString();
        iOptions[i] = new InstrumentOption(instrumentId, checkNullString(screenName), checkNullString(name), checkNullString(type), checkNullString(description), checkNullString(category));
        i++;
    }
    return iOptions;
}
Also used : InstrumentOption(blue.tools.blueShare.instruments.InstrumentOption) Element(electric.xml.Element) Document(electric.xml.Document) Elements(electric.xml.Elements) Vector(java.util.Vector)

Aggregations

InstrumentOption (blue.tools.blueShare.instruments.InstrumentOption)3 Document (electric.xml.Document)3 Element (electric.xml.Element)3 Elements (electric.xml.Elements)3 Vector (java.util.Vector)3