Package org.zanata.rest.dto.stats

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


        }

        ContainerTranslationStatistics docStats =
                getDocStatistics(doc.getId(), new LocaleId(localeId));

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

        Type genericType = new GenericType<List<TranslationStatistics>>() {
        }.getGenericType();
        Object entity =
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

                StatisticsUtil.calculateUntranslated(totalWordCount, wordCount);
        wordCount.set(ContentState.New, (int) newWordCount);

        ContainerTranslationStatistics result =
                new ContainerTranslationStatistics();
        result.addStats(new TranslationStatistics(unitCount, localeId
                .toString()));
        result.addStats(new TranslationStatistics(wordCount, localeId
                .toString()));

        return result;
    }
View Full Code Here

        // Merge into a single Stats object
        for (String locale : transUnitCountMap.keySet()) {
            ContainerTranslationStatistics newStats =
                    new ContainerTranslationStatistics();
            newStats.addStats(new TranslationStatistics(transUnitCountMap
                    .get(locale), locale));
            newStats.addStats(new TranslationStatistics(transUnitWordsMap
                    .get(locale), locale));

            if (newStats.getStats(locale, StatUnit.MESSAGE) != null
                    && newStats.getStats(locale, StatUnit.WORD) != null) {
                returnStats.put(new LocaleId(locale), newStats);
View Full Code Here

        String text = "0";
        if (docInfo.getStats() != null) {
            String locale =
                    userWorkspaceContext.getWorkspaceContext().getWorkspaceId()
                            .getLocaleId().getId();
            TranslationStatistics stats;
            if (statsByWords) {
                stats = docInfo.getStats().getStats(locale, StatUnit.WORD);
            } else {
                stats = docInfo.getStats().getStats(locale, StatUnit.MESSAGE);
            }
            text = String.valueOf(stats.getTranslatedAndApproved());
        }
        return new InlineLabel(text);
    }
View Full Code Here

        String text = "0";
        if (docInfo.getStats() != null) {
            String locale =
                    userWorkspaceContext.getWorkspaceContext().getWorkspaceId()
                            .getLocaleId().getId();
            TranslationStatistics stats;
            if (statsByWords) {
                stats = docInfo.getStats().getStats(locale, StatUnit.WORD);
            } else {
                stats = docInfo.getStats().getStats(locale, StatUnit.MESSAGE);
            }
            text = String.valueOf(stats.getIncomplete());
        }
        return new InlineLabel(text);
    }
View Full Code Here

            graph.setStatOption(statsByWords);

            String locale =
                    userWorkspaceContext.getWorkspaceContext().getWorkspaceId()
                            .getLocaleId().toString();
            TranslationStatistics wordStats =
                    stats.getStats(locale, StatUnit.WORD);

            if (statsByWords) {
                translated.setText(String.valueOf(wordStats
                        .getTranslatedAndApproved()));
                untranslated.setText(String.valueOf(wordStats.getIncomplete()));
            } else {

                TranslationStatistics msgStats =
                        stats.getStats(locale, StatUnit.MESSAGE);

                translated.setText(String.valueOf(msgStats
                        .getTranslatedAndApproved()));
                untranslated.setText(String.valueOf(msgStats.getIncomplete()));
            }

            HasText remainingHour =
                    (HasText) this.getWidget(row, REMAINING_COLUMN);
            remainingHour.setText(messages.statusBarLabelHours(TextFormatUtil
View Full Code Here

     * @param updateInfo
     *            info describing the change in translations
     */
    private void adjustStats(ContainerTranslationStatistics stats,
            TransUnitUpdateInfo updateInfo) {
        TranslationStatistics msgStatistic =
                stats.getStats(localeId.getId(), StatUnit.MESSAGE);
        TranslationStatistics wordStatistic =
                stats.getStats(localeId.getId(), StatUnit.WORD);

        msgStatistic.decrement(updateInfo.getPreviousState(), 1);
        msgStatistic.increment(updateInfo.getTransUnit().getStatus(), 1);

        wordStatistic.decrement(updateInfo.getPreviousState(),
                updateInfo.getSourceWordCount());
        wordStatistic.increment(updateInfo.getTransUnit().getStatus(),
                updateInfo.getSourceWordCount());
    }
View Full Code Here

                return (o1.getDocInfo().getStats() == null) ? -1 : 1;
            }

            if (display.getSelectedStatsOption().equals(
                    DocumentListDisplay.STATS_OPTION_MESSAGE)) {
                TranslationStatistics msgStats1 =
                        o1.getDocInfo().getStats()
                                .getStats(localeId.getId(), StatUnit.MESSAGE);
                TranslationStatistics msgStats2 =
                        o2.getDocInfo().getStats()
                                .getStats(localeId.getId(), StatUnit.MESSAGE);

                return (int) (msgStats1.getPercentTranslated() - msgStats2
                        .getPercentTranslated());
            } else {
                TranslationStatistics msgStats1 =
                        o1.getDocInfo().getStats()
                                .getStats(localeId.getId(), StatUnit.WORD);
                TranslationStatistics msgStats2 =
                        o2.getDocInfo().getStats()
                                .getStats(localeId.getId(), StatUnit.WORD);

                return (int) (msgStats1.getPercentTranslated() - msgStats2
                        .getPercentTranslated());
            }
        }
View Full Code Here

                    || o2.getDocInfo().getStats() == null) {
                return (o1.getDocInfo().getStats() == null) ? -1 : 1;
            }
            if (display.getSelectedStatsOption().equals(
                    DocumentListDisplay.STATS_OPTION_MESSAGE)) {
                TranslationStatistics msgStats1 =
                        o1.getDocInfo().getStats()
                                .getStats(localeId.getId(), StatUnit.MESSAGE);
                TranslationStatistics msgStats2 =
                        o2.getDocInfo().getStats()
                                .getStats(localeId.getId(), StatUnit.MESSAGE);
                return (int) (msgStats1.getTranslatedAndApproved() - msgStats2.getTranslatedAndApproved());
            } else {
                TranslationStatistics msgStats1 =
                        o1.getDocInfo().getStats()
                                .getStats(localeId.getId(), StatUnit.WORD);
                TranslationStatistics msgStats2 =
                        o2.getDocInfo().getStats()
                                .getStats(localeId.getId(), StatUnit.WORD);
                return (int) (msgStats1.getTranslatedAndApproved() - msgStats2.getTranslatedAndApproved());
            }
        }
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.