Examples of HLocale


Examples of org.zanata.model.HLocale

        }
        String id = URIHelper.convertFromDocumentURIId(idNoSlash);

        HProjectIteration hProjectIteration =
                projectIterationDAO.getBySlug(projectSlug, iterationSlug);
        HLocale hLocale =
                restSlugValidator.validateTargetLocale(locale, projectSlug,
                        iterationSlug);

        EntityTag etag =
                eTagUtils.generateETagForTranslatedDocument(hProjectIteration,
View Full Code Here

Examples of org.zanata.model.HLocale

        public int compare(HLocale o1, HLocale o2) {
            SortingType.SortOption selectedSortOption =
                    sortingType.getSelectedSortOption();

            if (!selectedSortOption.isAscending()) {
                HLocale temp = o1;
                o1 = o2;
                o2 = temp;
            }

            // Need to get statistic for comparison
View Full Code Here

Examples of org.zanata.model.HLocale

                .addEditorClient(httpSessionId, editorClientId, person.getId());
        // Send EnterWorkspace event to clients
        EnterWorkspace event = new EnterWorkspace(editorClientId, person);
        workspace.publish(event);

        HLocale locale =
                localeServiceImpl.getByLocaleId(workspaceId.getLocaleId());
        HProject project =
                projectDAO.getBySlug(workspaceId.getProjectIterationId()
                        .getProjectSlug());
        HProjectIteration projectIteration =
View Full Code Here

Examples of org.zanata.model.HLocale

        }
    }

    @Override
    public Object stringToObject(String localeId) {
        return new HLocale(new LocaleId(localeId));
    }
View Full Code Here

Examples of org.zanata.model.HLocale

        @Override
        public void onSelectItemAction() {
            if (StringUtils.isEmpty(getSelectedItem())) {
                return;
            }
            HLocale locale = localeServiceImpl.getByLocaleId(getSelectedItem());

            getInstance().getActiveLocales().add(locale);

            update(conversationScopeMessages);
            reset();
            conversationScopeMessages.setMessage(FacesMessage.SEVERITY_INFO,
                    msgs.format("jsf.LanguageAddedToGroup",
                            locale.retrieveDisplayName()));
        }
View Full Code Here

Examples of org.zanata.model.HLocale

                Matchers.equalTo("another comment"));
    }

    private static HTextFlowTargetReviewComment makeCommentEntity(
            LocaleId localeId, String comment) {
        HLocale hLocale = new HLocale(localeId);
        TestFixture.setId(2L, hLocale);

        HTextFlow textFlow =
                TestFixture.makeHTextFlow(1L, hLocale, ContentState.Rejected);

        HPerson commenter = new HPerson();
        TestFixture.setId(3L, commenter);

        return new HTextFlowTargetReviewComment(textFlow.getTargets().get(
                hLocale.getId()), comment, commenter);
    }
View Full Code Here

Examples of org.zanata.model.HLocale

        when(translationResult.isTranslationSuccessful()).thenReturn(true);
        when(translationResult.getBaseContentState()).thenReturn(
                baseContentState);
        when(translationResult.getBaseVersionNum()).thenReturn(baseVersionNum);
        HTextFlow hTextFlow =
                TestFixture.makeHTextFlow(1, new HLocale(LocaleId.EN_US),
                        ContentState.Approved);
        HDocument spy = spy(new HDocument());
        when(spy.getId()).thenReturn(1L);
        hTextFlow.setDocument(spy);
        when(translationResult.getTranslatedTextFlowTarget()).thenReturn(
                new HTextFlowTarget(hTextFlow, new HLocale(LocaleId.DE)));

        return translationResult;
    }
View Full Code Here

Examples of org.zanata.model.HLocale

    @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

Examples of org.zanata.model.HLocale

    private LocaleId localeId = LocaleId.DE;
    private WorkspaceId workspaceId;

    @BeforeClass
    public void setUpData() {
        hLocale = TestFixture.setId(3L, new HLocale(LocaleId.DE));
        // @formatter:off
        textFlows = Lists.newArrayList(
            textFlow(1L, "File is removed", ""),
            textFlow(2L, "file", "open file"),
            textFlow(3L, " file ", null),
View Full Code Here

Examples of org.zanata.model.HLocale

    @Override
    public void save(@Nonnull LocaleId localeId, boolean enabledByDefault) {
        if (localeExists(localeId))
            return;
        HLocale entity = new HLocale();
        entity.setLocaleId(localeId);
        entity.setActive(true);
        entity.setEnabledByDefault(enabledByDefault);
        localeDAO.makePersistent(entity);
        localeDAO.flush();
    }
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.