Package org.zanata.common

Examples of org.zanata.common.TransUnitCount


                        .setParameter("locale", localeId)
                        .setComment("DocumentDAO.getStatistics-units")
                        .setCacheable(true).list();
        Long totalCount = getTotalCountForDocument(docId);

        TransUnitCount unitCount = new TransUnitCount();
        for (StatusCount count : stats) {
            unitCount.set(count.status, count.count.intValue());
        }
        unitCount.set(ContentState.New,
                StatisticsUtil.calculateUntranslated(totalCount, unitCount));

        // calculate word counts
        @SuppressWarnings("unchecked")
        List<StatusCount> wordStats =
View Full Code Here


            ContentState state = (ContentState) row.get("state");
            Long msgCount = (Long) row.get("msgCount");
            Long wordCount = (Long) row.get("wordCount");
            LocaleId localeId = (LocaleId) row.get("locale");

            TransUnitCount transUnitCount =
                    transUnitCountMap.get(localeId.getId());
            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(
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

     */
    public TransUnitCount getStatisticsForContainer(Long iterationId,
            LocaleId localeId) {
        List<StatusCount> stats = getMessageStatusCount(iterationId, localeId);

        TransUnitCount stat = new TransUnitCount();

        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

        for (Map row : stats) {
            ContentState state = (ContentState) row.get("state");
            Long count = (Long) row.get("count");
            LocaleId localeId = (LocaleId) row.get("locale");

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

            transUnitCount.set(state, count.intValue());
        }

        for (TransUnitCount stat : retVal.values()) {
            Long totalCount = getTotalMessageCountForIteration(iterationId);
            stat.set(ContentState.New,
View Full Code Here

                projectIterationDAO.getTotalWordCountForIteration(iteration
                        .getId());

        for (LocaleId locId : localeIds) {
            // trans unit level stats
            TransUnitCount count = transUnitIterationStats.get(locId.getId());
            // Stats might not return anything if nothing is translated
            if (count == null) {
                count = new TransUnitCount(0, 0, (int) iterationTotalMssgs);
            }

            HTextFlowTarget target =
                    localeServiceImpl.getLastTranslated(projectSlug,
                            iterationSlug, locId);
View Full Code Here

        }
        return names;
    }

    private ContainerTranslationStatistics newStats(int docID) {
        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);
 
View Full Code Here

    @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);
View Full Code Here

        DocumentId docId = new DocumentId(1L, "");
        // newly selected document has new stats

        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"),
View Full Code Here

        DocumentId docId = new DocumentId(1L, "");
        // newly selected document has new stats

        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 =
View Full Code Here

TOP

Related Classes of org.zanata.common.TransUnitCount

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.