Package org.zanata.model

Examples of org.zanata.model.HTextFlowBuilder


        LocaleDAO localeDAO = new LocaleDAO(getSession());
        List<HLocale> localeList = localeDAO.findAll();

        for (int i = 0; i < tfSize; i++) {
            HTextFlow tf =
                    new HTextFlowBuilder().withDocument(doc).withResId(
                            "testResId:" + i)
                            .withSourceContent("source content").build();

            if (insertTargets) {
                for (int x = 0; x < localeList.size(); x++) {
View Full Code Here


     * @return number of textflows that has target in it.
     */
    private static int createSourceAndSomeTargets(HDocument doc,
            HLocale transLocale,
            int numOfTextFlows) {
        HTextFlowBuilder baseBuilder =
                new HTextFlowBuilder().withDocument(doc)
                        .withTargetLocale(transLocale);
        int targetCount = 0;
        for (int i = 0; i < numOfTextFlows; i++) {
            HTextFlowBuilder builder = baseBuilder.withResId("res" + i)
                    .withSourceContent("hello world " + i);
            if (i % 2 == 0) {
                builder = builder.withTargetState(ContentState.NeedReview)
                        .withTargetContent("previous translation");
                targetCount++;
            }
            doc.getTextFlows().add(builder.build());
        }
        return targetCount;
    }
View Full Code Here

        // .assertThat(oldDoc.getProjectIteration().getProject().getId())
        // .isEqualTo(
        // copyTransTargetDoc.getProjectIteration().getProject()
        // .getId());

        HTextFlowBuilder textFlowBuilderForOldDoc =
                new HTextFlowBuilder().withDocument(oldDoc)
                        .withTargetLocale(enUS);

        // make many text flows all with translations in DE
        numOfTextFlows = 5000;
        for (int i = 0; i < numOfTextFlows; i++) {
            textFlowBuilderForOldDoc.withResId("res" + i)
                    .withSourceContent("source " + i)
                    .withTargetContent("target " + i)
                    .withTargetLocale(de)
                    .withTargetState(ContentState.Translated).build();
        }

        HTextFlowBuilder textFlowBuilderForNewDoc =
                new HTextFlowBuilder().withDocument(copyTransTargetDoc)
                        .withTargetLocale(enUS);
        for (int i = 0; i < numOfTextFlows; i++) {
            textFlowBuilderForNewDoc.withResId("res" + i)
                    .withSourceContent("source " + i).build();
        }
        getEm().flush();
        getEm().clear();
View Full Code Here

                                FixedValueMaker.EMPTY_STRING_MAKER)
                        .reuseEntity(hLocale).build()
                        .makeAndPersist(getEm(), HDocument.class);
        documentId = new DocumentId(hDocument.getId(), hDocument.getDocId());

        HTextFlowBuilder baseBuilder =
                new HTextFlowBuilder().withDocument(hDocument)
                        .withTargetLocale(hLocale);
        HTextFlowBuilder adminModifiedToday =
                baseBuilder.withLastModifiedDate(today).withLastModifiedBy(
                        admin);
        // make 10 text flows and some text flow targets
        // 1. null target
        baseBuilder.withResId("res1").withSourceContent("source 1").build();
        // target translated by admin on today
        // 2. translated target
        adminModifiedToday.withResId("res2").withSourceContent("source 2")
                .withTargetContent("target 2")
                .withTargetState(ContentState.Translated).build();

        // 3. fuzzy target
        adminModifiedToday.withResId("res3").withSourceContent("source 3")
                .withTargetContent("target 3")
                .withTargetState(ContentState.NeedReview).build();

        // 4. untranslated target but is not null
        adminModifiedToday.withResId("res4").withSourceContent("source 4")
                .withTargetContent("").withTargetState(ContentState.New)
                .build();

        // 5. target with comment
        adminModifiedToday.withResId("res5").withSourceContent("source 5")
                .withTargetContent("target 5")
                .withTargetState(ContentState.Translated)
                .withTargetComment("target comment").build();

        // 6. source with msgContext
        adminModifiedToday.withResId("res6").withSourceContent("source 6")
                .withMsgContext(",gettext ,fuzzy").build();

        // 7. source with comment
        adminModifiedToday.withResId("res7").withSourceContent("source 7")
                .withSourceComment("source comment").build();

        // 8. target translated by admin on yesterday
        baseBuilder.withLastModifiedDate(yesterday).withLastModifiedBy(admin)
                .withResId("res8").withSourceContent("source 8")
View Full Code Here

TOP

Related Classes of org.zanata.model.HTextFlowBuilder

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.