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;
  }
  private XObject[] addCubes(XFolder parent, Database db) {
    int allCubeCnt = db.getCubeCount();
    int cubeCnt = 0;
    XObject ret[];

    for (int i = 0; i < allCubeCnt; i++) {
      Cube cube = db.getCubeAt(i);
      if ((parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_CUBES) && isDataCube(cube))
          || (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_SYSTEMCUBES)
              && cube.isSystemCube())
          || (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_ATTRIBUTECUBES)
              && cube.isAttributeCube())) {
        cubeCnt++;
      }
    }

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

    ret = new XObject[cubeCnt];
    int curCube = 0;

    for (int i = 0; i < allCubeCnt; i++) {
      Cube cube = db.getCubeAt(i);
      if ((parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_CUBES) && isDataCube(cube))
          || (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_SYSTEMCUBES)
              && cube.isSystemCube())
          || (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_ATTRIBUTECUBES)
              && cube.isAttributeCube())) {
        ret[curCube] = new XCube();
        ret[curCube].setName(cube.getName());
        setIdToXObject(ret[curCube]);
        //				ret[curCube].setId(cube.getId());
        curCube++;
      }
    }

    if (parent.getFolderType().equalsIgnoreCase(TYPE_STATIC_FOLDER_CUBES)) {
      ret[curCube] =
          addStaticFolder(parent, "Attribute Cubes", db.getId(), TYPE_STATIC_FOLDER_ATTRIBUTECUBES);
      ret[curCube + 1] =
          addStaticFolder(parent, "System Cubes", db.getId(), TYPE_STATIC_FOLDER_SYSTEMCUBES);
    }

    return ret;
  }
Beispiel #3
0
 public static boolean isSystemDatabase(Database database) {
   String dbName = database.getName();
   return dbName.equals(SYSTEM_DB) || dbName.equals(PaloConstants.PALO_CLIENT_SYSTEM_DATABASE);
 }