Package org.zanata.rest.dto.resource

Examples of org.zanata.rest.dto.resource.TextFlowTarget


    private final Logger log = LoggerFactory
            .getLogger(TranslationsResourceTestObjectFactory.class);

    public TranslationsResource getTestObject() {
        TranslationsResource entity = new TranslationsResource();
        TextFlowTarget target = new TextFlowTarget("rest1");
        target.setContents("hello world");
        target.setState(ContentState.Approved);
        target.setTranslator(new Person("root@localhost", "Administrator"));
        // for the convenience of test
        target.getExtensions(true);
        entity.getTextFlowTargets().add(target);
        entity.getExtensions(true);
        return entity;
    }
View Full Code Here


        return entity;
    }

    public TranslationsResource getTestObject2() {
        TranslationsResource entity = new TranslationsResource();
        TextFlowTarget target = new TextFlowTarget("rest1");
        target.setContents("hello world");
        target.setState(ContentState.Approved);
        target.setTranslator(new Person("root@localhost", "Administrator"));
        target.getExtensions(true);
        TextFlowTarget target2 = new TextFlowTarget("rest2");
        target2.setContents("greeting world");
        target2.setState(ContentState.Approved);
        target2.setTranslator(new Person("root@localhost", "Administrator"));
        target2.getExtensions(true);
        entity.getTextFlowTargets().add(target2);
        entity.getExtensions(true);
        log.debug(entity.toString());
        return entity;
    }
View Full Code Here

        return entity;
    }

    public TranslationsResource getTextFlowTargetCommentTest() {
        TranslationsResource sr = getTestObject();
        TextFlowTarget stf = sr.getTextFlowTargets().get(0);

        SimpleComment simpleComment =
                new SimpleComment("textflowtarget comment");

        stf.getExtensions(true).add(simpleComment);
        return sr;
    }
View Full Code Here

        return sr;
    }

    public TranslationsResource getAllExtension() {
        TranslationsResource sr = getPoTargetHeaderTextFlowTargetTest();
        TextFlowTarget stf = sr.getTextFlowTargets().get(0);

        SimpleComment simpleComment =
                new SimpleComment("textflowtarget comment");

        stf.getExtensions(true).add(simpleComment);
        return sr;
    }
View Full Code Here

        return targetCount;
    }

    private static void addSampleTranslation(TranslationsResource translations,
            String resId) {
        TextFlowTarget target = new TextFlowTarget(resId);
        target.setRevision(1);
        target.setState(ContentState.Translated);
        target.setContents("translated " + resId);
        translations.getTextFlowTargets().add(target);
    }
View Full Code Here

        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        expectDocs(true, false, doc1);
        tft1.setRevision(1);
        expectTarget1(target1);
        deleteDoc1(); // doc1 becomes obsolete
        getZero();
        dontExpectTarget1();
        putDoc1(false); // doc1 resurrected, rev 1
        doc1.setRevision(1);
        tf1.setRevision(1);
        tft1.setTextFlowRevision(1);
        expectDocs(true, false, doc1);
        expectTarget1(target1);
    }
View Full Code Here

        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        tft1.setRevision(1);
        expectDocs(true, false, doc1);
        expectTarget1(target1);
        putDoc1(false); // docRev still 1
        doc1.setRevision(1);
        tf1.setRevision(1);
        tft1.setTextFlowRevision(1);
        expectDocs(true, false, doc1);
        expectTarget1(target1);
    }
View Full Code Here

        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        expectDocs(true, false, doc1);
        tft1.setRevision(1);
        expectTarget1(target1);
        deleteDoc1(); // doc1 becomes obsolete
        getZero();
        dontExpectTarget1();
        Resource doc1a = putDoc1a(false); // doc1 resurrected, rev 2
        doc1a.setRevision(2);
        TextFlow tf1a = doc1a.getTextFlows().get(0);
        tf1a.setRevision(doc1a.getRevision());
        TranslationsResource target1a = putTarget1a();
        TextFlowTarget tft1a = target1a.getTextFlowTargets().get(0);
        tft1a.setTextFlowRevision(tf1a.getRevision());
        tft1a.setRevision(1);
        expectDocs(true, false, doc1a);
        dontExpectTarget1();
        expectTarget1a(target1a);
    }
View Full Code Here

        Resource doc1 = putDoc1(false);
        doc1.setRevision(1);
        TextFlow tf1 = doc1.getTextFlows().get(0);
        tf1.setRevision(1);
        TranslationsResource target1 = putTarget1();
        TextFlowTarget tft1 = target1.getTextFlowTargets().get(0);
        tft1.setTextFlowRevision(1);
        tft1.setRevision(1);
        expectDocs(true, false, doc1);
        expectTarget1(target1);
        // this should completely replace doc1's textflow FOOD with HELLO
        Resource doc1a = putDoc1a(false);
        doc1a.setRevision(2);
        TextFlow tf1a = doc1a.getTextFlows().get(0);
        tf1a.setRevision(2);
        TranslationsResource target1a = putTarget1a();
        TextFlowTarget tft1a = target1a.getTextFlowTargets().get(0);
        tft1a.setTextFlowRevision(2);
        tft1a.setRevision(1);
        expectDocs(true, false, doc1a);
        dontExpectTarget1();
        expectTarget1a(target1a);
        // use dao to check that the HTextFlow FOOD (from doc1) is marked
        // obsolete
View Full Code Here

        // Push a document and its translations
        createResourceWithContentUsingPut();

        TranslationsResource entity = new TranslationsResource();
        TextFlowTarget target = new TextFlowTarget();
        target.setResId("tf1");
        target.setContents("hello world");
        target.setState(ContentState.Approved);
        target.setTranslator(new Person("root@localhost", "Admin user"));
        entity.getTextFlowTargets().add(target);

        // Future Date for the PO Revision Date Header
        Calendar poRevDate = Calendar.getInstance();
        poRevDate.add(Calendar.YEAR, 1); // 1 year in the future
View Full Code Here

TOP

Related Classes of org.zanata.rest.dto.resource.TextFlowTarget

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.