Package org.zanata.webtrans.shared.model

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


    }

    @Override
    public void addEditorClient(String httpSessionId,
            EditorClientId editorClientId, PersonId personId) {
        PersonSessionDetails prev =
                sessions.putIfAbsent(editorClientId, new PersonSessionDetails(
                        new Person(personId, "", ""), null));
        if (prev == null) {
            log.info("Added user {} with editorClientId {} to workspace {}",
                    personId.getId(), editorClientId, workspaceContext);
            httpSessionToEditorClientId.put(httpSessionId, editorClientId);
View Full Code Here


        return editorClients;
    }

    @Override
    public boolean removeEditorClient(EditorClientId editorClientId) {
        PersonSessionDetails details = sessions.remove(editorClientId);
        if (details != null) {
            String httpSessionId = editorClientId.getHttpSessionId();
            Collection<EditorClientId> clientIds =
                    httpSessionToEditorClientId.get(httpSessionId);
            if (clientIds != null) {
                clientIds.remove(editorClientId);

                // Send GWT Event to clients to update the user list
                ExitWorkspace event =
                        new ExitWorkspace(editorClientId, details.getPerson());
                publish(event);

                log.info(
                        "Removed user {} with editorClientId {} from workspace {}",
                        details.getPerson().getId(), editorClientId,
                        workspaceContext);
                return true;
            } else {
                log.warn(
                        "Unable to remove user {} with editorClientId {} from workspace {}",
                        details.getPerson().getId(), editorClientId,
                        workspaceContext);
            }
        } else {
            log.debug("EditorClientId {} not found in workspace {}",
                    editorClientId, workspaceContext);
View Full Code Here

    }

    @Override
    public void updateUserSelection(EditorClientId editorClientId,
            TransUnitId selectedTransUnitId) {
        PersonSessionDetails personSessionDetails =
                sessions.get(editorClientId);
        if (personSessionDetails != null) {
            personSessionDetails.setSelectedTransUnitId(selectedTransUnitId);
        }
    }
View Full Code Here

        }
    }

    @Override
    public TransUnitId getUserSelection(EditorClientId editorClientId) {
        PersonSessionDetails personSessionDetails =
                sessions.get(editorClientId);
        if (personSessionDetails != null) {
            return personSessionDetails.getSelectedTransUnitId();
        }

        return null;
    }
View Full Code Here

    public void initUserList(
            Map<EditorClientId, PersonSessionDetails> translatorList) {
        for (Map.Entry<EditorClientId, PersonSessionDetails> entry : translatorList
                .entrySet()) {
            EditorClientId editorClientId = entry.getKey();
            PersonSessionDetails personSessionDetails = entry.getValue();
            HasManageUserPanel panel =
                    workspaceUsersPresenter.addNewUser(personSessionDetails
                            .getPerson());
            addTranslator(editorClientId, personSessionDetails.getPerson(),
                    personSessionDetails.getSelectedTransUnitId(), panel);
        }
    }
View Full Code Here

        Person person = TestFixture.person();
        EditorClientId editorClientId = new EditorClientId("sid", 1);
        action.setWorkspaceId(workspaceId);
        when(translationWorkspaceManager.getOrRegisterWorkspace(workspaceId))
                .thenReturn(translationWorkspace);
        users.put(editorClientId, new PersonSessionDetails(person, null));
        when(translationWorkspace.getUsers()).thenReturn(users);
        when(accountDAO.getByUsername(person.getId().toString())).thenReturn(
                createHAccount("admin@redhat.com", "pahuang"));
        when(gravatarServiceImpl.getUserImageUrl(16, "admin@redhat.com"))
                .thenReturn("gravatarUrl");
View Full Code Here

        HashMap<EditorClientId, PersonSessionDetails> translator =
                new HashMap<EditorClientId, PersonSessionDetails>();
        translator
                .put(new EditorClientId("dummySession", 1),
                        new PersonSessionDetails(
                                new Person(
                                        new PersonId("personID"),
                                        "Some Person with an Incredibly Long Name",
                                        "http://www.gravatar.com/avatar/longname@zanata.org?d=mm&s=16"),
                                null));
View Full Code Here

        Map<EditorClientId, PersonSessionDetails> users =
                translationWorkspace.getUsers();

        assertThat(users, Matchers.hasKey(editorClientId));
        PersonSessionDetails personSessionDetails = users.get(editorClientId);
        assertThat(personSessionDetails.getPerson().getId(),
                Matchers.equalTo(personId));
    }
View Full Code Here

        TransUnit selectedTransUnit = TestFixture.makeTransUnit(1);

        translationWorkspace.updateUserSelection(editorClientId,
                selectedTransUnit.getId());

        PersonSessionDetails personSessionDetails =
                translationWorkspace.getUsers().get(editorClientId);
        assertThat(personSessionDetails.getSelectedTransUnitId(),
                Matchers.equalTo(selectedTransUnit.getId()));
        assertThat(translationWorkspace.getUserSelection(editorClientId),
                Matchers.equalTo(selectedTransUnit.getId()));
    }
View Full Code Here

TOP

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

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.