Examples of ContentState


Examples of org.zanata.common.ContentState

    private boolean translate(@Nonnull HTextFlowTarget hTextFlowTarget,
            @Nonnull List<String> contentsToSave, ContentState requestedState,
            int nPlurals, Boolean requireTranslationReview) {
        boolean targetChanged = false;
        ContentState currentState = hTextFlowTarget.getState();
        targetChanged |= setContentIfChanged(hTextFlowTarget, contentsToSave);
        targetChanged |=
                setContentStateIfChanged(requestedState, hTextFlowTarget,
                        nPlurals, requireTranslationReview);
View Full Code Here

Examples of org.zanata.common.ContentState

    private boolean setContentStateIfChanged(
            @Nonnull ContentState requestedState,
            @Nonnull HTextFlowTarget target, int nPlurals,
            boolean requireTranslationReview) {
        boolean changed = false;
        ContentState previousState = target.getState();
        target.setState(requestedState);
        ArrayList<String> warnings = new ArrayList<String>();
        changed |= adjustContentsAndState(target, nPlurals, warnings);
        for (String warning : warnings) {
            log.warn(warning);
View Full Code Here

Examples of org.zanata.common.ContentState

     * @return true if and only if some state was changed
     */
    private static boolean adjustContentsAndState(
            @Nonnull HTextFlowTarget target, int nPlurals,
            @Nonnull List<String> warnings) {
        ContentState oldState = target.getState();
        String resId = target.getTextFlow().getResId();
        boolean contentsChanged =
                ensureContentsSize(target, nPlurals, resId, warnings);

        List<String> contents = target.getContents();
View Full Code Here

Examples of org.zanata.common.ContentState

                            hTextFlowTarget.getHistory().get(
                                    info.getPreviousVersionNum());
                    if (oldTarget != null) {
                        // generate request
                        List<String> oldContents = oldTarget.getContents();
                        ContentState oldState = oldTarget.getState();
                        TransUnitUpdateRequest request =
                                new TransUnitUpdateRequest(tuId, oldContents,
                                        oldState, versionNum);
                        // add to list
                        updateRequests.add(request);
View Full Code Here

Examples of org.zanata.common.ContentState

                textFlowTargetHistoryDAO.getUserTranslationHistoryInVersion(
                        version.getId(), person.getId(), fromDate, toDate);

        for (Object[] entry : data) {
            int count = ((BigDecimal) entry[0]).intValue();
            ContentState state = ContentState.values()[(int) entry[1]];
            LocaleId localeId = new LocaleId(entry[2].toString());

            BaseTranslationCount stats;
            if (localeStatistics.containsKey(localeId)) {
                stats = localeStatistics.get(localeId);
View Full Code Here

Examples of org.zanata.common.ContentState

            int numRows, int start) {
        ArrayList<TransUnit> units = new ArrayList<TransUnit>();
        for (int i = start; i < start + numRows; i++) {
            boolean plural = (i % 5 == 0);
            int stateNum = Random.nextInt(ContentState.values().length);
            ContentState state = ContentState.values()[stateNum];
            ArrayList<String> sources = new ArrayList<String>();
            ArrayList<String> targets = new ArrayList<String>();

            sources.add(i % 2 == 0 ? "\n<hellow \nnum=\"" + (i + 1)
                    + "\" /> %s\n"
View Full Code Here

Examples of org.zanata.common.ContentState

                        true, true, Approved).expectTransState(Approved);
        testCopyTrans(execution);
    }

    private ContentState getExpectedContentState(CopyTransExecution execution) {
        ContentState expectedContentState =
                execution.getRequireTranslationReview() ? Approved : Translated;

        expectedContentState =
                getExpectedContentState(execution.getContextMatches(),
                        execution.getContextMismatchAction(),
View Full Code Here

Examples of org.zanata.common.ContentState

                            (ConditionRuleAction) params[2],
                            (Boolean) params[3], (Boolean) params[4],
                            (Boolean) params[5], (Boolean) params[6],
                            (ContentState) params[7]);

            ContentState expectedContentState =
                    this.getExpectedContentState(exec);
            if (expectedContentState == New) {
                exec.expectUntranslated();
            } else {
                exec.expectTransState(expectedContentState).withContents(
View Full Code Here

Examples of org.zanata.common.ContentState

        Long docId = 1L;
        Long tfId = 1L;
        Long versionId = 1L;
        LocaleId localeId = LocaleId.DE;
        int wordCount = 10;
        ContentState oldState = ContentState.New;
        ContentState newState = ContentState.Translated;

        WordStatistic stats = new WordStatistic(10, 10, 10, 10, 10);
        WordStatistic oldStats = StatisticsUtil.copyWordStatistic(stats);
        oldStats.decrement(newState, wordCount);
        oldStats.increment(oldState, wordCount);
View Full Code Here

Examples of org.zanata.common.ContentState

        int wordCount1 = target1.getTextFlow().getWordCount().intValue();
        int wordCount2 = target2.getTextFlow().getWordCount().intValue();

        // new -> approved
        ContentState newState = ContentState.Approved;

        ContributionStatistics expectedStats = new ContributionStatistics();
        expectedStats.put(username, buildStats(localeId, 0, 0, 0,
                wordCount1, 0));
        target1 = executeStateChangeTest(target1, "test1",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.