View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

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.

Example

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);
 
  @Override
  public Set<String> getCubeTemplatesToGenerate() {
    Set<String> set = new HashSet<String>();
    set.add("1E3B7EA7D12340618952D742E9B69EC2");
    return set;
  }
 
  @Override
  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 "http://wiki.openbravo.com/wiki/Modules:Analytics_Generation_Cubes"

This page has been accessed 848 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.