Package com.asakusafw.modelgen.model

Examples of com.asakusafw.modelgen.model.ModelProperty


        List<ModelProperty> properties = new ArrayList<ModelProperty>();
        for (String mapTo : columns) {
            SourcePair sources = pairs.get(mapTo);
            assert sources != null;
            assert sources.left != null || sources.right != null;
            ModelProperty property = new ModelProperty(
                    mapTo,
                    sources.left,
                    sources.right);
            properties.add(property);
        }
View Full Code Here


                        "プロパティ \"{0}.{1}\" は集約関数かグループ化のキーとして指定する必要があります ({2})",
                        source.getDeclaring(),
                        source.getName(),
                        getReference()));
            }
            ModelProperty property = toProperty(column);
            properties.add(property);
        }
        validate();
        return new SummarizedModelDescription(
                getReference(),
View Full Code Here

                column.aggregator,
                column.source.getDeclaring(),
                column.source.getName(),
                column.source.getType(),
                Collections.<Attribute>emptySet());
        return new ModelProperty(column.name, source);
    }
View Full Code Here

                    "プロパティが追加されていません ({0})",
                    getReference()));
        }
        List<ModelProperty> properties = new ArrayList<ModelProperty>();
        for (Column column : columns) {
            ModelProperty property = toProperty(column);
            properties.add(property);
        }
        return new TableModelDescription(getReference(), properties);
    }
View Full Code Here

                Aggregator.IDENT,
                getReference(),
                column.name,
                column.type,
                column.attributes);
        return new ModelProperty(column.name, source);
    }
View Full Code Here

        assertThat(desc.getReference().getSimpleName(), is("Example"));

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

        ModelProperty value = properties.get(0);
        assertThat(value.getName(), is("value"));
        assertThat(value.getType().getKind(), is(PropertyTypeKind.INT));
        assertThat(value.getJoined(), is(nullValue()));

        Source valueSrc = value.getFrom();
        assertThat(valueSrc.getAggregator(), is(Aggregator.IDENT));
        assertThat(valueSrc.getDeclaring(), is(desc.getReference()));
        assertThat(valueSrc.getName(), is("value"));
        assertThat(valueSrc.getType().getKind(), is(PropertyTypeKind.INT));
        assertThat(valueSrc.getAttributes().size(), is(0));
View Full Code Here

        assertThat(desc.getReference().getSimpleName(), is("Example"));

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

        ModelProperty a = properties.get(0);
        assertThat(a.getName(), is("a"));
        assertThat(a.getType().getKind(), is(PropertyTypeKind.INT));

        ModelProperty b = properties.get(1);
        assertThat(b.getName(), is("b"));
        assertThat(b.getType().getKind(), is(PropertyTypeKind.STRING));

        ModelProperty c = properties.get(2);
        assertThat(c.getName(), is("c"));
        assertThat(c.getType().getKind(), is(PropertyTypeKind.DATETIME));
    }
View Full Code Here

        assertThat(desc.getReference().getSimpleName(), is("Attribute"));

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

        ModelProperty a = properties.get(0);
        assertThat(a.getName(), is("id"));
        assertThat(a.getType().getKind(), is(PropertyTypeKind.LONG));
        Set<Attribute> aAttr = a.getFrom().getAttributes();
        assertThat(aAttr.size(), is(1));
        assertThat(aAttr.contains(Attribute.PRIMARY_KEY), is(true));

        ModelProperty b = properties.get(1);
        assertThat(b.getName(), is("str"));
        assertThat(b.getType().getKind(), is(PropertyTypeKind.STRING));
        Set<Attribute> bAttr = b.getFrom().getAttributes();
        assertThat(bAttr.size(), is(2));
        assertThat(bAttr.containsAll(list(Attribute.UNIQUE, Attribute.NOT_NULL)), is(true));
    }
View Full Code Here

        assertThat(desc.getJoinCondition(), is(sources(b, "id")));

        List<ModelProperty> props = desc.getProperties();
        assertThat(props.size(), is(3));

        ModelProperty id = props.get(0);
        assertThat(id.getName(), is("id"));
        assertThat(id.getType().getKind(), is(PropertyTypeKind.LONG));
        assertThat(id.getFrom(), is(source(a, "id")));
        assertThat(id.getJoined(), is(source(b, "id")));


        ModelProperty hoge = props.get(1);
        assertThat(hoge.getName(), is("hoge"));
        assertThat(hoge.getType().getKind(), is(PropertyTypeKind.STRING));
        assertThat(hoge.getFrom(), is(source(a, "hoge")));
        assertThat(hoge.getJoined(), is(nullValue()));


        ModelProperty bar = props.get(2);
        assertThat(bar.getName(), is("bar"));
        assertThat(bar.getType().getKind(), is(PropertyTypeKind.STRING));
        assertThat(bar.getFrom(), is(nullValue()));
        assertThat(bar.getJoined(), is(source(b, "foo")));
    }
View Full Code Here

        assertThat(desc.getJoinCondition(), is(sources(b, "id")));

        List<ModelProperty> props = desc.getProperties();
        assertThat(props.size(), is(2));

        ModelProperty id = props.get(0);
        assertThat(id.getName(), is("id"));
        assertThat(id.getType().getKind(), is(PropertyTypeKind.LONG));
        assertThat(id.getFrom(), is(source(a, "id")));
        assertThat(id.getJoined(), is(source(b, "id")));

        ModelProperty hoge = props.get(1);
        assertThat(hoge.getName(), is("hoge"));
        assertThat(hoge.getType().getKind(), is(PropertyTypeKind.STRING));
        assertThat(hoge.getFrom(), is(source(a, "hoge")));
        assertThat(hoge.getJoined(), is(source(b, "hoge")));
    }
View Full Code Here

TOP

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

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.