Example #1
0
  /**
   * Gets the dimension with the specified name within this cube.
   *
   * @param dimensionName name of the dimension to find
   * @return dimension within the cube if found, otherwise <code>null</code>
   */
  public DimensionHandle getDimension(String dimensionName) {
    if (StringUtil.isBlank(dimensionName)) return null;
    if (!getElement().canDynamicExtends()) {
      Dimension dimension = module.findDimension(dimensionName);
      if (dimension == null) return null;
      if (dimension.isContentOf(getElement())) return (DimensionHandle) dimension.getHandle(module);
      else {
        // check the client to find the children of the cube
        List<BackRef> clients = dimension.getClientList();
        if (clients != null) {
          for (BackRef ref : clients) {
            DesignElement client = ref.getElement();
            if (client.isContentOf(getElement())) return (DimensionHandle) client.getHandle(module);
          }
        }
      }
    } else if (getElement().getDynamicExtendsElement(getModule()) != null) {
      Cube cube = (Cube) getElement();
      DesignElement element =
          cube.findLocalElement(
              dimensionName,
              MetaDataDictionary.getInstance().getElement(ReportDesignConstants.DIMENSION_ELEMENT));
      return (DimensionHandle) (element == null ? null : element.getHandle(module));
    }

    return null;
  }
Example #2
0
  /**
   * Gets the dimension with the specified name within this cube. If dimension defined with the
   * given name doesn't exist, it returns the local corresponding one mapped to the parent dimension
   * that matches the given name.
   *
   * @param dimensionName name of the dimension to find
   * @return dimension within the cube if found, otherwise <code>null</code>
   */
  public DimensionHandle getLocalDimension(String dimensionName) {
    DesignElement dimension = module.findDimension(dimensionName);
    if (dimension != null && dimension.isContentOf(getElement()))
      return (DimensionHandle) dimension.getHandle(module);

    // find the dimension according to the name in the parent cube.

    CubeHandle parent = (CubeHandle) getExtends();
    if (parent == null) return null;

    dimension = doGetLocalDimension(dimensionName, (Cube) parent.element, parent.module);

    if (dimension == null) return null;

    return (DimensionHandle) dimension.getHandle(module);
  }
Example #3
0
  /**
   * Gets the measure with the specified name within this cube.
   *
   * @param measureName name of the measure to find
   * @return measure within the cube if found, otherwise <code>null</code>
   */
  public MeasureHandle getMeasure(String measureName) {
    if (StringUtil.isBlank(measureName)) return null;
    if (!getElement().canDynamicExtends()) {
      DesignElement measure = module.findOLAPElement(measureName);
      if (measure instanceof Measure && measure.isContentOf(getElement()))
        return (MeasureHandle) measure.getHandle(module);
    } else if (getElement().getDynamicExtendsElement(getModule()) != null) {
      Cube cube = (Cube) getElement();
      DesignElement element =
          cube.findLocalElement(
              measureName,
              MetaDataDictionary.getInstance().getElement(ReportDesignConstants.MEASURE_ELEMENT));
      return (MeasureHandle) (element == null ? null : element.getHandle(module));
    }

    return null;
  }