Package org.zanata.common

Examples of org.zanata.common.TransUnitWords


                                + "group by tft.state")
                        .setParameter("id", docId)
                        .setParameter("locale", localeId).setCacheable(true)
                        .setComment("DocumentDAO.getStatistics-words").list();
        Long totalWordCount = getTotalWordCountForDocument(docId);
        TransUnitWords wordCount = new TransUnitWords();
        for (StatusCount count : wordStats) {
            wordCount.set(count.status, count.count.intValue());
        }
        long newWordCount =
                StatisticsUtil.calculateUntranslated(totalWordCount, wordCount);
        wordCount.set(ContentState.New, (int) newWordCount);

        ContainerTranslationStatistics result =
                new ContainerTranslationStatistics();
        result.addStats(new TranslationStatistics(unitCount, localeId
                .toString()));
View Full Code Here


            if (transUnitCount == null) {
                transUnitCount = new TransUnitCount();
                transUnitCountMap.put(localeId.getId(), transUnitCount);
            }

            TransUnitWords transUnitWords =
                    transUnitWordsMap.get(localeId.getId());
            if (transUnitWords == null) {
                transUnitWords = new TransUnitWords();
                transUnitWordsMap.put(localeId.getId(), transUnitWords);
            }

            transUnitCount.set(state, msgCount.intValue());
            transUnitWords.set(state, wordCount.intValue());
        }

        for (TransUnitCount stat : transUnitCountMap.values()) {
            stat.set(
                    ContentState.New,
View Full Code Here

    private void resetProjectStats() {
        projectStats.setStats(Lists.newArrayList(
                new TranslationStatistics(new TransUnitCount(0, 0, 0), localeId
                        .getId()),
                new TranslationStatistics(new TransUnitWords(0, 0, 0), localeId
                        .getId())));
    }
View Full Code Here

    public TransUnitWords getWordStatsForContainer(Long iterationId,
            LocaleId localeId) {

        List<StatusCount> stats = getWordStatusCount(iterationId, localeId);

        TransUnitWords stat = new TransUnitWords();

        for (StatusCount count : stats) {
            stat.set(count.status, count.count.intValue());
        }

        Long totalCount = getTotalWordCountForIteration(iterationId);

        stat.set(ContentState.New, totalCount.intValue()
                - (stat.getApproved() + stat.getNeedReview()));

        return stat;
    }
View Full Code Here

        Map<String, TransUnitWords> result =
                new HashMap<String, TransUnitWords>();

        for (Object[] count : stats) {
            TransUnitWords stat;
            ContentState state = (ContentState) count[0];
            Long word = (Long) count[1];
            LocaleId locale = (LocaleId) count[2];
            if (!result.containsKey(locale.getId())) {
                stat = new TransUnitWords();
                result.put(locale.getId(), stat);
            } else {
                stat = result.get(locale.getId());
            }

            stat.set(state, word.intValue());
        }

        Long totalCount = getTotalWordCountForIteration(iterationId);
        for (TransUnitWords count : result.values()) {
            count.set(ContentState.New,
View Full Code Here

                            target.getLastModifiedBy().getAccount()
                                    .getUsername();
                }
            }

            TransUnitWords wordCount = wordIterationStats.get(locId.getId());
            if (wordCount == null) {
                wordCount = new TransUnitWords(0, 0, (int) iterationTotalWords);
            }

            TranslationStatistics transUnitStats =
                    getMessageStats(count, locId, lastModifiedDate,
                            lastModifiedBy);
View Full Code Here

        TransUnitCount count = new TransUnitCount();
        count.set(ContentState.Approved, 34 * docID);
        count.set(ContentState.NeedReview, 23 * docID);
        count.set(ContentState.New, 43 * docID);

        TransUnitWords words = new TransUnitWords();
        words.set(ContentState.Approved, 70 * docID);
        words.set(ContentState.NeedReview, 40 * docID);
        words.set(ContentState.New, 90 * docID);

        TranslationStatistics msgStats =
                new TranslationStatistics(count, LocaleId.EN_US.toString());
        TranslationStatistics wordStats =
                new TranslationStatistics(words, LocaleId.EN_US.toString());
View Full Code Here

    public void beforeMethod() {
        selectedDocumentStats = new ContainerTranslationStatistics();
        selectedDocumentStats.addStats(new TranslationStatistics(
                new TransUnitCount(1, 2, 3), LocaleId.EN_US.getId()));
        selectedDocumentStats.addStats(new TranslationStatistics(
                new TransUnitWords(4, 5, 6), LocaleId.EN_US.getId()));

        projectStats = new ContainerTranslationStatistics();
        projectStats.addStats(new TranslationStatistics(new TransUnitCount(7,
                8, 9), LocaleId.EN_US.getId()));
        projectStats.addStats(new TranslationStatistics(new TransUnitWords(10,
                11, 12), LocaleId.EN_US.getId()));

        MockitoAnnotations.initMocks(this);
        presenter =
                new AppPresenter(display, eventBus, sideMenuPresenter,
View Full Code Here

        ContainerTranslationStatistics newSelectedStats =
                new ContainerTranslationStatistics();
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitCount(
                1, 2, 3), LocaleId.EN_US.toString()));
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitWords(
                4, 5, 6), LocaleId.EN_US.toString()));
        DocumentInfo documentInfo =
                new DocumentInfo(docId, "a.po", "pot/", new LocaleId("en-US"),
                        newSelectedStats, new AuditInfo(new Date(),
                                "Translator"), new HashMap<String, String>(),
View Full Code Here

        ContainerTranslationStatistics newSelectedStats =
                new ContainerTranslationStatistics();
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitCount(
                1, 2, 3), LocaleId.EN_US.toString()));
        newSelectedStats.addStats(new TranslationStatistics(new TransUnitWords(
                4, 5, 6), LocaleId.EN_US.toString()));

        DocumentInfo documentInfo =
                new DocumentInfo(docId, "a.po", "pot/", new LocaleId("en-US"),
                        newSelectedStats, new AuditInfo(new Date(),
View Full Code Here

TOP

Related Classes of org.zanata.common.TransUnitWords

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.