コード例 #1
0
  public void testWithQuery() throws Exception {
    WhatIfEngineInstance ei = getWhatifengineiEngineInstance(getCatalogue());
    SpagoBIPivotModel pivotModel = (SpagoBIPivotModel) ei.getPivotModel();

    SpagoBICellSetWrapper cellSetWrapper = (SpagoBICellSetWrapper) pivotModel.getCellSet();
    SpagoBICellWrapper cellWrapper = (SpagoBICellWrapper) cellSetWrapper.getCell(0);

    cellWrapper.getMembers()[1].setProperty(WhatIfConstants.MEMBER_PROPERTY_LEAF, null);

    EqualPartitioningOnLeafsAllocationAlgorithm ae =
        new EqualPartitioningOnLeafsAllocationAlgorithm(ei);

    Long leafs = ae.getDataManager().getLeafs(cellWrapper.getMembers());

    System.out.println(leafs);
  }
コード例 #2
0
 private static String getParameterValue(
     TargetParameter parameter, WhatIfEngineInstance ei, SpagoBICellWrapper cell) {
   if (parameter.isAbsolute()) {
     return parameter.getValue();
   }
   String value = null;
   String dimensionName = parameter.getDimension();
   String hierarchyName = parameter.getHierarchy();
   String levelName = parameter.getLevel();
   String propertyName = parameter.getProperty();
   logger.debug(
       "Looking for dimension "
           + dimensionName
           + ", hierarchy "
           + hierarchyName
           + ", level "
           + levelName
           + ", property "
           + propertyName
           + " ...");
   Hierarchy hierarchy =
       getHierarchy(ei.getSpagoBIPivotModel().getCube(), ei.getModelConfig(), dimensionName);
   Member member = cell.getContextMember(hierarchy);
   logger.debug("Considering context member " + member.getUniqueName());
   logger.debug("Member hierarchy is " + hierarchy.getUniqueName());
   if (hierarchy.getUniqueName().equals(hierarchyName)) {
     if (propertyName == null || propertyName.trim().equals("")) {
       value = getLevelValue(member, levelName);
     } else {
       value = getMemberPropertyValue(member, propertyName);
     }
   }
   return value;
 }