Package com.asakusafw.modelgen.model

Examples of com.asakusafw.modelgen.model.SummarizedModelDescription


            }
            ModelProperty property = toProperty(column);
            properties.add(property);
        }
        validate();
        return new SummarizedModelDescription(
                getReference(),
                properties,
                groupProperties);
    }
View Full Code Here


        TableModelDescription a = new TableModelBuilder("A")
            .add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "word", new StringType(255))
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("S", a, "a")
            .add("word", Aggregator.IDENT, "a.word")
            .add("count", Aggregator.COUNT, "a.word")
            .groupBy("a.word")
            .toDescription();
View Full Code Here

        TableModelDescription a = new TableModelBuilder("A")
            .add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "value", PropertyTypeKind.INT)
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("S", a, "a")
            .add("sumId", Aggregator.IDENT, "a.id")
            .add("sumSum", Aggregator.SUM, "a.value")
            .add("sumCount", Aggregator.COUNT, "a.value")
            .add("sumMax", Aggregator.MAX, "a.value")
            .add("sumMin", Aggregator.MIN, "a.value")
View Full Code Here

        TableModelDescription a = new TableModelBuilder("A__a")
            .add(null, "id__a", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "word__a", new StringType(255))
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("_S__a", a, "a")
            .add("_word__a", Aggregator.IDENT, "a.word__a")
            .add("_count__a", Aggregator.COUNT, "a.word__a")
            .groupBy("a.word__a")
            .toDescription();
View Full Code Here

    public void simple() {
        TableModelDescription desc = new TableModelBuilder("A")
            .add(null, "word", new StringType(255))
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("S", desc, "a")
            .add("word", Aggregator.IDENT, "a.word")
            .add("count", Aggregator.COUNT, "a.word")
            .groupBy("a.word")
            .toDescription();

        assertThat(model.getReference().getSimpleName(), is("S"));
        assertThat(model.getGroupBy(), is(sources(desc, "word")));

        List<ModelProperty> properties = model.getProperties();
        assertThat(properties.size(), is(2));

        ModelProperty word = properties.get(0);
        assertThat(word.getName(), is("word"));
        assertThat(word.getType().getKind(), is(PropertyTypeKind.STRING));
View Full Code Here

    public void singleGroup() {
        TableModelDescription desc = new TableModelBuilder("A")
            .add(null, "word", new StringType(255))
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("S", desc, "a")
            .add("count", Aggregator.COUNT, "a.word")
            .toDescription();

        assertThat(model.getReference().getSimpleName(), is("S"));
        assertThat(model.getGroupBy(), is(sources(desc)));

        List<ModelProperty> properties = model.getProperties();
        assertThat(properties.size(), is(1));

        ModelProperty count = properties.get(0);
        assertThat(count.getName(), is("count"));
        assertThat(count.getType().getKind(), is(PropertyTypeKind.LONG));
View Full Code Here

            .add(null, "sex", PropertyTypeKind.BYTE)
            .add(null, "age", PropertyTypeKind.SHORT)
            .add(null, "name", new StringType(255))
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("S", desc, "a")
            .add("sex", Aggregator.IDENT, "sex")
            .add("age", Aggregator.IDENT, "age")
            .add("count", Aggregator.COUNT, "name")
            .groupBy("sex", "age")
            .toDescription();

        assertThat(model.getReference().getSimpleName(), is("S"));
        assertThat(model.getGroupBy(), is(sources(desc, "sex", "age")));

        List<ModelProperty> properties = model.getProperties();
        assertThat(properties.size(), is(3));

        ModelProperty sex = properties.get(0);
        assertThat(sex.getName(), is("sex"));
        assertThat(sex.getType().getKind(), is(PropertyTypeKind.BYTE));
View Full Code Here

TOP

Related Classes of com.asakusafw.modelgen.model.SummarizedModelDescription

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.