JsonObject info = (JsonObject) jsoninfo;
view.addSelect( (info.names().contains( "as" )) ? info.get( "as" ).asString() : null, info.get( "select" ).asString() );
}
} catch ( NullPointerException e )
{
throw new ParserException( "Couldn't parse the selects in this view." );
}
try
{
for ( JsonValue jsoninfo : jsonview.get( "from" ).asArray() )
{
view.addFromTable( jsoninfo.asString() );
}
} catch ( NullPointerException e )
{
throw new ParserException( "Couldn't parse the from tables in this view." );
}
try
{
for ( JsonValue jsoninfo : jsonview.get( "on" ).asArray() )
{
view.addJoinOn( jsoninfo.asString() );
}
} catch ( NullPointerException e )
{
throw new ParserException( "Couldn't parse the fields on which to join in this view." );
}
try
{
if ( jsonview.names().contains( "order" ) )
{
for ( JsonValue jsoninfo : jsonview.get( "order" ).asArray() )
{
JsonObject info = (JsonObject) jsoninfo;
view.addOrder( info.get( "by" ).asString(), (info.names().contains( "sort" )) ? info.get( "sort" ).asString() : "ASC" );
}
}
} catch ( NullPointerException e )
{
throw new ParserException( "Couldn't parse the ordering in this view." );
}
try
{
if ( jsonview.names().contains( "group" ) )
{
for ( JsonValue jsoninfo : jsonview.get( "group" ).asArray() )
{
view.addGroup( jsoninfo.asString() );
}
}
} catch ( NullPointerException e )
{
throw new ParserException( "Couldn't parse the grouping in this view." );
}
if ( jsonview.names().contains( "join" ) )
{
view.jointype = jsonview.get( "join" ).asString();
}