Package org.zanata.common

Examples of org.zanata.common.ContentState


        List<Map> stats = q.list();
        Map<String, TransUnitCount> retVal =
                new HashMap<String, TransUnitCount>();

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


                    }

                    int nPlurals = textFlow.isPlural() ? numPlurals : 1;
                    // we have eagerly loaded all targets upfront
                    HTextFlowTarget hTarget = textFlow.getTargets().get(locale.getId());
                    ContentState currentState = ContentState.New;
                    if (hTarget != null) {
                        currentState = hTarget.getState();
                    }

                    if (mergeType == MergeType.IMPORT) {
View Full Code Here

    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

    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

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

                            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

                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

            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

                        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

                            (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

TOP

Related Classes of org.zanata.common.ContentState

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.