Package org.qi4j.library.rest.common.table

Examples of org.qi4j.library.rest.common.table.Table


                        throws IOException
                    {
                        try
                        {
                            JSONWriter json = new JSONWriter( writer );
                            Table tableValue = (Table) result;

                            // Parse parameters
                            String tqx = response.getRequest().getResourceRef().getQueryAsForm().getFirstValue( "tqx" );
                            String reqId = null;
                            if( tqx != null )
                            {
                                String[] params = tqx.split( ";" );
                                for( String param : params )
                                {
                                    String[] p = param.split( ":" );
                                    String key = p[ 0 ];
                                    String value = p[ 1 ];

                                    if( key.equals( "reqId" ) )
                                    {
                                        reqId = value;
                                    }
                                }
                            }

                            json.object().key( "version" ).value( "0.6" );
                            if( reqId != null )
                            {
                                json.key( "reqId" ).value( reqId );
                            }
                            json.key( "status" ).value( "ok" );
                            json.key( "table" ).object();
                            List<Column> columnList = tableValue.cols().get();
                            json.key( "cols" ).array();
                            for( Column columnValue : columnList )
                            {
                                json.object().
                                    key( "id" ).value( columnValue.id().get() ).
                                    key( "label" ).value( columnValue.label().get() ).
                                    key( "type" ).value( columnValue.columnType().get() ).
                                    endObject();
                            }
                            json.endArray();

                            json.key( "rows" ).array();
                            for( Row rowValue : tableValue.rows().get() )
                            {
                                json.object();
                                json.key( "c" ).array();
                                int idx = 0;
                                for( Cell cellValue : rowValue.c().get() )
View Full Code Here

TOP

Related Classes of org.qi4j.library.rest.common.table.Table

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.