Package com.asakusafw.dmdl.thundergate.model

Examples of com.asakusafw.dmdl.thundergate.model.Source


        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


    }

    private Source source(ModelDescription model, String name, Aggregator aggr) {
        for (Source s : model.getPropertiesAsSources()) {
            if (name.equals(s.getName())) {
                return new Source(
                        aggr,
                        s.getDeclaring(),
                        s.getName(),
                        s.getType(),
                        s.getAttributes());
View Full Code Here

    private AstJoin generateTerm(ModelReference sourceModel, List<Source> group, boolean from) {
        Map<String, ModelProperty> resolver = Maps.create();
        List<AstPropertyMapping> mappings = Lists.create();
        for (ModelProperty property : model.getProperties()) {
            Source source = from ? property.getFrom() : property.getJoined();
            if (source == null) {
                continue;
            }
            resolver.put(source.getName(), property);
            mappings.add(new AstPropertyMapping(
                    null,
                    AstBuilder.getDesciption("{0}.{1}",
                            sourceModel.getSimpleName(),
                            source.getName()),
                    Arrays.asList(new AstAttribute[] {
                            AstBuilder.getOriginalName(property.getName()),
                    }),
                    AstBuilder.toName(source),
                    AstBuilder.toName(property)));
        }

        List<AstSimpleName> grouping = Lists.create();
        for (Source source : group) {
            ModelProperty property = resolver.get(source.getName());
            assert property != null : source;
            grouping.add(AstBuilder.toName(property));
        }

        return new AstJoin(
View Full Code Here

    private void pairingTrivialSource(Side a, Side b) {
        assert a != null;
        assert b != null;
        // 結合条件になったフィールドが結果に含まれる場合、それもソースとして登録する
        for (int i = 0, n = a.condition.size(); i < n; i++) {
            Source as = a.condition.get(i);
            Source bs = b.condition.get(i);
            if (a.mapping.get(as.getName()) != null && b.mapping.get(bs.getName()) == null) {
                String column = a.mapping.get(as.getName());
                b.mapping.put(bs.getName(), column);
            }
        }
    }
View Full Code Here

            String mapTo = entry.getValue();
            assert mapTo == null || pairs.containsKey(mapTo);
            if (mapTo == null) {
                continue;
            }
            Source source = left.sources.get(entry.getKey());
            pairs.get(mapTo).left = source;
        }

        // 右の情報をペアのコンテナに格納
        for (Map.Entry<String, String> entry : right.mapping.entrySet()) {
            String mapTo = entry.getValue();
            assert mapTo == null || pairs.containsKey(mapTo);
            if (mapTo == null) {
                continue;
            }
            Source source = right.sources.get(entry.getKey());
            pairs.get(mapTo).right = source;
        }

        // ペアの情報を元にプロパティを構築
        List<ModelProperty> properties = Lists.create();
View Full Code Here

                        sourceProperty,
                        getReference()));
            }
            simpleName = sourceProperty.substring(qualified + 1);
        }
        Source source = sources.get(simpleName);
        if (source == null) {
            throw new IllegalArgumentException(MessageFormat.format(
                    "\"{0}\" が見つかりません ({1})",
                    simpleName,
                    getReference()));
View Full Code Here

            throw new IllegalArgumentException("aggregator must not be null"); //$NON-NLS-1$
        }
        if (sourceProperty == null) {
            throw new IllegalArgumentException("sourceProperty must not be null"); //$NON-NLS-1$
        }
        Source source = find(sourceProperty);
        Column column = new Column(columnName, aggregator, source);
        columns.add(column);
        return this;
    }
View Full Code Here

                    getReference()));
        }
        List<ModelProperty> properties = Lists.create();
        for (Column column : columns) {
            Aggregator aggregator = column.aggregator;
            Source source = column.source;
            if (aggregator == Aggregator.IDENT
                    && groupProperties.contains(source) == false) {
                throw new IllegalStateException(MessageFormat.format(
                        "プロパティ \"{0}.{1}\" は集約関数かグループ化のキーとして指定する必要があります ({2})",
                        source.getDeclaring(),
                        source.getName(),
                        getReference()));
            }
            ModelProperty property = toProperty(column);
            properties.add(property);
        }
View Full Code Here

        }
    }

    private ModelProperty toProperty(Column column) {
        assert column != null;
        Source source = new Source(
                column.aggregator,
                column.source.getDeclaring(),
                column.source.getName(),
                column.source.getType(),
                Collections.<Attribute>emptySet());
View Full Code Here

        return new TableModelDescription(getReference(), properties);
    }

    private ModelProperty toProperty(Column column) {
        assert column != null;
        Source source = new Source(
                Aggregator.IDENT,
                getReference(),
                column.name,
                column.type,
                column.attributes);
View Full Code Here

TOP

Related Classes of com.asakusafw.dmdl.thundergate.model.Source

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.