Package com.asakusafw.modelgen.view.model

Examples of com.asakusafw.modelgen.view.model.CreateView


            throw new IllegalArgumentException("reader must not be null"); //$NON-NLS-1$
        }
        StringReader stream = new StringReader(definition.statement);
        JjViewParser parser = new JjViewParser(stream);
        try {
            CreateView parsed = parser.parse(definition.name);
            return parsed;
        } catch (TokenMgrError e) {
            throw new IOException(MessageFormat.format(
                    "ビュー{0}の解析に失敗しました ({1})",
                    definition.name,
View Full Code Here


            Map<Name, ModelDescription> context) {
        assert target != null;
        assert repository != null;
        assert context != null;

        CreateView ast = target.ast;

        // 先に外部依存関係を解決してcontextに登録する
        if (resolveDependency(ast, repository, context) == false) {
            return null;
        }

        Kind kind = ast.getKind();
        if (kind == Kind.JOINED) {
            return transformJoined(target, context);
        } else if (kind == Kind.SUMMARIZED) {
            return transformSummarized(target, context);
        } else {
View Full Code Here

            View target,
            Map<Name, ModelDescription> context) {
        assert target != null;
        assert target.ast.getKind() == CreateView.Kind.JOINED;
        assert context != null;
        CreateView ast = target.ast;
        assert context.get(ast.from.table) != null;
        assert context.get(ast.from.join.table) != null;

        JoinedModelBuilder builder = new JoinedModelBuilder(
                ast.name.token,
View Full Code Here

            View target,
            Map<Name, ModelDescription> context) {
        assert target != null;
        assert target.ast.getKind() == CreateView.Kind.SUMMARIZED;

        CreateView ast = target.ast;
        assert context.get(ast.from.table) != null;

        SummarizedModelBuilder builder = new SummarizedModelBuilder(
                ast.name.token,
                context.get(ast.from.table),
View Full Code Here

        LOG.info("{}個のビュー定義を読み込みました", definitions.size());

        ViewAnalyzer analyzer = new ViewAnalyzer();
        for (ViewDefinition definition : definitions) {
            LOG.info("ビュー\"{}\"を解析しています", definition.name);
            CreateView tree = ViewParser.parse(definition);
            analyzer.add(Collections.singletonList(Constants.SOURCE_VIEW), tree);
        }

        List<ModelDescription> results = analyzer.analyze(repository);
        return results;
View Full Code Here

                "from `test`.`t1`" +
                "join `test`.`t2`" +
                "where" +
                "  (`test`.`t1`.`pk` = `test`.`t2`.`pk`)");

        CreateView model = ViewParser.parse(def);
        assertThat(model, is(new CreateView(
                n("test"),
                Arrays.asList(new Select[] {
                        new Select(n("t1.pk"), Aggregator.IDENT, n("pk")),
                        new Select(n("t1.val1"), Aggregator.IDENT, n("val1")),
                        new Select(n("t2.val2"), Aggregator.IDENT, n("val2")),
View Full Code Here

                "from `test`.`t1` `a`" +
                "join `test`.`t2` `b`" +
                "where" +
                "  (`test`.`a`.`pk` = `test`.`b`.`pk`)");

        CreateView model = ViewParser.parse(def);
        assertThat(model, is(new CreateView(
                n("test"),
                Arrays.asList(new Select[] {
                        new Select(n("a.pk"), Aggregator.IDENT, n("pk")),
                        new Select(n("a.val1"), Aggregator.IDENT, n("val1")),
                        new Select(n("b.val2"), Aggregator.IDENT, n("val2")),
View Full Code Here

                "from" +
                "  `test`.`t1`" +
                "group by" +
                "  `test`.`t1`.`pk`");

        CreateView model = ViewParser.parse(def);
        assertThat(model, is(new CreateView(
                n("test"),
                Arrays.asList(new Select[] {
                        new Select(n("t1.pk"), Aggregator.IDENT, n("pk")),
                        new Select(n("t1.pk"), Aggregator.COUNT, n("count")),
                        new Select(n("t1.pk"), Aggregator.MAX, n("max")),
View Full Code Here

                "from" +
                "  `test`.`x` `t1`" +
                "group by" +
                "  `test`.`t1`.`pk`");

        CreateView model = ViewParser.parse(def);
        assertThat(model, is(new CreateView(
                n("test"),
                Arrays.asList(new Select[] {
                        new Select(n("t1.pk"), Aggregator.IDENT, n("pk")),
                        new Select(n("t1.pk"), Aggregator.COUNT, n("count")),
                        new Select(n("t1.pk"), Aggregator.MAX, n("max")),
View Full Code Here

                "from" +
                "  `test`.`t1`" +
                "group by" +
                "  `test`.`t1`.`val1` , `test`.`t1`.`val2`");

        CreateView model = ViewParser.parse(def);
        assertThat(model, is(new CreateView(
                n("test"),
                Arrays.asList(new Select[] {
                        new Select(n("t1.pk"), Aggregator.IDENT, n("pk")),
                        new Select(n("t1.pk"), Aggregator.COUNT, n("count")),
                        new Select(n("t1.pk"), Aggregator.MAX, n("max")),
View Full Code Here

TOP

Related Classes of com.asakusafw.modelgen.view.model.CreateView

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.