private XObject[] addDimensions(XFolder parent, Database db) {
    int allDimCnt = db.getDimensionCount();
    int dimCnt = 0;
    XObject ret[];

    for (int i = 0; i < allDimCnt; i++) {
      Dimension dim = db.getDimensionAt(i);
      if ((parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_DIMENSIONS)
              && isDataDimension(dim))
          || (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_SYSTEMDIMENSIONS)
              && dim.isSystemDimension())
          || (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_ATTRIBUTEDIMENSIONS)
              && dim.isAttributeDimension())) {
        dimCnt++;
      }
    }

    if (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_DIMENSIONS)) {
      dimCnt += 2; // for additional subfolders
    }

    ret = new XObject[dimCnt];
    int curDim = 0;

    for (int i = 0; i < allDimCnt; i++) {
      Dimension dim = db.getDimensionAt(i);
      if ((parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_DIMENSIONS)
              && isDataDimension(dim))
          || (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_SYSTEMDIMENSIONS)
              && dim.isSystemDimension())
          || (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_ATTRIBUTEDIMENSIONS)
              && dim.isAttributeDimension())) {
        XDimension xdim = (XDimension) XConverter.createX(dim);
        //				xdim.setName(dim.getName());
        //				xdim.setDbId(db.getId());
        //				xdim.setDimId(dim.getId());
        setIdToXObject(xdim);
        ret[curDim] = xdim;
        curDim++;
      }
    }

    if (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_DIMENSIONS)) {
      ret[curDim] =
          addStaticFolder(
              parent, "Attribute Dimension", db.getId(), TYPE_STATIC_FOLDER_ATTRIBUTEDIMENSIONS);
      ret[curDim + 1] =
          addStaticFolder(
              parent, "System Dimension", db.getId(), TYPE_STATIC_FOLDER_SYSTEMDIMENSIONS);
    }

    return ret;
  }
Beispiel #2
0
 public static boolean isAttributeDimension(Dimension dimension) {
   return isAttributeDimension(dimension.getName());
 }
Beispiel #3
0
 public static boolean isSystemDimension(Dimension dimension) {
   return isSystemDimension(dimension.getName());
 }
 private boolean isDataDimension(Dimension dim) {
   return (!dim.isSystemDimension() && !dim.isAttributeDimension() && !dim.isUserInfoDimension());
 }