Package org.zanata.rest.dto.stats

Examples of org.zanata.rest.dto.stats.TranslationStatistics


        }
        return 0;
    }

    public int getUnitTranslated() {
        TranslationStatistics stats = getMessageStats();
        if (stats != null) {
            return (int) stats.getTranslatedOnly();
        }
        return 0;
    }
View Full Code Here


        display.setListener(this);
    }

    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

        for (DocumentNode documentNode : event.getDocumentNodes()) {
            ContainerTranslationStatistics statsContainer =
                    documentNode.getDocInfo().getStats();

            TranslationStatistics msgStats =
                    statsContainer.getStats(localeId.getId(), StatUnit.MESSAGE);

            if (msgStats != null) {
                projectStats.getStats(localeId.getId(), StatUnit.MESSAGE).add(
                        msgStats);
            }

            TranslationStatistics wordStats =
                    statsContainer.getStats(localeId.getId(), StatUnit.WORD);

            if (wordStats != null) {
                projectStats.getStats(localeId.getId(), StatUnit.WORD).add(
                        wordStats);
View Full Code Here

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

            TranslationStatistics transUnitStats =
                    getMessageStats(count, locId, lastModifiedDate,
                            lastModifiedBy);
            transUnitStats.setRemainingHours(StatisticsUtil
                    .getRemainingHours(wordCount));
            iterationStats.addStats(transUnitStats);

            // word level stats
            if (includeWordStats) {
                TranslationStatistics wordsStats =
                        getWordsStats(wordCount, locId, lastModifiedDate,
                                lastModifiedBy);
                wordsStats.setRemainingHours(StatisticsUtil
                        .getRemainingHours(wordCount));
                iterationStats.addStats(wordsStats);
            }
        }
View Full Code Here

            DocumentStatus docStatus =
                    translationStateCacheImpl.getDocumentStatus(
                            document.getId(), localeId);

            TranslationStatistics docWordStatistic =
                    docStats.getStats(localeId.getId(), StatUnit.WORD);
            TranslationStatistics docMsgStatistic =
                    docStats.getStats(localeId.getId(), StatUnit.MESSAGE);

            docMsgStatistic
                    .setLastTranslatedBy(docStatus.getLastTranslatedBy());
            docMsgStatistic.setLastTranslatedDate(docStatus
                    .getLastTranslatedDate());
            docMsgStatistic.setLastTranslated(getLastTranslated(
                    docStatus.getLastTranslatedDate(),
                    docStatus.getLastTranslatedBy()));
            docStatistics.addStats(docMsgStatistic);

            // word level stats
View Full Code Here

        return result;
    }

    private TranslationStatistics getWordsStats(TransUnitWords wordCount,
            LocaleId locale, Date lastChanged, String lastModifiedBy) {
        TranslationStatistics stats =
                new TranslationStatistics(wordCount, locale.getId());
        stats.setLastTranslatedBy(lastModifiedBy);
        stats.setLastTranslatedDate(lastChanged);
        stats.setLastTranslated(getLastTranslated(lastChanged, lastModifiedBy));

        return stats;
    }
View Full Code Here

        return stats;
    }

    private TranslationStatistics getMessageStats(TransUnitCount unitCount,
            LocaleId locale, Date lastChanged, String lastModifiedBy) {
        TranslationStatistics stats =
                new TranslationStatistics(unitCount, locale.getId());
        stats.setLastTranslatedBy(lastModifiedBy);
        stats.setLastTranslatedDate(lastChanged);
        stats.setLastTranslated(getLastTranslated(lastChanged, lastModifiedBy));

        return stats;
    }
View Full Code Here

    public ContainerTranslationStatistics getDocStatistics(Long documentId,
            LocaleId localeId) {
        ContainerTranslationStatistics result =
                documentDAO.getStatistics(documentId, localeId);

        TranslationStatistics wordStatistics =
                result.getStats(localeId.getId(), StatUnit.WORD);
        wordStatistics.setRemainingHours(StatisticsUtil
                .getRemainingHours(wordStatistics));

        TranslationStatistics msgStatistics =
                result.getStats(localeId.getId(), StatUnit.MESSAGE);
        msgStatistics.setRemainingHours(StatisticsUtil
                .getRemainingHours(wordStatistics));

        return result;
    }
View Full Code Here

        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());

        ContainerTranslationStatistics result =
                new ContainerTranslationStatistics();
        result.addStats(msgStats);
        result.addStats(wordStats);
View Full Code Here

    private ArgumentCaptor<KeyShortcut> keyShortcutCaptor;

    @BeforeMethod
    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

TOP

Related Classes of org.zanata.rest.dto.stats.TranslationStatistics

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.