Package it.eng.qbe.serializer

Examples of it.eng.qbe.serializer.SerializationException


        childsJSON.put(childJSON);
      }   
     
      exp.put(QuerySerializationConstants.EXPRESSION_CHILDREN, childsJSON);
    } catch(JSONException e) {
      throw new SerializationException("An error occurred while serializing filter expression", e);
    }   
    
    return exp;
  }
View Full Code Here


        logger.debug("Deserializing string [" + (String)o + "]");
        try {
          queryJSON = new JSONObject( (String)o );
        } catch(Throwable t) {
          logger.debug("Object to be deserialized must be string encoding a JSON object");
          throw new SerializationException("An error occurred while deserializing query: " + (String)o, t);
        }
      } else if(o instanceof JSONObject) {
        queryJSON = (JSONObject)o;
      } else {
        Assert.assertUnreachable("Object to be deserialized must be of type string or of type JSONObject, not of type [" + o.getClass().getName() + "]");
      }
     
      query  = new Query()
     
      try {
        query.setId(queryJSON.getString(QuerySerializationConstants.ID));
        query.setName(queryJSON.optString(QuerySerializationConstants.NAME));
        query.setDescription(queryJSON.optString(QuerySerializationConstants.DESCRIPTION));
        query.setDistinctClauseEnabled(queryJSON.optBoolean( QuerySerializationConstants.DISTINCT ));
        // TODO: move this in AnalysisStateLoader class
        try {
          query.setNestedExpression(queryJSON.getBoolean( QuerySerializationConstants.IS_NESTED_EXPRESSION ));
        } catch(Exception e) {
          query.setNestedExpression(false);
        }
        fieldsJSON = queryJSON.getJSONArray( QuerySerializationConstants.FIELDS );       
        filtersJSON = queryJSON.getJSONArray( QuerySerializationConstants.FILTERS );
        expressionJSON = queryJSON.getJSONObject( QuerySerializationConstants.EXPRESSION );
        havingsJSON = queryJSON.getJSONArray( QuerySerializationConstants.HAVINGS );
        subqueriesJSON = queryJSON.getJSONArray( QuerySerializationConstants.SUBQUERIES );
      } catch (JSONException e) {
        throw new SerializationException("An error occurred while deserializing query: " + queryJSON.toString(), e);
      }
     
      deserializeFields(fieldsJSON, dataSource, query);
      deserializeFilters(filtersJSON, dataSource, query);
      deserializeExpression(expressionJSON, dataSource, query);
      deserializeHavings(havingsJSON, dataSource, query);
     
     
      for(int i = 0; i < subqueriesJSON.length(); i++) {
        try {
          subquery = deserializeQuery(subqueriesJSON.get(i), dataSource);
        } catch (JSONException e) {
          throw new SerializationException("An error occurred while deserializing subquery number [" + (i+1) + "]: " + subqueriesJSON.toString(), e);
        }
       
        query.addSubquery(subquery);
      }
    } finally {
View Full Code Here

            Assert.assertUnreachable("Type [" + fieldType + "] of field [" + alias + "] is not valid");
          }
         
          logger.debug("Field [" + alias + "] succefully deserialized");
        } catch (Throwable t) {
          throw new SerializationException("An error occurred while deserializing field [" + fieldsJSON.toString() + "] of query [" + query.getId() + "]", t);
        }
      }
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while deserializing select clause: " + fieldsJSON.toString(), t);
    }                 
   
  }
View Full Code Here

             
           
          query.addWhereField(filterId, filterDescription, promptable, leftOperand, operator, rightOperand, booleanConnector);
         
        } catch (JSONException e) {
          throw new SerializationException("An error occurred while filter [" + filtersJOSN.toString() + "] of query [" + query.getId() + "]", e);
        }     
      }
    } catch(Throwable t) {
      throw new SerializationException("An error occurred while deserializing field of query [" + query.getId() +"]", t);
    } finally {
      logger.debug("OUT");
    }
     
  }
View Full Code Here

             
           
          query.addHavingField(filterId, filterDescription, promptable, leftOperand, operator, rightOperand, booleanConnector);
         
        } catch (JSONException e) {
          throw new SerializationException("An error occurred while deserializing filter [" + havingsJOSN.toString() + "] of query [" + query.getId() + "]", e);
        }
       
   
       
      }
    } catch(Throwable t) {
      throw new SerializationException("An error occurred while deserializing filters of query [" + query.getId() +"]", t);
    } finally {
      logger.debug("OUT");
    }
     
  }
View Full Code Here

      for(int i = 0; i < childNodesJSON.length(); i++) {
        JSONObject childNodeJSON = childNodesJSON.getJSONObject(i);
        node.addChild( getFilterExpTree(childNodeJSON) );
      }
      } catch(JSONException e) {
        throw new SerializationException("An error occurred while deserializing where clause structure: " + nodeJSON.toString(), e);
      }
    }
    return node;
  }
View Full Code Here

TOP

Related Classes of it.eng.qbe.serializer.SerializationException

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.