Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 2.06 KB | None | 0 0
  1. package jpaloapitest;
  2.  
  3. import org.palo.api.Connection;
  4. import org.palo.api.ConnectionFactory;
  5. import org.palo.api.Cube;
  6. import org.palo.api.Database;
  7. import org.palo.api.Dimension;
  8.  
  9. public class RetrieveValueTest{
  10.    
  11.     static final String PALO_SERVER = "localhost";
  12.     static final String PALO_SERVICE = "7777";
  13.     static final String PALO_USER = "admin";
  14.     static final String PALO_PASS = "admin";
  15.    
  16.     public static void main(String[] args){
  17.         Connection connection = ConnectionFactory.getInstance().newConnection(
  18.             PALO_SERVER,
  19.             PALO_SERVICE,
  20.             PALO_USER,
  21.             PALO_PASS);
  22.         try{          
  23.             Database database = connection.getDatabaseByName("climpact");
  24.             Cube cube = database.getCubeByName("IndexAnalyzer");
  25.             dumpCubeValues(cube);
  26.         }finally{
  27.             connection.disconnect();
  28.         }
  29.     }
  30.    
  31.    
  32.     private static void dumpCubeValues(Cube cube){
  33.         System.err.println ("dumping cube values '" +
  34.             cube.getName() + "' in database '" +
  35.             cube.getDatabase().getName() + "' ...");
  36.  
  37.         Dimension[] dimensions = cube.getDimensions();
  38.        
  39.         for(Dimension dim : dimensions){
  40.             dim.getElement();
  41.         }
  42.        
  43.         String[] coordonnees = {"Est"
  44.                 ,"PATES FRAICHES MEDITERRANEENNE Mozzarella"
  45.                 ,"Kg"
  46.                 ,"40399"
  47.                 ,"Y-1"
  48.                 ,"weather business"
  49.                 ,"0"};
  50.         Double dataValue = (Double) cube.getData(coordonnees);
  51.         Double oldValue = dataValue;
  52.         System.out.println("Old -->" + dataValue.toString());
  53.  
  54.         Double newValue = 4.8;
  55.         cube.setData(coordonnees, newValue);
  56.         dataValue = (Double) cube.getData(coordonnees);
  57.         System.out.println("New -->" + dataValue.toString());
  58.  
  59.         cube.setData(coordonnees, oldValue);
  60.         dataValue = (Double) cube.getData(coordonnees);
  61.         System.out.println("Restored old -->" + dataValue.toString());
  62.        
  63.     }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement