Package org.zanata.webtrans.shared.model

Examples of org.zanata.webtrans.shared.model.DocumentStatus


        if (sortOption.equals(SortingType.SortOption.LAST_SOURCE_UPDATE)
                || sortOption.equals(SortingType.SortOption.LAST_TRANSLATED)) {
            if (sortOption.equals(SortingType.SortOption.LAST_SOURCE_UPDATE)) {
                date = document.getLastChanged();
            } else {
                DocumentStatus docStat =
                        translationStateCacheImpl.getDocumentStatus(
                                document.getId(), localeId);
                date = docStat.getLastTranslatedDate();
            }
        }

        return getDisplayUnit(sortOption, statistic, date);
    }
View Full Code Here


                return DateUtil.compareDate(o1.getLastChanged(),
                        o2.getLastChanged());
            } else if (selectedSortOption
                    .equals(SortingType.SortOption.LAST_TRANSLATED)) {
                if (selectedLocaleId != null) {
                    DocumentStatus docStat1 =
                            translationStateCacheImpl.getDocumentStatus(
                                    o1.getId(), selectedLocaleId);
                    DocumentStatus docStat2 =
                            translationStateCacheImpl.getDocumentStatus(
                                    o2.getId(), selectedLocaleId);

                    return DateUtil.compareDate(
                            docStat1.getLastTranslatedDate(),
                            docStat2.getLastTranslatedDate());
                }
            } else {
                WordStatistic wordStatistic1;
                WordStatistic wordStatistic2;
                if (selectedLocaleId != null) {
View Full Code Here

            ContainerTranslationStatistics stats =
                    statisticsServiceImpl.getDocStatistics(documentId.getId(),
                            action.getWorkspaceId().getLocaleId());
            statsMap.put(documentId, stats);

            DocumentStatus docStat =
                    translationStateCacheImpl.getDocumentStatus(documentId
                            .getId(), action.getWorkspaceId().getLocaleId());

            lastTranslatedMap.put(
                    documentId,
                    new AuditInfo(docStat.getLastTranslatedDate(), docStat
                            .getLastTranslatedBy()));
        }
        return new GetDocumentStatsResult(statsMap, lastTranslatedMap);
    }
View Full Code Here

        for (LocaleId localeId : localeIds) {
            ContainerTranslationStatistics docStats =
                    getDocStatistics(document.getId(), localeId);

            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
            if (includeWordStats) {
                docWordStatistic.setLastTranslatedBy(docStatus
                        .getLastTranslatedBy());
                docWordStatistic.setLastTranslatedDate(docStatus
                        .getLastTranslatedDate());
                docWordStatistic.setLastTranslated(getLastTranslated(
                        docStatus.getLastTranslatedDate(),
                        docStatus.getLastTranslatedBy()));
                docStatistics.addStats(docWordStatistic);
            }
        }
        return docStatistics;
    }
View Full Code Here

        // Given:
        Long documentId = new Long("100");
        LocaleId testLocaleId = LocaleId.DE;
        TranslationStateCacheImpl.DocumentLocaleKey key =
                new DocumentLocaleKey(documentId, testLocaleId);
        DocumentStatus docStats =
                new DocumentStatus(new DocumentId(documentId, ""), new Date(),
                        "");

        // When:
        when(docStatsLoader.load(key)).thenReturn(docStats);

        DocumentStatus result1 =
                tsCache.getDocumentStatus(documentId, testLocaleId);
        DocumentStatus result2 =
                tsCache.getDocumentStatus(documentId, testLocaleId);

        // Then:
        verify(docStatsLoader).load(key); // only load the value once
        assertThat(result1, equalTo(docStats));
View Full Code Here

        targetValidationCache.remove(event.getTextFlowTargetId());
    }

    private void updateDocStatusCache(DocumentLocaleKey key,
            Long updatedTargetId) {
        DocumentStatus documentStatus = docStatusCache.get(key);
        if(documentStatus != null) {
            HTextFlowTarget target =
                getTextFlowTargetDAO().findById(updatedTargetId, false);
            updateDocumentStatus(getDocumentDAO(), documentStatus,
                key.getDocumentId(), target);
View Full Code Here

        public DocumentStatus load(DocumentLocaleKey key) throws Exception {
            DocumentDAO documentDAO = getDocumentDAO();
            HTextFlowTarget target =
                    documentDAO.getLastTranslatedTarget(key.getDocumentId(),
                            key.getLocaleId());
            DocumentStatus documentStatus = new DocumentStatus();

            return updateDocumentStatus(documentDAO, documentStatus,
                    key.getDocumentId(), target);
        }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.model.DocumentStatus

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.