Examples of IFieldMetaData


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

    measures = new ArrayList<CrossTab.MeasureInfo>();
    IDataStoreMetaData meta = dataStore.getMetaData();
    for(int i = meta.getFieldCount() - measuresCount; i < meta.getFieldCount(); i++){
      // the field number i contains the measure number (i - <number of dimensions>)
      // but <number of dimension> is <total fields count> - <total measures count>
      IFieldMetaData fieldMeta = meta.getFieldMeta(i);
      Measure relevantMeasure = crosstabDefinition.getMeasures().get( i - (meta.getFieldCount() - measuresCount));
      measures.add(getMeasureInfo(fieldMeta, relevantMeasure));
    }
  }
View Full Code Here

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

      List<String> columnsName = new ArrayList<String>();
     
      //reads the names of the visible table columns
      for(int j = 0; j < colunum; j++){
          String fieldName = dataStoreMetaData.getFieldName(j);
          IFieldMetaData fieldMetaData = dataStoreMetaData.getFieldMeta(j);
//          String format = (String) fieldMetaData.getProperty("format");
          String alias = (String) fieldMetaData.getAlias();
          Boolean visible = (Boolean) fieldMetaData.getProperty("visible");

          if (visible != null && visible.booleanValue()) {
              if(alias!=null && !alias.equals("")){
                columnsName.add(alias);
              }else{
View Full Code Here

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

      List fields = record.getFields();
      int length = fields.size();
      //build the row
      for(int fieldIndex =0; fieldIndex<length; fieldIndex++){
        IField f = (IField)fields.get(fieldIndex);
        IFieldMetaData fieldMetaData = d.getFieldMeta(fieldIndex);
          Boolean visible = (Boolean) fieldMetaData.getProperty("visible");
         
          if(visible){
            if (f == null || f.getValue()== null) {
              cell = new PdfPCell(new Phrase(""));
            }else{
View Full Code Here

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

      CellStyle[] cellTypes = new CellStyle[colnum]; // array for numbers patterns storage
      for(int j = 0; j < colnum; j++){
        Cell cell = row.createCell(j + beginColumnHeaderData);
          cell.setCellType(HSSFCell.CELL_TYPE_STRING);
          String fieldName = d.getFieldName(j);
          IFieldMetaData fieldMetaData = d.getFieldMeta(j);
          String format = (String) fieldMetaData.getProperty("format");
          String alias = (String) fieldMetaData.getAlias();
          Boolean visible = (Boolean) fieldMetaData.getProperty("visible");
            if (extractedFields != null && extractedFields.get(j) != null) {
            Field field = (Field) extractedFields.get(j);
            fieldName = field.getAlias();
            if (field.getPattern() != null) {
              format = field.getPattern();
View Full Code Here

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

      List fields = record.getFields();
      int length = fields.size();
      for(int fieldIndex =0; fieldIndex<length; fieldIndex++){
        IField f = (IField)fields.get(fieldIndex);
        if (f != null && f.getValue()!= null) {
              IFieldMetaData fieldMetaData = d.getFieldMeta(fieldIndex);
              Boolean visible = (Boolean) fieldMetaData.getProperty("visible");
              if(visible){
            Class c = d.getFieldType(fieldIndex);
            logger.debug("Column [" + (fieldIndex) + "] class is equal to [" + c.getName() + "]");
            if(rowVal==null){
              rowVal = sheet.createRow(rownum);
View Full Code Here

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

    }
    IDataStoreMetaData dataStoreMetaData=dataStore.getMetaData();

    HashMap<String , Class> metadataMap=new HashMap<String, Class>();
    for (int i = 0; i < dataStoreMetaData.getFieldCount(); i++) {
      IFieldMetaData fieldMetaData=dataStoreMetaData.getFieldMeta(i);
      String name = fieldMetaData.getAlias() != null ? fieldMetaData.getAlias() : fieldMetaData.getName();
      Class type = fieldMetaData.getType();
      if(!metadataMap.containsKey(name)){
        metadataMap.put(name, type);
      }
    }
View Full Code Here

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

   
      // field's meta
      fieldsMetaDataJSON = new JSONArray();
      fieldsMetaDataJSON.put("recNo"); // counting column
      for(int i = 0; i < dataStore.getMetaData().getFieldCount(); i++) {
        IFieldMetaData fieldMetaData = dataStore.getMetaData().getFieldMeta(i);
       
        propertyRawValue = fieldMetaData.getProperty("visible");
        if(propertyRawValue != null
            && (propertyRawValue instanceof Boolean)
            && ((Boolean)propertyRawValue).booleanValue() == false) {
          continue;
        }
       
        fieldMetaDataJSON = new JSONObject();
        fieldMetaDataJSON.put("header", "Values");
        fieldMetaDataJSON.put("name", "Values" );           
        fieldMetaDataJSON.put("dataIndex", "Values");
                     
             
        Class clazz = fieldMetaData.getType();
        logger.debug("Column [" + (i+1) + "] class is equal to [" + clazz.getName() + "]");
        if( Number.class.isAssignableFrom(clazz) ) {
          //BigInteger, Integer, Long, Short, Byte
          if(Integer.class.isAssignableFrom(clazz)
               || BigInteger.class.isAssignableFrom(clazz)
             || Long.class.isAssignableFrom(clazz)
             || Short.class.isAssignableFrom(clazz)
             || Byte.class.isAssignableFrom(clazz)) {
            logger.debug("Column [" + (i+1) + "] type is equal to [" + "INTEGER" + "]");
            fieldMetaDataJSON.put("type", "int");
          } else {
            logger.debug("Column [" + (i+1) + "] type is equal to [" + "FLOAT" + "]");
            fieldMetaDataJSON.put("type", "float");
          }
         
        } else if( String.class.isAssignableFrom(clazz) ) {
          logger.debug("Column [" + (i+1) + "] type is equal to [" + "STRING" + "]");
          fieldMetaDataJSON.put("type", "string");
        } else if( Date.class.isAssignableFrom(clazz) ) {
          logger.debug("Column [" + (i+1) + "] type is equal to [" + "DATE" + "]");
          fieldMetaDataJSON.put("type", "date");
          fieldMetaDataJSON.put("dateFormat", "d/m/Y H:i:s");
        } else if( Boolean.class.isAssignableFrom(clazz) ) {
          logger.debug("Column [" + (i+1) + "] type is equal to [" + "BOOLEAN" + "]");
          fieldMetaDataJSON.put("type", "boolean");
        } else {
          logger.warn("Column [" + (i+1) + "] type is equal to [" + "???" + "]");
          fieldMetaDataJSON.put("type", "string");
        }
       
        Boolean calculated = (Boolean)fieldMetaData.getProperty("calculated");
        if(calculated.booleanValue() == true) {
          DataSetVariable variable =  (DataSetVariable)fieldMetaData.getProperty("variable");
          if(variable.getType().equalsIgnoreCase(DataSetVariable.HTML)) {
            fieldMetaDataJSON.put("type", "auto");
            fieldMetaDataJSON.remove("type");
            fieldMetaDataJSON.put("subtype", "html");
          }       
        }
        fieldsMetaDataJSON.put(fieldMetaDataJSON);
      }
     
      fieldsMetaDataJSON.put("recCk");
      metadata.put("fields", fieldsMetaDataJSON);
     
      // records
      recNo = 0;
      Iterator records = dataStore.iterator();
      while(records.hasNext()) {
        record = (IRecord)records.next();
        recordJSON = new JSONObject();
       
        for(int i = 0; i < dataStore.getMetaData().getFieldCount(); i++) {
          IFieldMetaData fieldMetaData = dataStore.getMetaData().getFieldMeta(i);
         
          propertyRawValue = fieldMetaData.getProperty("visible");
          if(propertyRawValue != null
              && (propertyRawValue instanceof Boolean)
              && ((Boolean)propertyRawValue).booleanValue() == false) {
            continue;
          }
          String key = fieldMetaData.getAlias() != null ? fieldMetaData.getAlias() : fieldMetaData.getName();
          field = record.getFieldAt( dataStore.getMetaData().getFieldIndex( key ) );
   
          String fieldValue = "";
          if(field.getValue() != null && !field.getValue().equals("")) {
            if(Date.class.isAssignableFrom(fieldMetaData.getType())) {
              fieldValue =  DATE_FORMATTER.formatfield.getValue() );
            } else {
              fieldValue =  field.getValue().toString();
            }
          }
View Full Code Here

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

  void doUpdateDecoration(IDataStore dataStore, IRecord record) {
    IDataStoreMetaData dataStoreMeta = dataStore.getMetaData();
    int filedNo = dataStoreMeta.getFieldCount();
   
    for(int i = 0; i < filedNo; i++) {
      IFieldMetaData fieldMeta = dataStoreMeta.getFieldMeta(i);
      IField field = (IField)record.getFieldAt(i);
     
      Integer w = (Integer)fieldMeta.getProperty( PROPERTY_NAME );
      if(w == null) {
        //fieldMeta.setProperty(PROPERTY_NAME, new Integer(0));
        w = new Integer(0);
      }
      Object value = field.getValue();
      String valueStr = "" + value;
      int displaySize = (field.getValue() == null? 0: valueStr.length());
      if(w.intValue() < displaySize) w = new Integer(displaySize);
      fieldMeta.setProperty(PROPERTY_NAME, w);
    }
  }
View Full Code Here

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

        JSONObject parsedRow = parsedRows.getJSONObject(i);
        IRecord record = new Record(dataStore);
        for(int j = 0; j < dataStoreMeta.getFieldCount(); j++) {
          String columnName = dataStoreMeta.getFieldName(j);
          String columnValue = parsedRow.getString(columnName);
          IFieldMetaData fieldMeta = dataStoreMeta.getFieldMeta(j);
     
         
          Class fieldType = fieldMeta.getType();
          Object value = null;
          if(fieldType == String.class) {
            value = columnValue;
          } else if(fieldType == BigInteger.class ) {
            value = new BigInteger(columnValue);
View Full Code Here

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

        while(rowIterator.hasNext()) {   
          SourceBean rowSB = (SourceBean) rowIterator.next();
          IRecord record = new Record(dataStore);
           
          for(int i = 0; i < dataStoreMeta.getFieldCount(); i++) {
            IFieldMetaData fieldMetaData = dataStoreMeta.getFieldMeta(i);
            try {
              Object value = rowSB.getAttribute( dataStoreMeta.getFieldName(i) );
              logger.debug("Column [" + fieldMetaData.getName() + "] of type [" + (value!=null? value.getClass(): "undef") + "] is equal to [" + value + "]");         
              IField field = new Field( value );
              if(value != null) {
                dataStoreMeta.getFieldMeta(i).setType( value.getClass() );
              }
              record.appendField( field );
            } catch(Throwable t ) {
              throw new RuntimeException("Impossible to read column [" + fieldMetaData.getName()+ "] value", t);
            }
          }
          dataStore.appendRecord(record);
        }
      }       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.