Examples of TranslationException


Examples of adipe.translate.TranslationException

                                   Map<String, ArrayList<Type>> columnTypes)
        throws TranslationException {
            try {
                return Schema.create(columnNames, columnTypes);
            } catch (RuntimeException ex) {
                throw new TranslationException(ex);
            }
        }
View Full Code Here

Examples of adipe.translate.TranslationException

        Relation r;
        ColumnNamesImpl[] colNamesWr = new ColumnNamesImpl[1];
        try {
            r = schema.instantiateTable(primaryName, knownAs, derivedColumnList, colNamesWr);
        } catch (IllegalStateException exc) {
            throw new TranslationException(exc.getMessage(), exc);
        }
        registerRelation(r.alias(), colNamesWr[0]);
        return makeState2(r, colNamesWr[0].asColumnIndexesLookup(), addQualifiedColumnNames(knownAs == null?primaryName:knownAs, colNamesWr[0]));
    }
View Full Code Here

Examples of adipe.translate.TranslationException

        havingClause = ctx.tableExpression().havingClause();


        if (groupByClause != null && isSelectAsterisk) {
            /* SELECT * FROM.. GROUP BY.. */
            throw new TranslationException("a query cannot have the form of 'SELECT * ... GROUP BY'");
        }
        if (havingClause != null && isSelectAsterisk) {
            /* SELECT * FROM.. HAVING.. */
            throw new TranslationException("a query cannot have the form of 'SELECT * ... HAVING'");
        }

        List<SimpleColumn> groupByExpressions = null;
        if (groupByClause != null) {
            groupByExpressions = Lists.newArrayList(visitGroupByClause(groupByClause));
View Full Code Here

Examples of adipe.translate.TranslationException

     * @param columnNo  counting from 1
     * @throws TranslationException
     */
    public Relation orderBy(int columnNo, boolean asc) throws TranslationException {
        if (columnNo == 0) {
            throw new TranslationException("ORDER BY 0");
        }
        if (columnNo < 0) {
            throw new TranslationException("wrong sort key");
        }
        if (columnNo > this.columns().size()) {
            throw new TranslationException(String.format("ORDER BY %s, while there are only %s columns", columnNo, this.columns().size()));
        }
        checkArgument(columnNo <= this.columns().size());
        if (asc) {
            return makeNew(Utils.sortAsc(this.formula(), columnNo), this.columns(), this.expandedColumns());
        } else {
View Full Code Here

Examples of adipe.translate.TranslationException

            Term t = formulas.remove(0);
            inputTables.add(t);
        }

        if (formulas.isEmpty()) {
            throw new TranslationException("An empty string was input as a query");
        }
    }
View Full Code Here

Examples of com.codiform.moo.TranslationException

        while ( sourceItems.hasNext() ) {
          Object item = itemSource.getValue( sourceItems.next() );
          targetCollection.add( item );
        }
      } else {
        throw new TranslationException( "Cannot translate collection to target of type: " + target.getClass().getName() );
      }
    } else {
      throw new TranslationException( "Cannot translate collection from type: " + value.getClass().getName() );
    }
  }
View Full Code Here

Examples of com.codiform.moo.TranslationException

          Object item = itemSource.getValue( sourceItems.next() );
          Object translated = cache.getTranslation( item, property.getItemClass() );
          targetCollection.add( translated );
        }
      } else {
        throw new TranslationException( "Cannot translate collection to target of type: " + target.getClass().getName() );
      }
    } else {
      throw new TranslationException( "Cannot translate from collection of type: " + target.getClass().getName() );
    }
  }
View Full Code Here

Examples of com.codiform.moo.TranslationException

  @Override
  public <T> T getTranslationTargetInstance( Object source, Class<T> targetType ) {
    Class<? extends T> type = getDefaultTypeForTarget( targetType );
    if ( type == null ) {
      throw new TranslationException( "Cannot determine default collection type for type: " + targetType );
    } else {
      return construct( type );
    }
  }
View Full Code Here

Examples of com.codiform.moo.TranslationException

  private <T> T getObjectTranslation( Object source, Class<? extends TranslationTargetFactory> factoryType, Class<T> destinationClass ) {
    ObjectTranslator<T> translator = getTranslator( destinationClass );
    TranslationTargetFactory factory = getTranslationTargetFactory( factoryType );
    T translated = factory.getTranslationTargetInstance( source, destinationClass );
    if ( translated == null )
      throw new TranslationException( "Translation target factory (" + factory + ") returned null instance; cannot translate." );
    translationCache.putTranslation( source, translated );
    translator.update( source, translated, this, variables );
    return translated;
  }
View Full Code Here

Examples of com.codiform.moo.TranslationException

      try {
        TranslationTargetFactory instance = factoryType.newInstance();
        translationTargetFactoryCache.put( factoryType, instance );
        return instance;
      } catch ( InstantiationException cause ) {
        throw new TranslationException( "Could not create translation target factory: " + factoryType, cause );
      } catch ( IllegalAccessException cause ) {
        throw new TranslationException( "Could not create translation target factory: " + factoryType, cause );
      }
    }
  }
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.