Package org.apache.metamodel.data

Examples of org.apache.metamodel.data.InMemoryDataSet


                                logger.debug("DataContext did not return any count query results. Proceeding with manual counting.");
                            } else {
                                List<Row> data = new ArrayList<Row>(1);
                                final DataSetHeader header = new SimpleDataSetHeader(new SelectItem[] { selectItem });
                                data.add(new DefaultRow(header, new Object[] { count }));
                                return new InMemoryDataSet(header, data);
                            }
                        }
                    }
                }

                // check for lookup query by primary key
                if (whereItems.size() == 1) {
                    final FilterItem whereItem = whereItems.get(0);
                    final SelectItem selectItem = whereItem.getSelectItem();
                    if (!whereItem.isCompoundFilter() && selectItem != null && selectItem.getColumn() != null) {
                        final Column column = selectItem.getColumn();
                        if (column.isPrimaryKey() && whereItem.getOperator() == OperatorType.EQUALS_TO) {
                            logger.debug("Query is a primary key lookup query. Trying executePrimaryKeyLookupQuery(...)");
                            if (table != null) {
                                if (isMainSchemaTable(table)) {
                                    final Object operand = whereItem.getOperand();
                                    final Row row = executePrimaryKeyLookupQuery(table, selectItems, column, operand);
                                    if (row == null) {
                                        logger.debug("DataContext did not return any GET query results. Proceeding with manual lookup.");
                                    } else {
                                        final DataSetHeader header = new SimpleDataSetHeader(selectItems);
                                        return new InMemoryDataSet(header, row);
                                    }
                                }
                            }
                        }
                    }
View Full Code Here


        DataSet dataSet;
        if (data.isEmpty()) {
            dataSet = new EmptyDataSet(selectItems);
        } else {
            dataSet = new InMemoryDataSet(header, data);
        }

        // Handle column subset
        DataSet selectionDataSet = MetaModelHelper.getSelection(selectItems, dataSet);
        dataSet = selectionDataSet;
View Full Code Here

        final List<Row> rows = new ArrayList<Row>(data.size());
        for (Object[] objects : data) {
            rows.add(new DefaultRow(header, objects, null));
        }

        DataSet result = new InMemoryDataSet(header, rows);
        if (whereItems != null) {
            DataSet filteredResult = getFiltered(result, whereItems);
            result = filteredResult;
        }
        return result;
View Full Code Here

            }

            if (resultData.isEmpty()) {
                result = new EmptyDataSet(selectItems);
            } else {
                result = new InMemoryDataSet(resultHeader, resultData);
            }
        }
        result = getSelection(selectItems, result);
        return result;
    }
View Full Code Here

                }
                resultRows.set(i, new DefaultRow(header, values));
            }
        }

        return new InMemoryDataSet(header, resultRows);
    }
View Full Code Here

                }
            };

            Collections.sort(data, comparator);

            dataSet = new InMemoryDataSet(data);
        }
        return dataSet;
    }
View Full Code Here

            Row ds1row = ds1.getRow();
            List<Row> ds1rows = new ArrayList<Row>();
            ds1rows.add(ds1row);

            DataSet carthesianProduct = getCarthesianProduct(new DataSet[] {
                    new InMemoryDataSet(new CachingDataSetHeader(si1), ds1rows),
                    new InMemoryDataSet(new CachingDataSetHeader(si2), ds2data) }, onConditions);
            List<Row> carthesianRows = readDataSetFull(carthesianProduct);
            if (carthesianRows.size() > 0) {
                resultRows.addAll(carthesianRows);
            } else {
                Object[] values = ds1row.getValues();
                Object[] row = new Object[selectItems.length];
                System.arraycopy(values, 0, row, 0, values.length);
                resultRows.add(new DefaultRow(header, row));
            }
        }
        ds1.close();

        if (resultRows.isEmpty()) {
            return new EmptyDataSet(selectItems);
        }

        return new InMemoryDataSet(header, resultRows);
    }
View Full Code Here

                                final Row row = executePrimaryKeyLookupQuery(table, selectItems, column, operand);
                                if (row == null) {
                                    logger.debug("DataContext did not return any primary key lookup query results. Proceeding with manual lookup.");
                                } else {
                                    final DataSetHeader header = new SimpleDataSetHeader(selectItems);
                                    return new InMemoryDataSet(header, row);
                                }
                            }
                        }
                    }
View Full Code Here

                rows.add(new DefaultRow(header, new Object[] { "admin", "admin", 3 }));
                rows.add(new DefaultRow(header, new Object[] { "elikeon", "user", 4 }));
                rows.add(new DefaultRow(header, new Object[] { "someuser", "user", 5 }));
                rows.add(new DefaultRow(header, new Object[] { "hmm", "what-the", 6 }));

                return new InMemoryDataSet(header, rows);
            }

            @Override
            protected String getMainSchemaName() throws MetaModelException {
                return "s";
View Full Code Here

            data.add(new DefaultRow(header, new Object[] { "1", "hello", "world" }, null));
            data.add(new DefaultRow(header, new Object[] { "2", _value, "world" }, null));
            data.add(new DefaultRow(header, new Object[] { "3", "hi", _value }, null));
            data.add(new DefaultRow(header, new Object[] { "4", "yo", "world" }, null));

            final DataSet sourceDataSet = new InMemoryDataSet(header, data);

            final SelectItem[] columnSelectItems = MetaModelHelper.createSelectItems(columns);
            final DataSet selectionDataSet = MetaModelHelper.getSelection(columnSelectItems, sourceDataSet);
            return selectionDataSet;
        } else if ("an_empty_table".equals(table.getName())) {
View Full Code Here

TOP

Related Classes of org.apache.metamodel.data.InMemoryDataSet

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.