Package org.zanata.webtrans.shared.model

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


        targetContentsPresenter.savePendingChangesIfApplicable();
        List<TransUnit> currentPageValues =
                navigationService.getCurrentPageValues();
        sourceContentsPresenter.showData(currentPageValues);
        targetContentsPresenter.showData(currentPageValues);
        TransUnitId currentSelected =
                sourceContentsPresenter.getCurrentTransUnitIdOrNull();
        if (currentSelected != null) {
            sourceContentsPresenter.setSelectedSource(currentSelected);
            targetContentsPresenter.setSelected(currentSelected);
        }
View Full Code Here


        onRowSelected(rowIndexOnPage, false);
    }

    @Override
    public void onTableRowSelected(TableRowSelectedEvent event) {
        TransUnitId selectedId = event.getSelectedId();
        int rowIndex = navigationService.findRowIndexById(selectedId);
        if (rowIndex != NavigationService.UNDEFINED) {
            onRowSelected(rowIndex, event.isSuppressSavePending());
        }
    }
View Full Code Here

    }

    @Test
    public void canGetReviewComments() {
        GetTranslationHistoryAction action =
                new GetTranslationHistoryAction(new TransUnitId(1L));
        action.setWorkspaceId(TestFixture.workspaceId());
        LocaleId localeId = action.getWorkspaceId().getLocaleId();
        when(
                reviewCommentsDAO.getReviewComments(action.getTransUnitId(),
                        localeId)).thenReturn(
View Full Code Here

        jaHLocale = getEm().find(HLocale.class, 3L);

        WorkspaceId workspaceId = TestFixture.workspaceId();

        //plural="true" content0="One file removed_" content1="%d more files removed"
        sourceTransUnitId = new TransUnitId(3L);
        action = new GetTargetForLocale(sourceTransUnitId,
                new Locale(new IdForLocale(jaHLocale.getId(), localeId), ""));
        action.setWorkspaceId(workspaceId);
    }
View Full Code Here

    @Test(expectedExceptions = ActionException.class)
    public void testExecuteWithBlankComment() throws ActionException {
        String blankComment = "   \t \n";
        AddReviewCommentAction action =
                new AddReviewCommentAction(new TransUnitId(1L), blankComment,
                        documentId);

        handler.execute(action, null);
    }
View Full Code Here

    @Test
    public void testExecute() throws Exception {
        // Given: we want to add comment to trans unit id 2 and locale id DE
        String commentContent = "new comment";
        TransUnitId transUnitId = new TransUnitId(2L);
        HLocale hLocale = new HLocale(LocaleId.DE);
        AddReviewCommentAction action =
                new AddReviewCommentAction(transUnitId, commentContent,
                        documentId);
        action.setWorkspaceId(TestFixture.workspaceId(LocaleId.DE));
        when(authenticatedAccount.getPerson()).thenReturn(hPerson);
        when(securityServiceImpl.checkWorkspaceStatus(action.getWorkspaceId()))
                .thenReturn(hProject);
        when(
                translationWorkspaceManager.getOrRegisterWorkspace(action
                        .getWorkspaceId())).thenReturn(workspace);
        when(localeService.getByLocaleId(action.getWorkspaceId().getLocaleId()))
                .thenReturn(hLocale);
        when(
                textFlowTargetDAO.getTextFlowTarget(transUnitId.getValue(),
                        hLocale.getLocaleId())).thenReturn(hTextFlowTarget);
        when(hTextFlowTarget.getState()).thenReturn(ContentState.Rejected);
        when(hTextFlowTarget.getTextFlow()).thenReturn(hTextFlow);
        when(hTextFlowTarget.addReviewComment(commentContent, hPerson))
                .thenReturn(hReviewComment);
        when(hReviewComment.getId()).thenReturn(1L);

        // When:
        AddReviewCommentResult result = handler.execute(action, null);

        // Then:
        InOrder inOrder =
                Mockito.inOrder(textFlowTargetDAO,
                        textFlowTargetReviewCommentsDAO,
                        hTextFlowTarget, workspace,
                        securityServiceImpl, identity);
        inOrder.verify(securityServiceImpl).checkWorkspaceStatus(
                action.getWorkspaceId());
        inOrder.verify(textFlowTargetDAO).getTextFlowTarget(
                transUnitId.getValue(), hLocale.getLocaleId());
        inOrder.verify(identity).checkPermission("review-comment", hLocale,
                hProject);
        inOrder.verify(hTextFlowTarget).addReviewComment(commentContent,
                hPerson);
        inOrder.verify(textFlowTargetReviewCommentsDAO).flush();
View Full Code Here

    public void testExecuteWhenTargetIsNull() throws Exception {
        // Given: we want to add comment to trans unit id 1 and locale id DE but
        // target is null
        String commentContent = "new comment";
        AddReviewCommentAction action =
                new AddReviewCommentAction(new TransUnitId(1L), commentContent,
                        documentId);
        action.setWorkspaceId(TestFixture.workspaceId(LocaleId.DE));
        when(authenticatedAccount.getPerson()).thenReturn(hPerson);
        when(hPerson.getName()).thenReturn("John Smith");
        when(textFlowTargetDAO.getTextFlowTarget(1L, LocaleId.DE)).thenReturn(
View Full Code Here

    public void testExecuteWhenTargetIsUntranslated() throws Exception {
        // Given: we want to add comment to trans unit id 1 and locale id DE but
        // target is new
        String commentContent = "new comment";
        AddReviewCommentAction action =
                new AddReviewCommentAction(new TransUnitId(1L), commentContent,
                        documentId);
        action.setWorkspaceId(TestFixture.workspaceId(LocaleId.DE));
        when(authenticatedAccount.getPerson()).thenReturn(hPerson);
        when(hPerson.getName()).thenReturn("John Smith");
        when(textFlowTargetDAO.getTextFlowTarget(1L, LocaleId.DE)).thenReturn(
View Full Code Here

            for (TransUnitUpdateInfo info : translationsToRevert) {
                if (!info.isSuccess() || !info.isTargetChanged()) {
                    continue;
                }

                TransUnitId tuId = info.getTransUnit().getId();
                HTextFlow hTextFlow =
                        entityManager.find(HTextFlow.class, tuId.getValue());
                HTextFlowTarget hTextFlowTarget =
                        textFlowTargetDAO.getOrCreateTarget(hTextFlow, hLocale);

                // check that version has not advanced
                // TODO probably also want to check that source has not been
View Full Code Here

                if (plural) {
                    targets.add("<world> \"" + (i + 2) + "\"</world>");
                }
            }

            TransUnitId tuid = new TransUnitId(i + 1);
            TransUnit.Builder builder =
                    TransUnit.Builder.newTransUnitBuilder().setId(tuid)
                            .setResId(tuid.toString()).setLocaleId(localeId)
                            .setPlural(plural).setSources(sources)
                            .setSourceComment(sourceComment)
                            .setTargets(targets).setStatus(state)
                            .setLastModifiedBy("peter")
                            .setMsgContext("msgContext").setRowIndex(i)
View Full Code Here

TOP

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

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.