Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package jpaloapitest;
- import org.palo.api.Connection;
- import org.palo.api.ConnectionFactory;
- import org.palo.api.Cube;
- import org.palo.api.Database;
- import org.palo.api.Dimension;
- public class RetrieveValueTest{
- static final String PALO_SERVER = "localhost";
- static final String PALO_SERVICE = "7777";
- static final String PALO_USER = "admin";
- static final String PALO_PASS = "admin";
- public static void main(String[] args){
- Connection connection = ConnectionFactory.getInstance().newConnection(
- PALO_SERVER,
- PALO_SERVICE,
- PALO_USER,
- PALO_PASS);
- try{
- Database database = connection.getDatabaseByName("climpact");
- Cube cube = database.getCubeByName("IndexAnalyzer");
- dumpCubeValues(cube);
- }finally{
- connection.disconnect();
- }
- }
- private static void dumpCubeValues(Cube cube){
- System.err.println ("dumping cube values '" +
- cube.getName() + "' in database '" +
- cube.getDatabase().getName() + "' ...");
- Dimension[] dimensions = cube.getDimensions();
- for(Dimension dim : dimensions){
- dim.getElement();
- }
- String[] coordonnees = {"Est"
- ,"PATES FRAICHES MEDITERRANEENNE Mozzarella"
- ,"Kg"
- ,"40399"
- ,"Y-1"
- ,"weather business"
- ,"0"};
- Double dataValue = (Double) cube.getData(coordonnees);
- Double oldValue = dataValue;
- System.out.println("Old -->" + dataValue.toString());
- Double newValue = 4.8;
- cube.setData(coordonnees, newValue);
- dataValue = (Double) cube.getData(coordonnees);
- System.out.println("New -->" + dataValue.toString());
- cube.setData(coordonnees, oldValue);
- dataValue = (Double) cube.getData(coordonnees);
- System.out.println("Restored old -->" + dataValue.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement