Search in sources :

Example 66 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project tdi-studio-se by Talend.

the class palodimension method refreshDimensionInfo.

public void refreshDimensionInfo() throws paloexception {
    List<NameValuePair> qparams = new ArrayList<NameValuePair>();
    qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
    qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
    qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
    try {
        HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/info");
        CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
        csv.setQuoteChar('"');
        csv.readNext();
        this.strDimensionName = csv.get(1);
        this.iDimensionId = Integer.valueOf(csv.get(0));
        this.iAssocDimension = palohelpers.StringToInt(csv.get(7));
        this.iAttributCube = palohelpers.StringToInt(csv.get(8));
        this.iRightsCube = palohelpers.StringToInt(csv.get(9));
        this.iNumberOfElements = palohelpers.StringToInt(csv.get(2));
        this.iMaximumLevel = palohelpers.StringToInt(csv.get(3));
        this.iMaximumIndent = palohelpers.StringToInt(csv.get(4));
        this.iMaximumDepth = palohelpers.StringToInt(csv.get(5));
        this.iDimensionToken = palohelpers.StringToInt(csv.get(10));
        csv.close();
        entity.consumeContent();
    } catch (Exception e) {
        throw new paloexception(e.getMessage());
    }
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) HttpEntity(org.apache.http.HttpEntity) CSVReader(com.talend.csv.CSVReader) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) ArrayList(java.util.ArrayList)

Example 67 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project tdi-studio-se by Talend.

the class palodimensions method createDimension.

public palodimension createDimension(String strDimensionName, int iType) throws paloexception {
    List<NameValuePair> qparams = new ArrayList<NameValuePair>();
    qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
    qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
    qparams.add(new BasicNameValuePair("new_name", strDimensionName));
    qparams.add(new BasicNameValuePair("type", String.valueOf(iType)));
    try {
        HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/create");
        CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
        csv.setQuoteChar('"');
        csv.readNext();
        palodimension plDim = new palodimension(this.plConn, this.plDB.getDatabaseId(), csv.get(1), palohelpers.StringToInt(csv.get(0)), palohelpers.StringToInt(csv.get(7)), palohelpers.StringToInt(csv.get(8)), palohelpers.StringToInt(csv.get(9)), palohelpers.StringToInt(csv.get(2)), palohelpers.StringToInt(csv.get(3)), palohelpers.StringToInt(csv.get(4)), palohelpers.StringToInt(csv.get(5)), palohelpers.StringToInt(csv.get(10)));
        paloDimensions.add(plDim);
        csv.close();
        entity.consumeContent();
        return plDim;
    } catch (Exception e) {
        throw new paloexception(e.getMessage());
    }
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) HttpEntity(org.apache.http.HttpEntity) CSVReader(com.talend.csv.CSVReader) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) ArrayList(java.util.ArrayList)

Example 68 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project tdi-studio-se by Talend.

the class palodimensions method deleteDimension.

public void deleteDimension(String strDimensionName) throws paloexception {
    palodimension paloDimToRemove = getDimension(strDimensionName);
    if (null != paloDimToRemove) {
        List<NameValuePair> qparams = new ArrayList<NameValuePair>();
        qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
        qparams.add(new BasicNameValuePair("database", String.valueOf(plDB.getDatabaseId())));
        qparams.add(new BasicNameValuePair("dimension", String.valueOf(paloDimToRemove.getDimensionId())));
        plConn.sendToServerSingleRC(qparams, "/dimension/destroy");
        paloDimensions.remove(paloDimToRemove);
    }
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) ArrayList(java.util.ArrayList)

Example 69 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project tdi-studio-se by Talend.

the class paloelement method rename.

public void rename(String strElementNewName) throws paloexception {
    if (null != strElementNewName && strElementNewName.length() > 0 && !strElementName.equals(strElementNewName)) {
        List<NameValuePair> qparams = new ArrayList<NameValuePair>();
        qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
        qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
        qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
        qparams.add(new BasicNameValuePair("element", String.valueOf(this.lElementIdentifier)));
        qparams.add(new BasicNameValuePair("new_name", strElementNewName));
        try {
            HttpEntity entity = this.plConn.sendToServer(qparams, "/element/rename");
            CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
            csv.setQuoteChar('"');
            csv.readNext();
            this.strElementName = csv.get(1);
            csv.close();
            entity.consumeContent();
        } catch (Exception e) {
            throw new paloexception(e.getMessage());
        }
        strElementName = strElementNewName;
    }
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) HttpEntity(org.apache.http.HttpEntity) CSVReader(com.talend.csv.CSVReader) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) ArrayList(java.util.ArrayList)

Example 70 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project tdi-studio-se by Talend.

the class paloelement method move.

public void move(long lElementNewPosition) throws paloexception {
    if (lElementNewPosition > -1 && lElementNewPosition != iElementPosition) {
        List<NameValuePair> qparams = new ArrayList<NameValuePair>();
        qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
        qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
        qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
        qparams.add(new BasicNameValuePair("element", String.valueOf(this.lElementIdentifier)));
        qparams.add(new BasicNameValuePair("position", String.valueOf(lElementNewPosition)));
        try {
            HttpEntity entity = this.plConn.sendToServer(qparams, "/element/move");
            CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
            csv.setQuoteChar('"');
            while (csv.readNext()) {
                this.lElementIdentifier = palohelpers.StringToLong(csv.get(0));
                this.strElementName = csv.get(1);
                this.iElementPosition = palohelpers.StringToInt(csv.get(2));
                this.iElementLevel = palohelpers.StringToInt(csv.get(3));
                this.iElementIndent = palohelpers.StringToInt(csv.get(4));
                this.iElementDepth = palohelpers.StringToInt(csv.get(5));
                this.iElementType = palohelpers.StringToInt(csv.get(6));
                this.iElementNumOfParents = palohelpers.StringToInt(csv.get(7));
                this.iArrElementParents = palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7)));
                this.iElementNumOfChildren = palohelpers.StringToInt(csv.get(9));
                this.iArrElementChildren = palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9)));
                this.dArrElementChildrenWeights = palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)));
            }
            csv.close();
            entity.consumeContent();
        } catch (Exception e) {
            throw new paloexception(e.getMessage());
        }
    }
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) HttpEntity(org.apache.http.HttpEntity) CSVReader(com.talend.csv.CSVReader) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) ArrayList(java.util.ArrayList)

Aggregations

BasicNameValuePair (org.apache.http.message.BasicNameValuePair)289 NameValuePair (org.apache.http.NameValuePair)199 ArrayList (java.util.ArrayList)187 UrlEncodedFormEntity (org.apache.http.client.entity.UrlEncodedFormEntity)101 HttpPost (org.apache.http.client.methods.HttpPost)87 HttpResponse (org.apache.http.HttpResponse)77 HttpEntity (org.apache.http.HttpEntity)58 IOException (java.io.IOException)55 DefaultHttpClient (org.apache.http.impl.client.DefaultHttpClient)33 Test (org.junit.Test)32 HttpGet (org.apache.http.client.methods.HttpGet)29 ClientProtocolException (org.apache.http.client.ClientProtocolException)28 CSVReader (com.talend.csv.CSVReader)27 HttpClient (org.apache.http.client.HttpClient)25 UnsupportedEncodingException (java.io.UnsupportedEncodingException)23 HashMap (java.util.HashMap)20 JSONObject (org.json.JSONObject)20 Map (java.util.Map)19 URI (java.net.URI)16 WebserviceInvocation (com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)15