Package org.zanata.webtrans.shared.model

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


        identity.checkPermission("modify-translation",
                textFlow.getDocument().getProjectIteration().getProject(),
                locale);

        // //Only support 1 translation update for the moment
        TransUnitUpdateRequest request =
                new TransUnitUpdateRequest(new TransUnitId(requestData.getId()
                        .longValue()), requestData.getContents(),
                        requestData.getStatus(), requestData.getRevision());

        List<TranslationResult> translationResults =
                translationServiceImpl.translate(new LocaleId(localeId),
View Full Code Here


        this();
        caseSensitive = isCaseSensitive;
        this.searchText = searchText;
        this.replaceText = replaceText;
        for (TransUnit tu : transUnits) {
            addTransUnit(new TransUnitUpdateRequest(tu.getId(),
                    tu.getTargets(), tu.getStatus(), tu.getVerNum()));
        }
    }
View Full Code Here

        List<TransUnitUpdateRequest> updateRequests =
                Lists.newArrayList(Collections2.transform(untranslatedTUs,
                        new Function<TransUnit, TransUnitUpdateRequest>() {
                            @Override
                            public TransUnitUpdateRequest apply(TransUnit from) {
                                return new TransUnitUpdateRequest(from.getId(),
                                        null, null, from.getVerNum());
                            }
                        }));
        return new TransMemoryMerge(threshold, updateRequests, mergeOptions);
    }
View Full Code Here

        targetContentsPresenter.setEditingState(idToSave,
                TargetContentsDisplay.EditingState.SAVING);

        UpdateTransUnit updateTransUnit =
                new UpdateTransUnit(new TransUnitUpdateRequest(idToSave,
                        forSaving.getTargets(), forSaving.getAdjustedStatus(),
                        forSaving.getVerNum()),
                        TransUnitUpdated.UpdateType.WebEditorSave);
        Log.info("about to save translation: " + updateTransUnit);
        dispatcher.execute(
View Full Code Here

                                    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);
                    } else {
                        log.info(
                                "got null previous target for tu with id {}, version {}. Assuming previous state is untranslated",
                                hTextFlow.getId(), info.getPreviousVersionNum());
                        List<String> emptyContents = Lists.newArrayList();
                        for (int i = 0; i < hTextFlowTarget.getContents()
                                .size(); i++) {
                            emptyContents.add("");
                        }
                        TransUnitUpdateRequest request =
                                new TransUnitUpdateRequest(tuId, emptyContents,
                                        ContentState.New, versionNum);
                        updateRequests.add(request);
                    }
                } else {
                    log.info(
View Full Code Here

    @Override
    public void execute() {
        Log.info("ENTER DummyUpdateTransUnitCommand.execute()");

        TransUnitUpdateRequest firstTu = action.getUpdateRequests().get(0);
        TransUnit tu =
                TransUnit.Builder.newTransUnitBuilder()
                        .setId(firstTu.getTransUnitId().getId())
                        .setVerNum(firstTu.getBaseTranslationVersion() + 1)
                        .setResId("dummyRestId").setLocaleId(LocaleId.EN_US)
                        .setSources(firstTu.getNewContents()).build();
        TransUnitUpdateInfo updateInfo =
                new TransUnitUpdateInfo(true, true, new DocumentId(new Long(0),
                        ""), tu, 5, firstTu.getBaseTranslationVersion(),
                        ContentState.NeedReview);
        UpdateTransUnitResult result = new UpdateTransUnitResult(updateInfo);
        callback.onSuccess(result);
        Log.info("EXIT DummyUpdateTransUnitCommand.execute()");
    }
View Full Code Here

        TransUnitId transUnitId = new TransUnitId(1L);
        List<String> newContents = new ArrayList<String>(2);
        newContents.add("translated 1");
        newContents.add("translated 2");
        TransUnitUpdateRequest translateReq =
                new TransUnitUpdateRequest(transUnitId, newContents,
                        ContentState.Approved, 1);

        List<TranslationResult> result =
                transService.translate(new LocaleId("de"),
                        Lists.newArrayList(translateReq));
View Full Code Here

        // Request 1
        TransUnitId transUnitId = new TransUnitId(1L);
        List<String> newContents = new ArrayList<String>(2);
        newContents.add("translated 1");
        newContents.add("translated 2");
        translationReqs.add(new TransUnitUpdateRequest(transUnitId,
                newContents, ContentState.Approved, 1));

        // Request 2 (different documents)
        transUnitId = new TransUnitId(2L);
        newContents = new ArrayList<String>(2);
        newContents.add("translated 1");
        newContents.add("translated 2");
        translationReqs.add(new TransUnitUpdateRequest(transUnitId,
                newContents, ContentState.NeedReview, 0));

        List<TranslationResult> results =
                transService.translate(new LocaleId("de"), translationReqs);
View Full Code Here

        TransUnitId transUnitId = new TransUnitId(2L);
        List<String> newContents = new ArrayList<String>(2);
        newContents.add("translated 1");
        newContents.add("translated 2");
        TransUnitUpdateRequest translateReq =
                new TransUnitUpdateRequest(transUnitId, newContents,
                        ContentState.Approved, 1);

        // Should not pass as the base version (1) does not match
        List<TransUnitUpdateRequest> translationRequests =
                Lists.newArrayList(translateReq);
View Full Code Here

        TranslationService transService =
                seam.autowire(TranslationServiceImpl.class);

        // untranslated
        TransUnitId transUnitId = new TransUnitId(3L);
        TransUnitUpdateRequest translateReq =
                new TransUnitUpdateRequest(transUnitId, Lists.newArrayList("a",
                        "b"), ContentState.Approved, 0);

        List<TranslationResult> result =
                transService.translate(new LocaleId("de"),
                        Lists.newArrayList(translateReq));
View Full Code Here

TOP

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

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.