Package it.eng.spagobi.tools.dataset.common.datastore

Examples of it.eng.spagobi.tools.dataset.common.datastore.IRecord


        SVGElement child = (SVGElement)childNode;

        String childId = child.getId();
        String column_id = childId.replaceAll(datamart.getTargetFeatureName() + "_", "");

        IRecord record = dataStore.getRecordByID( column_id );


        //Map attributes = (Map)datamart.getAttributeseById(column_id);


        String targetColor = null;
        Number kpyValue = null;
        if(record != null) {
          IField field = record.getFieldAt( dataStoreMeta.getFieldIndex(selectedKpiName) )
          String kpyValueAttr = "" + field.getValue();
          //String kpyValueAttr = (String)attributes.get( selectedKpiName ); 
          if(kpyValueAttr == null) {
            targetColor = null_values_color;
          } else {
            kpyValue = Double.parseDouble(kpyValueAttr);

            if(kpyValue.doubleValue() < lb_value.doubleValue()) {
              targetColor = lb_color;
            } else if(kpyValue.doubleValue() > ub_value.doubleValue()) {
              targetColor = ub_color;
            } else if(kpyValue.doubleValue() == ub_value.doubleValue()) {
              targetColor = col_kpi_array[trash_kpi_array.length-2];
            } else  {
              for (int j = 0; j < trash_kpi_array.length-1; j++) {
                if (kpyValue.doubleValue() >= trash_kpi_array[j].doubleValue() && kpyValue.doubleValue() <  trash_kpi_array[j+1].doubleValue()) {
                  targetColor = col_kpi_array[j];
                  break;
                }
              }
            }
          }
        }

        if(targetColor != null) {
          if(child.getNodeName().equals("path")
              || child.getNodeName().equals("polygon")
              || child.getNodeName().equals("ellipse")
              || child.getNodeName().equals("circle")
              || child.getNodeName().equals("rect")
          ) {

            child.setAttribute("fill", targetColor );
          } else if(child.getNodeName().equals("line")
              || child.getNodeName().equals("polyline")
          ) {
            child.setAttribute("stroke", targetColor );
          }

          String opacity = measure.getColurCalculatorParameters().getProperty("opacity");
          if(opacity != null) {
            child.setAttribute("opacity", opacity );
          }


        }

      }
    }

    // add label
    //Map values = datamart.getValues();
    //Iterator it = values.keySet().iterator();
    Iterator it = dataStore.iterator();
    while(it.hasNext()) {
      IRecord record = (IRecord)it.next();
      IField field = null;

      field = record.getFieldAt( dataStoreMeta.getIdFieldIndex() );
      String id = (String)field.getValue();
      //String id = (String)it.next();



      //Map kpiValueMap = (Map)values.get(id);

      String centroideId = "centroidi_" + datamart.getTargetFeatureName() + "_"  + id;
      Element centroide = targetMap.getElementById( centroideId );
      if( centroide != null ) {
        List fields = record.getFields();
        int line = 0;
        Element labelGroup = null;
        if(fields.size()>0) labelGroup = masterMap.createElement("g");
        boolean isFirst = true;
        for(int i = 0; i < fields.size(); i++) {
View Full Code Here


        SVGElement child = (SVGElement)childNode;
        String childId = child.getId();
        String column_id = childId.replaceAll(datamart.getTargetFeatureName() + "_", "");


        IRecord record = dataStore.getRecordByID( column_id );
        if(record == null) {
          logger.warn("No data available for feature [" + column_id +"]");
          continue;
        }
        List fields = record.getFields();
        for(int j = 0; j < fields.size(); j++) {
          if(j == dataStore.getMetaData().getIdFieldIndex() ) {
            continue;
          }
          IField field = (IField)fields.get(j);
View Full Code Here

        if(childNode instanceof Element) {
          SVGElement childOrig =(SVGElement)childNode;         
          String childId = childOrig.getId();
          String column_id = childId.replaceAll(datamart.getTargetFeatureName() + "_", "");         

          IRecord record = dataStore.getRecordByID( column_id );
          if(record == null) {
            logger.warn("No data available for feature [" + column_id + "]");
            continue;
          }

          IField filed = record.getFieldAt( dataStoreMeta.getFieldIndex( filedMeta.getName()) );

          String link = "" + filed.getValue();

          if (link != null) {
            mapLink = new HashMap();
View Full Code Here

            String[] measureColumnNames = (String[])getMetaData().getMeasureColumnNames().toArray(new String[0]);       
                      
             
              Iterator it = dataStore.iterator();
              while(it.hasNext()) {
                IRecord record = (IRecord)it.next();
               
                IField field;
               
                field = record.getFieldAt( dataStoreMeta.getFieldIndex(columnid) );
                String id = "" + field.getValue();
                if((id==null) || (id.trim().equals(""))) {
                  continue;
                }
                dataStoreMeta.getFieldMeta( dataStoreMeta.getFieldIndex(columnid) ).setProperty("ROLE", "GEOID");
               
                for(int i = 0; i < measureColumnNames.length; i++) {
                  field = record.getFieldAt( dataStoreMeta.getFieldIndex(measureColumnNames[i]) );
                    String value = "" + field.getValue();
                    if((value==null) || (value.trim().equals(""))) {
                      continue;
                    }
                    dataStoreMeta.getFieldMeta( dataStoreMeta.getFieldIndex(measureColumnNames[i]) ).setProperty("ROLE", "MEASURE");
View Full Code Here

 
  public void addLinkField(String fieldName, Link link, IDataStore dataStore) {
   
    IDataStoreMetaData dataStoreMeta;
    FieldMetadata fieldMeta;
    IRecord record;
    IField field;
   
   
    try {
      Assert.assertNotNull(fieldName, "Input parametr [fieldName] cannot be null");
      //Link parameter can be null; in that case Link.DEFAULT_BASE_URL will be used
      Assert.assertNotNull(dataStore, "Input parametr [dataStore] cannot be null");
     
      try {
        logger.debug("Adding link column [" + fieldName + ": " + link + "] ...");
       
        dataStoreMeta = dataStore.getMetaData();
        fieldMeta = new FieldMetadata();
         
        fieldMeta.setName(fieldName);
        fieldMeta.setType(String.class);
        fieldMeta.setProperty("ROLE", "CROSSNAVLINK");
       
        dataStoreMeta.addFiedMeta(fieldMeta);
       
        logger.debug("Link column [" + fieldName + ": " + link + "] added succesfully");
      } catch(Throwable t) {
        throw new GeoEngineException("Impossible to add link column [" + fieldName + ": " + link + "] to datastore", t);
      }
     
      record = null;
      try {
        logger.debug("Valorizing link column [" + fieldName + ": " + link + "] for each record in the dataset ...");
        Iterator it = dataStore.iterator();
        while(it.hasNext()) {
          record = (IRecord)it.next();
          if(link != null) {
            logger.debug("Added link value [" + link.toXString(record, env) + "]");
            field = new Field( link.toXString(record, env) )
          } else {
            field = new Field( Link.DEFAULT_BASE_URL );   
            logger.debug("Added link value [" + Link.DEFAULT_BASE_URL + "]");
          }
             
          record.appendField( field );
        }
        logger.debug("Link column [" + fieldName + ": " + link + "] has been succesfully valorized for each record in the dataset ");
      } catch(Throwable t) {
        throw new GeoEngineException("Impossible to valorize link column for record [" + record + "]", t);
      }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.dataset.common.datastore.IRecord

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.