Package org.zanata.webtrans.shared.model

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


    @Override
    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 =
View Full Code Here


    protected Person retrievePerson() {
        HAccount authenticatedAccount =
                (HAccount) Contexts.getSessionContext().get(
                        JpaIdentityStore.AUTHENTICATED_USER);
        return new Person(new PersonId(authenticatedAccount.getUsername()),
                authenticatedAccount.getPerson().getName(),
                gravatarServiceImpl.getUserImageUrl(16, authenticatedAccount
                        .getPerson().getEmail()));
    }
View Full Code Here

            PersonId personId = entry.getValue().getPerson().getId();

            HPerson person =
                    accountDAO.getByUsername(personId.toString()).getPerson();

            Person translator =
                    new Person(personId, person.getName(),
                            gravatarServiceImpl.getUserImageUrl(16,
                                    person.getEmail()));
            entry.getValue().setPerson(translator);
            translators.put(entry.getKey(), entry.getValue());
        }
View Full Code Here

                        "Publishing ExitWorkspace event for user {} with editorClientId {} from workspace {}",
                        new Object[] { username, editorClientId,
                                workspace.getWorkspaceContext() });
                // Send GWT Event to client to update the userlist
                ExitWorkspace event =
                        new ExitWorkspace(editorClientId, new Person(
                                new PersonId(username), personName,
                                getGravatarService().getUserImageUrl(16,
                                        personEmail)));
                workspace.publish(event);
            }
View Full Code Here

    @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

    @Test
    public void testExecute() throws Exception {
        GetTranslatorList action = GetTranslatorList.ACTION;
        WorkspaceId workspaceId = TestFixture.workspaceId();
        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");

        GetTranslatorListResult result = handler.execute(action, null);
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));
        callback.onSuccess(new GetTranslatorListResult(translator, translator
View Full Code Here

    @BeforeMethod
    public void beforeMethod() {
        MockitoAnnotations.initMocks(this);
        identity =
                new Identity(new EditorClientId("sessionId", 1), new Person(
                        new PersonId("pid"), "name", "url"));
        service = new TranslatorInteractionService(identity, dispatcher);
    }
View Full Code Here

    }

    @Test
    public void onPersonExit() {
        TransUnit selectedTransUnit = TestFixture.makeTransUnit(1);
        Person person = TestFixture.person();

        service.personExit(person, selectedTransUnit.getId());

        verify(dispatcher).execute(actionCaptor.capture(),
                Mockito.isA(NoOpAsyncCallback.class));
View Full Code Here

                new AuditInfo(new Date(), "last translator")));

        Identity identity =
                new Identity(
                        new EditorClientId("123456", 1),
                        new Person(new PersonId("bob"), "Bob The Builder",
                                "http://www.gravatar.com/avatar/bob@zanata.org?d=mm&s=16"));

        ValidationFactory validationFactory = new ValidationFactory(null);
        Map<ValidationId, ValidationAction> validationMap =
                validationFactory.getAllValidationActions();
View Full Code Here

TOP

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

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.