View source | Discuss this page | Page history | Printable version   

Modules:Analytics Generation Cubes

Extend Generation of Cubes

It is possible to define a Cube as a Template, as explained in the Documentation, and then use this Template to generate the actual Cubes for the different Clients.

This is due to the fact that some Cube definitions might be dependent on Client's data.

By generating a Cube based on a Template, it is possible to replace some expressions by actual Client's data. For example, by default the expression @ad_client_id@ is replaced by the actual Client Id.

But in some scenarios that is not enough. That is why it is possible to extend the Process that generate the Cubes to take into account different requirements.

An example of this functionality can be found in the Multi-Dimensional Financial Reports.


A Module is going to extend the generation of the Cubes for adding another parameter to replace, in this case the parameter @first_invoice_id@ will be replaced by the Id of the first Invoice created for a Client.

public class GeneratePAndLCubeFromTemplate extends GenerateFinancialCubesFromTemplate {
  private static final Logger log = Logger.getLogger(GeneratePAndLCubeFromTemplate.class);
  public Set<String> getCubeTemplatesToGenerate() {
    Set<String> set = new HashSet<String>();
    return set;
  public void processCube(JSONObject request, JSONObject params, CubeDefinition cube,
      CubeDefinition cubeTemplate, Client client) throws OBException {
    super.processCube(request, params, cube, cubeTemplate, client);
    cube.setSqlfilter(cube.getSqlfilter().replace("@first_invoice_id@ ", getFirstInvoiceId(client)));

Retrieved from ""

This page has been accessed 2,222 times. This page was last modified on 23 April 2014, at 13:43. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.