Package it.eng.spagobi.engines.geo.dataset.provider

Examples of it.eng.spagobi.engines.geo.dataset.provider.Hierarchy$Level


      geoException =  new GeoEngineException("Configuration error");
      geoException.setDescription(description);
      throw geoException;
    }
   
    Hierarchy selectedHierarchy = getDataMartProvider().getHierarchy(selectedHierarchyName);
    if(selectedHierarchy == null) {
      GeoEngineException geoException;
      logger.error("Selected hierarchy [" + selectedHierarchyName + "] does not exist");
      String description = "Selected hierarchy [" + selectedHierarchyName + "] does not exist";
      List hints = new ArrayList();
      hints.add("Check if hierarchy name is correct");
      hints.add("Check if a hierarchy named " + selectedHierarchyName +"  has been defined. Defined hierarachy are: "
          + Arrays.toString( getDataMartProvider().getHierarchyNames().toArray()) );
      geoException =  new GeoEngineException("Configuration error");
      geoException.setDescription(description);
      geoException.setHints(hints);
      throw geoException;
    }
   
    String selectedLevelName = getDataMartProvider().getSelectedLevelName();
    if(selectedLevelName == null) {
      GeoEngineException geoException;
      logger.error("Select level name is not defined");
      String description = "Select level name is not defined";
      geoException =  new GeoEngineException("Configuration error");
      geoException.setDescription(description);
      throw geoException;
    }
   
    Hierarchy.Level selectedLevel = selectedHierarchy.getLevel(selectedLevelName);
    if(selectedLevel == null) {
      GeoEngineException geoException;
      logger.error("Selected level [" + selectedHierarchyName + "] does not exist in selected hierarchy [" + selectedHierarchyName + "]");
      String description = "Selected level [" + selectedHierarchyName + "] does not exist in selected hierarchy [" + selectedHierarchyName + "]";
      List hints = new ArrayList();
      hints.add("Check if level name is correct");
      hints.add("Check if a level named " + selectedLevelName +"  is defined into hierarachy " + selectedHierarchyName + ". " +
          "Defined level are: "
          + Arrays.toString( selectedHierarchy.getLevelNames().toArray()) );
      geoException =  new GeoEngineException("Configuration error");
      geoException.setDescription(description);
      geoException.setHints(hints);
      throw geoException;
    }
View Full Code Here


  /* (non-Javadoc)
   * @see it.eng.spagobi.engines.geo.dataset.provider.IDatasetProvider#getSelectedLevel()
   */
  public Hierarchy.Level getSelectedLevel() {
    Hierarchy selectedHierarchy = getSelectedHierarchy();
    if(selectedHierarchy != null) {
      return selectedHierarchy.getLevel( selectedLevelName );
    }
    return null;
  }
View Full Code Here

   * @return the dim geo query
   */
  private String getDimGeoQuery() {
      String query = "";
     
      Hierarchy hierarchy = datamartProvider.getSelectedHierarchy();
      String baseLevelName = datamartProvider.getMetaData().getLevelName( hierarchy.getName() );
      Hierarchy.Level baseLevel = hierarchy.getLevel( baseLevelName );
       
      List levels = hierarchy.getSublevels(baseLevel.getName());
     
      query += "SELECT " + baseLevel.getColumnId();
      for(int i = 0; i < levels.size(); i++) {
        Hierarchy.Level subLevel;
        subLevel = (Hierarchy.Level)levels.get(i);
        query += ", " + subLevel.getColumnId();
      }
      query += " FROM " + hierarchy.getTable();
      query += " GROUP BY " + baseLevel.getColumnId();
      for(int i = 0; i < levels.size(); i++) {
        Hierarchy.Level subLevel;
        subLevel = (Hierarchy.Level)levels.get(i);
        query += ", " + subLevel.getColumnId();
View Full Code Here

       * @return the dim geo query
       */
      private String getDimGeoQuery() {
        String query = "";
       
        Hierarchy hierarchy = getSelectedHierarchy();
        String baseLevelName = getMetaData().getLevelName( hierarchy.getName() );
        Hierarchy.Level baseLevel = hierarchy.getLevel( baseLevelName );
         
        List levels = hierarchy.getSublevels(baseLevel.getName());
       
        query += "SELECT " + baseLevel.getColumnId();
        for(int i = 0; i < levels.size(); i++) {
          Hierarchy.Level subLevel;
          subLevel = (Hierarchy.Level)levels.get(i);
          query += ", " + subLevel.getColumnId();
        }
        query += " FROM " + hierarchy.getTable();
        query += " GROUP BY " + baseLevel.getColumnId();
        for(int i = 0; i < levels.size(); i++) {
          Hierarchy.Level subLevel;
          subLevel = (Hierarchy.Level)levels.get(i);
          query += ", " + subLevel.getColumnId();
View Full Code Here

       
        String subQueryAlias = "t" + System.currentTimeMillis();
        String normalizedSubQueryAlias = "n" + System.currentTimeMillis();
        String dimGeoAlias = "g" + System.currentTimeMillis();
       
        Hierarchy hierarchy = getSelectedHierarchy();
        Hierarchy.Level level = getSelectedLevel();
        String baseLevelName = getMetaData().getLevelName( hierarchy.getName() );
        Hierarchy.Level baseLevel = hierarchy.getLevel( baseLevelName );
       
        if(hierarchy.getType().equalsIgnoreCase("custom")) {
          System.out.println("\nCUSTOM HIERARCHY...\n");
          String aggregationColumnName = level.getColumnId();
          aggragateQuery = "SELECT * " ;
          aggragateQuery += " \nFROM ( " + query + ") " + subQueryAlias;
          aggragateQuery += " \nWHERE " + subQueryAlias + "." + level.getColumnId();
          aggragateQuery += " = '" + filterValue + "'";
        } else {
          System.out.println("\nDEFAULT HIERARCHY...\n");
          String aggregationColumnName = level.getColumnId();
          aggragateQuery = "SELECT * ";
          String[] kpiColumnNames = (String[])getMetaData().getMeasureColumnNames().toArray(new String[0]);
         
         
          String normalizedSubQuery = query;
       
          normalizedSubQuery ="SELECT " + normalizedSubQueryAlias + "." + getMetaData().getGeoIdColumnName( hierarchy.getName() ) " AS " + getMetaData().getGeoIdColumnName( hierarchy.getName() );
          for(int i = 0; i < kpiColumnNames.length; i++) {
            normalizedSubQuery +=  ", SUM(" + normalizedSubQueryAlias + "." + kpiColumnNames[i] + ") AS " + kpiColumnNames[i];
          }
          normalizedSubQuery += " \nFROM ( " + query + ") " + normalizedSubQueryAlias;
          normalizedSubQuery += " \nGROUP BY " + normalizedSubQueryAlias + "." + getMetaData().getGeoIdColumnName( hierarchy.getName() );
          System.out.println("\nNormalized query:\n" + normalizedSubQuery);
         
         
          aggragateQuery += " \nFROM ( \n" + normalizedSubQuery + "\n ) " + subQueryAlias;
          String dimGeoQuery = getDimGeoQuery();
          System.out.println("\nDimGeo query:\n" + dimGeoQuery);
          aggragateQuery += ", (" + dimGeoQuery + ") " + dimGeoAlias;
          aggragateQuery += " \nWHERE " + subQueryAlias + "." + getMetaData().getGeoIdColumnName( hierarchy.getName() );
          aggragateQuery += " = " + dimGeoAlias + "." + baseLevel.getColumnId();
          aggragateQuery += " \nAND  " + dimGeoAlias + "." + level.getColumnId() + " = '" + filterValue + "'";
        }
       
        System.out.println("\nExecutable query:\n" + aggragateQuery);
View Full Code Here

       */
      public SourceBean getDataDetails(String featureValue) {
        SourceBean results = null;
       
      
        Hierarchy hierarchy = getSelectedHierarchy();
        String baseLevelName = getMetaData().getLevelName( hierarchy.getName() );
        Hierarchy.Level baseLevel = hierarchy.getLevel( baseLevelName );   
        String columnid = baseLevel.getColumnId();    
       
        String targetLevelName = getSelectedLevelName();
        String filterValue = featureValue;
        if(filterValue.trim().startsWith(targetLevelName + "_")) {
View Full Code Here

   
    List links = corssNavConfSB.getAttributeAsList("LINK");
    for(int i = 0; i < links.size(); i++) {
      SourceBean linkSB = (SourceBean)links.get(i);
      String hierarchyName = (String)linkSB.getAttribute("HIERARCHY");
      Hierarchy hierarchy = (Hierarchy)hierarchies.get(hierarchyName);
      if(hierarchy == null) continue;
      String levelName = (String)linkSB.getAttribute("LEVEL");
      Hierarchy.Level level = (Hierarchy.Level)hierarchy.getLevel(levelName);
      if(level == null) continue;
     
      String measure = (String)linkSB.getAttribute("MEASURE");
      logger.debug("add link: " + hierarchyName + "->" + levelName + "->" + measure);
     
View Full Code Here

      return null;
    }
   
    hierarchies = new HashMap();
   
    Hierarchy hierarchy = null;
    List hierarchyList = hierarchiesSB.getAttributeAsList(GeoEngineConstants.HIERARCHY_TAG);
    for(int i = 0; i < hierarchyList.size(); i++) {
     
      SourceBean hierarchySB = (SourceBean)hierarchyList.get(i);
      String name = (String)hierarchySB.getAttribute(GeoEngineConstants.HIERARCHY_NAME_ATTRIBUTE);
      String type = (String)hierarchySB.getAttribute(GeoEngineConstants.HIERARCHY_TYPE_ATTRIBUTE);
      List levelList = null;
      if(type.equalsIgnoreCase("custom"))  {
        hierarchy = new Hierarchy(name);
        levelList =  hierarchySB.getAttributeAsList(GeoEngineConstants.HIERARCHY_LEVEL_TAG);
      } else {
        if(sdtHierarchySB!= null) {
          hierarchySB = sdtHierarchySB;
          String table = (String)hierarchySB.getAttribute(GeoEngineConstants.HIERARCHY_TABLE_ATRRIBUTE);
          hierarchy = new Hierarchy(name, table);
          levelList = hierarchySB.getAttributeAsList(GeoEngineConstants.HIERARCHY_LEVEL_TAG);
        } else {
          logger.error("Impossible to include default hierarchy");
        }
      }
     
      for(int j = 0; j < levelList.size(); j++) {
        SourceBean levelSB = (SourceBean)levelList.get(j);
        String lname = (String)levelSB.getAttribute(GeoEngineConstants.HIERARCHY_LEVEL_NAME_ATRRIBUTE);
        String lcolumnid = (String)levelSB.getAttribute(GeoEngineConstants.HIERARCHY_LEVEL_COLUMN_ID_ATRRIBUTE);
        String lcolumndesc = (String)levelSB.getAttribute(GeoEngineConstants.HIERARCHY_LEVEL_COLUMN_DESC_ATRRIBUTE);
        String lfeaturename = (String)levelSB.getAttribute(GeoEngineConstants.HIERARCHY_LEVEL_FEATURE_NAME_ATRRIBUTE);
        Hierarchy.Level level = new Hierarchy.Level();
        level.setName(lname);
        level.setColumnId(lcolumnid);
        level.setColumnDesc(lcolumndesc);
        level.setFeatureName(lfeaturename);
        hierarchy.addLevel(level);
      }
     
      hierarchies.put(hierarchy.getName(), hierarchy);
   
   
    return hierarchies;
  }
View Full Code Here

      JSONObject responseJSON = new JSONObject();
     
      String[] hierachieNames = (String[])getGeoEngineInstance().getDataMartProvider().getHierarchyNames().toArray(new String[0]);
      JSONArray hierarchiesJSON = new JSONArray();
      for(int j = 0; j < hierachieNames.length; j++) {
        Hierarchy hierarchy = getGeoEngineInstance().getDataMartProvider().getHierarchy(hierachieNames[j]);
        JSONObject hierarchyJSON = new JSONObject();
        hierarchyJSON.put("id", hierarchy.getName());
        hierarchyJSON.put("name", hierarchy.getName());
        hierarchyJSON.put("description", hierarchy.getName());
        List levels = hierarchy.getLevels();
        JSONArray levelsJSON = new JSONArray();
        for(int i = 0; i < levels.size(); i++) {
          Level level = (Level)levels.get(i);
          JSONObject levelJSON = new JSONObject();
          levelJSON.put("id", level.getName());
View Full Code Here

    // Toolkit tk = Toolkit.getDefaultToolkit();
    // levelImg = tk.getImage(loader.getURL("level1.png"));
  }

  public void loadLevel(EntityManager em) {
    level1 = new Level(em);
    loaded = true;

    double milli = System.currentTimeMillis();

    tm.newLevel(level1);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.engines.geo.dataset.provider.Hierarchy$Level

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.