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

Examples of it.eng.spagobi.engines.geo.dataset.DataSetMetaData


    } else {
      confSB = (SourceBean)conf;
    }
   
    if(confSB != null) {
      DataSetMetaData mataData = null;
      Map hierarchies = null;
      String selectedHierarchyName = null;
      String selectedLevelName = null;
           
      selectedHierarchyName = getSelectedHierarchyName( confSB );
View Full Code Here


   * @param confSB the conf sb
   *
   * @return the meta data
   */
  public static DataSetMetaData getMetaData(SourceBean confSB) {
    DataSetMetaData metaData;
    SourceBean metadataSB;
    List columns;
    SourceBean columnSB;
    String columnName;
    String columnType;
   
    logger.debug("IN");
   
    metaData = null;
    metadataSB = null;
   
    try {
   
      metadataSB = (SourceBean)confSB.getAttribute(GeoEngineConstants.METADATA_TAG);
      if(metadataSB == null) {
        logger.warn("Cannot find metadata configuration settings: tag name " + GeoEngineConstants.METADATA_TAG);
        logger.info("Metadata configuration settings must be injected at execution time");
        return null;
      }
     
     
      logger.debug("Metadata block has been found in configuration");
     
      metaData = new DataSetMetaData();
     
      columns = metadataSB.getAttributeAsList(GeoEngineConstants.COLUMN_TAG);
      logger.debug("Metadata block contains settings for [" + columns + "] columns");
     
      for(int i = 0; i < columns.size(); i++) {
        columnSB = null;
        try {
          logger.debug("Parsing column  [" + i + "]");
          columnSB = (SourceBean)columns.get(i);
         
          columnName = (String)columnSB.getAttribute(GeoEngineConstants.COLUMN_NAME_ATTRIBUTE);
          logger.debug("Column [" + i + "] name [" + columnName + "]");
          Assert.assertNotNull(columnName, "Attribute [" + GeoEngineConstants.COLUMN_NAME_ATTRIBUTE + "] of tag [" + GeoEngineConstants.COLUMN_TAG + "] cannot be null");
         
          columnType = (String)columnSB.getAttribute(GeoEngineConstants.COLUMN_TYPE_ATTRIBUTE)
          logger.debug("Column [" + i + "] name [" + columnType + "]");
          Assert.assertNotNull(columnName, "Attribute [" + GeoEngineConstants.COLUMN_TYPE_ATTRIBUTE + "] of tag [" + GeoEngineConstants.COLUMN_TAG + "] cannot be null");
                 
          metaData.addColumn(columnName);
          metaData.setColumnProperty(columnName, "column_id", columnName);
          metaData.setColumnProperty(columnName, "type", columnType);
         
          if( columnType.equalsIgnoreCase("geoid")) {
            String hierarchyName = (String)columnSB.getAttribute(GeoEngineConstants.COLUMN_HIERARCHY_REF_ATTRIBUTE);
            logger.debug("Column [" + i + "] attribute [" + GeoEngineConstants.COLUMN_HIERARCHY_REF_ATTRIBUTE + "]is equal to [" + hierarchyName + "]");
            Assert.assertNotNull(hierarchyName, "Attribute [" + GeoEngineConstants.COLUMN_HIERARCHY_REF_ATTRIBUTE + "] of tag [" + GeoEngineConstants.COLUMN_TAG + "] cannot be null");
            metaData.setColumnProperty(columnName, "hierarchy", hierarchyName)
           
            String levelName = (String)columnSB.getAttribute(GeoEngineConstants.COLUMN_LEVEL_REF_ATTRIBUTE);
            logger.debug("Column [" + i + "] attribute [" + GeoEngineConstants.COLUMN_LEVEL_REF_ATTRIBUTE + "]is equal to [" + levelName + "]");
            Assert.assertNotNull(hierarchyName, "Attribute [" + GeoEngineConstants.COLUMN_LEVEL_REF_ATTRIBUTE + "] of tag [" + GeoEngineConstants.COLUMN_TAG + "] cannot be null");
            metaData.setColumnProperty(columnName, "level", levelName);
          } else if( columnType.equalsIgnoreCase("measure")) {
            String aggFunc = (String)columnSB.getAttribute(GeoEngineConstants.COLUMN_AFUNC_REF_ATTRIBUTE);
            logger.debug("Column [" + i + "] attribute [" + GeoEngineConstants.COLUMN_AFUNC_REF_ATTRIBUTE + "]is equal to [" + aggFunc + "]");
            Assert.assertNotNull(aggFunc, "Attribute [" + GeoEngineConstants.COLUMN_AFUNC_REF_ATTRIBUTE + "] of tag [" + GeoEngineConstants.COLUMN_TAG + "] cannot be null");
            metaData.setColumnProperty(columnName, "func", aggFunc);       
          }
          logger.debug("Column  [" + i + "] parsed succesfully");
        } catch (Throwable t) {
          throw new GeoEngineException("An error occurred while parsing column [" + columnSB + "]", t);
        }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.engines.geo.dataset.DataSetMetaData

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.