コード例 #1
0
ファイル: CubeHandle.java プロジェクト: GiorgioHuang/birt
  /**
   * 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;
  }
コード例 #2
0
ファイル: NameCommand.java プロジェクト: FreemanZhang/birt
 private void updateDimensions(ActivityStack stack) {
   Dimension dimension = (Dimension) element;
   List<BackRef> clients = dimension.getClientList();
   for (BackRef client : clients) {
     DesignElement content = client.getElement();
     String propName = client.getPropertyName();
     if (content instanceof Dimension
         && ITabularDimensionModel.INTERNAL_DIMENSION_RFF_TYPE_PROP.equals(propName)) {
       NameRecord rename = new NameRecord(content, element.getName());
       stack.execute(rename);
     }
   }
 }