Examples of WorkspaceId


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

    public ActivateWorkspaceResult execute(ActivateWorkspaceAction action,
            ExecutionContext context) throws ActionException {
        identity.checkLoggedIn();
        Person person = retrievePerson();

        WorkspaceId workspaceId = action.getWorkspaceId();
        TranslationWorkspace workspace =
                translationWorkspaceManager.getOrRegisterWorkspace(workspaceId);
        String httpSessionId = getHttpSessionId();
        EditorClientId editorClientId =
                new EditorClientId(httpSessionId, generateEditorClientNum());
        workspace
                .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 =
                projectIterationDAO.getBySlug(workspaceId
                        .getProjectIterationId().getProjectSlug(), workspaceId
                        .getProjectIterationId().getIterationSlug());

        boolean isProjectActive =
                isProjectIterationActive(project.getStatus(),
                        projectIteration.getStatus());
View Full Code Here

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

    @Override
    public AddReviewCommentResult execute(AddReviewCommentAction action,
            ExecutionContext context) throws ActionException {
        throwExceptionIfCommentIsInvalid(action);

        WorkspaceId workspaceId = action.getWorkspaceId();
        HProject project =
                securityServiceImpl.checkWorkspaceStatus(workspaceId);

        HTextFlowTarget hTextFlowTarget =
                textFlowTargetDAO.getTextFlowTarget(action.getTransUnitId()
                        .getValue(), workspaceId.getLocaleId());
        if (hTextFlowTarget == null
                || hTextFlowTarget.getState().isUntranslated()) {
            throw new ActionException(
                    "comment on untranslated message is pointless!");
        }

        HLocale locale =
                localeServiceImpl.getByLocaleId(workspaceId.getLocaleId());

        identity.checkPermission("review-comment", locale, project);

        TranslationWorkspace workspace =
                translationWorkspaceManager.getOrRegisterWorkspace(workspaceId);
View Full Code Here

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

        HProjectIteration projectIteration = document.getProjectIteration();
        String iterationSlug = projectIteration.getSlug();
        String projectSlug = projectIteration.getProject().getSlug();
        ProjectType projectType = projectIteration.getProjectType();

        WorkspaceId workspaceId =
                new WorkspaceId(new ProjectIterationId(projectSlug,
                        iterationSlug, projectType), localeId);
        Optional<TranslationWorkspace> workspaceOptional =
                translationWorkspaceManager.tryGetWorkspace(workspaceId);
        if (!workspaceOptional.isPresent()) {
            return;
View Full Code Here

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

    }-*/;

    public static WorkspaceId getWorkspaceId() {
        if (workspaceId == null) {
            workspaceId =
                    new WorkspaceId(getProjectIterationId(), getLocaleId());
        }
        return workspaceId;
    }
View Full Code Here

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

        }
    }

    @Override
    public void downloadAllFiles() {
        WorkspaceId workspaceId =
                userWorkspaceContext.getWorkspaceContext().getWorkspaceId();
        dispatcher.execute(new DownloadAllFilesAction(workspaceId
                .getProjectIterationId().getProjectSlug(), workspaceId
                .getProjectIterationId().getIterationSlug(), workspaceId
                .getLocaleId().getId(), isPoProject(getProjectType())),
                new AsyncCallback<DownloadAllFilesResult>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        eventBus.fireEvent(new NotificationEvent(
View Full Code Here

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

    @Test(expectedExceptions = ActionException.class)
    public void invalidLocaleWillThrowException() throws ActionException {
        // Given:
        String projectSlug = "rhel";
        String iterationSlug = "7.0";
        action.setWorkspaceId(new WorkspaceId(new ProjectIterationId(
                projectSlug, iterationSlug, ProjectType.Podir), localeId));
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        projectSlug, iterationSlug)).thenThrow(
                new ZanataServiceException("BANG!"));
View Full Code Here

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

    @Test
    public void canGetEmptyHistoryForTextFlowWithNoTranslation()
            throws ActionException {
        // Given: text flow has empty targets
        action.setWorkspaceId(new WorkspaceId(new ProjectIterationId("rhel",
                "7.0", ProjectType.Podir), localeId));
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        "rhel", "7.0")).thenReturn(hLocale);
        HTextFlow hTextFlow = createHTextFlow();
View Full Code Here

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

    }

    @Test
    public void canGetHistoryAndCurrentTranslation() throws ActionException {
        // Given: text flow has 2 history translation
        action.setWorkspaceId(new WorkspaceId(new ProjectIterationId("rhel",
                "7.0", ProjectType.Podir), localeId));
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        "rhel", "7.0")).thenReturn(hLocale);
        when(hLocale.getId()).thenReturn(2L);
View Full Code Here

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

    @Test
    public void canGetCurrentTranslationWithoutLastModifiedBy()
            throws ActionException {
        // Given: text flow has no history translation and only current
        // translation which has no last modified by person
        action.setWorkspaceId(new WorkspaceId(new ProjectIterationId("rhel",
                "7.0", ProjectType.Podir), localeId));
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        "rhel", "7.0")).thenReturn(hLocale);
        when(hLocale.getId()).thenReturn(2L);
View Full Code Here

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

    @Test
    public void canStripObsoleteTargetContentBasedOnCurrentNPlural()
            throws ActionException {
        // Given: text flow has no history translation
        action.setWorkspaceId(new WorkspaceId(new ProjectIterationId("rhel",
                "7.0", ProjectType.Podir), localeId));
        when(
                localeService.validateLocaleByProjectIteration(localeId,
                        "rhel", "7.0")).thenReturn(hLocale);
        when(hLocale.getId()).thenReturn(2L);
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.