Package com.asakusafw.vocabulary.model

Examples of com.asakusafw.vocabulary.model.Joined


public class SplitFlowProcessor extends LineEndProcessor {

    @Override
    public void emitLineEnd(Context context) {
        FlowElementPortDescription inputPort = context.getInputPort(Split.ID_INPUT);
        Joined joined = TypeUtil.erase(inputPort.getDataType()).getAnnotation(Joined.class);
        assert joined != null;
        Map<Class<?>, Term> terms = Maps.create();
        for (Term term : joined.terms()) {
            terms.put(term.source(), term);
        }
        for (FlowElementPortDescription output : context.getOperatorDescription().getOutputPorts()) {
            Term term = terms.get(output.getDataType());
            assert term != null;
View Full Code Here


        DataObjectMirror resultCache = context.createModelCache(joinedPort.getDataType());
        DataClass outputType = getEnvironment().getDataClasses().load(joinedPort.getDataType());
        List<Statement> process = Lists.create();
        process.add(resultCache.createReset());
        Joined annotation = TypeUtil.erase(joinedPort.getDataType()).getAnnotation(Joined.class);
        Set<String> saw = Sets.create();
        for (Joined.Term term : annotation.terms()) {
            DataClass inputType = getEnvironment().getDataClasses().load(term.source());
            Expression input;
            if (term.source().equals(context.getInputPort(SideDataJoin.ID_INPUT_TRANSACTION).getDataType())) {
                input = context.getInput();
            } else {
View Full Code Here

        DataObjectMirror resultCache = context.createModelCache(joinedPort.getDataType());
        DataClass outputType = getEnvironment().getDataClasses().load(joinedPort.getDataType());
        List<Statement> process = Lists.create();
        process.add(resultCache.createReset());

        Joined annotation = TypeUtil.erase(joinedPort.getDataType()).getAnnotation(Joined.class);
        Set<String> saw = Sets.create();
        for (Joined.Term term : annotation.terms()) {
            DataClass inputType = getEnvironment().getDataClasses().load(term.source());
            Expression input;
            if (term.source().equals(context.getInputPort(MasterJoin.ID_INPUT_MASTER).getDataType())) {
                input = masterAnalyzer.getGetRawMasterExpression();
            } else {
View Full Code Here

     * simple join.
     */
    @Test
    public void simple_join() {
        ModelLoader loader = generate();
        Joined annotation = loader.modelType("Simple").getAnnotation(Joined.class);
        assertThat(annotation, not(nullValue()));

        assertThat(annotation.terms().length, is(2));

        Joined.Term a = annotation.terms()[0];
        assertThat(a.source(), eq(loader.modelType("A")));
        assertThat(a.mappings().length, is(2));
        assertThat(a.mappings(), hasItemInArray(mapping("sid", "sid")));
        assertThat(a.mappings(), hasItemInArray(mapping("value", "aValue")));
        assertThat(a.shuffle(), is(grouping("sid")));

        Joined.Term b = annotation.terms()[1];
        assertThat(b.source(), eq(loader.modelType("B")));
        assertThat(b.mappings().length, is(2));
        assertThat(b.mappings(), hasItemInArray(mapping("sid", "sid")));
        assertThat(b.mappings(), hasItemInArray(mapping("value", "bValue")));
        assertThat(b.shuffle(), is(grouping("sid")));
View Full Code Here

     * join with renaming key.
     */
    @Test
    public void join_rename_key() {
        ModelLoader loader = generate();
        Joined annotation = loader.modelType("Simple").getAnnotation(Joined.class);
        assertThat(annotation, not(nullValue()));

        assertThat(annotation.terms().length, is(2));

        Joined.Term a = annotation.terms()[0];
        assertThat(a.source(), eq(loader.modelType("A")));
        assertThat(a.mappings().length, is(2));
        assertThat(a.mappings(), hasItemInArray(mapping("sid", "key")));
        assertThat(a.mappings(), hasItemInArray(mapping("value", "aValue")));
        assertThat(a.shuffle(), is(grouping("sid")));

        Joined.Term b = annotation.terms()[1];
        assertThat(b.source(), eq(loader.modelType("B")));
        assertThat(b.mappings().length, is(2));
        assertThat(b.mappings(), hasItemInArray(mapping("sid", "key")));
        assertThat(b.mappings(), hasItemInArray(mapping("value", "bValue")));
        assertThat(b.shuffle(), is(grouping("sid")));
View Full Code Here

     * simple record.
     */
    @Test
    public void simple_record() {
        ModelLoader loader = generate();
        Joined annotation = loader.modelType("Simple").getAnnotation(Joined.class);
        assertThat(annotation, nullValue());
    }
View Full Code Here

        object.set("left", new Text("Hello, left!"));
        assertThat(object.get("left"), eq(new Text("Hello, left!")));
        object.set("right", new Text("Hello, right!"));
        assertThat(object.get("right"), eq(new Text("Hello, right!")));

        Joined annotation = object.unwrap().getClass().getAnnotation(Joined.class);
        assertThat(annotation, not(nullValue()));

        assertThat(annotation.terms().length, is(2));

        loader.setNamespace(Constants.SOURCE_TABLE);
        Joined.Term a = annotation.terms()[0];
        assertThat(a.source(), eq(loader.modelType("Left")));
        assertThat(a.mappings().length, is(2));
        assertThat(a.mappings(), hasItemInArray(mapping("rightId", "id")));
        assertThat(a.mappings(), hasItemInArray(mapping("value", "left")));
        assertThat(a.shuffle(), is(grouping("rightId")));

        Joined.Term b = annotation.terms()[1];
        assertThat(b.source(), eq(loader.modelType("Right")));
        assertThat(b.mappings().length, is(2));
        assertThat(b.mappings(), hasItemInArray(mapping("sid", "id")));
        assertThat(b.mappings(), hasItemInArray(mapping("value", "right")));
        assertThat(b.shuffle(), is(grouping("sid")));
View Full Code Here

TOP

Related Classes of com.asakusafw.vocabulary.model.Joined

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.