Search in sources :

Example 1 with SocialUser

use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.

the class DiscussionAddedEventAdapter method toSocial.

@Override
public SocialActivitiesEvent toSocial(Object object) {
    CommentAddedEvent event = (CommentAddedEvent) object;
    SocialUser socialUser = socialUserRepositoryAPI.findSocialUser(event.getUserName());
    String additionalInfo = "commented";
    return new SocialActivitiesEvent(socialUser, DiscussionEventTypes.COMMENT_ADDED.name(), new Date(event.getTimestamp())).withLink(event.getPath().getFileName(), event.getPath().toURI()).withAdicionalInfo(additionalInfo);
}
Also used : CommentAddedEvent(org.kie.workbench.common.services.shared.discussion.CommentAddedEvent) SocialUser(org.ext.uberfire.social.activities.model.SocialUser) SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) Date(java.util.Date)

Example 2 with SocialUser

use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.

the class ResourceAddedEventAdapter method toSocial.

@Override
public SocialActivitiesEvent toSocial(Object object) {
    ResourceAddedEvent event = (ResourceAddedEvent) object;
    SocialUser socialUser = socialUserRepositoryAPI.findSocialUser(event.getSessionInfo().getIdentity().getIdentifier());
    String additionalInfo = "Added";
    String description = getCommitDescription(event);
    return new SocialActivitiesEvent(socialUser, HomePageTypes.RESOURCE_ADDED_EVENT.name(), new Date()).withLink(event.getPath().getFileName(), event.getPath().toURI()).withAdicionalInfo(additionalInfo).withDescription(description);
}
Also used : SocialUser(org.ext.uberfire.social.activities.model.SocialUser) ResourceAddedEvent(org.uberfire.workbench.events.ResourceAddedEvent) SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) Date(java.util.Date)

Example 3 with SocialUser

use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.

the class UserHomePageSidePresenterTest method setup.

@Before
public void setup() {
    socialUserServiceAPICaller = new CallerMock<SocialUserServiceAPI>(socialUserServiceAPI);
    socialUserRepositoryAPICaller = new CallerMock<SocialUserRepositoryAPI>(socialUserRepositoryAPI);
    presenter.socialUserService = socialUserServiceAPICaller;
    presenter.socialUserRepositoryAPI = socialUserRepositoryAPICaller;
    presenter.selectedEvent = selectEvent;
    presenter.users = new HashMap<String, SocialUser>();
    presenter.loggedUser = new UserImpl("dora");
    dora = new SocialUser("dora");
    bento = new SocialUser("bento");
    presenter.users.put("dora", dora);
    presenter.users.put("bento", bento);
}
Also used : SocialUserRepositoryAPI(org.ext.uberfire.social.activities.service.SocialUserRepositoryAPI) SocialUser(org.ext.uberfire.social.activities.model.SocialUser) UserImpl(org.jboss.errai.security.shared.api.identity.UserImpl) SocialUserServiceAPI(org.ext.uberfire.social.activities.service.SocialUserServiceAPI) Before(org.junit.Before)

Example 4 with SocialUser

use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.

the class ContributorsManagementListItemPresenterTest method setupUserWithNameTest.

@Test
public void setupUserWithNameTest() {
    presenter.setup(new SocialUser("user", "John Admin", null, null, null));
    verify(view).init(presenter);
    verify(view).setUserName("John Admin");
    verify(view, never()).setSelected(anyBoolean());
}
Also used : SocialUser(org.ext.uberfire.social.activities.model.SocialUser) Test(org.junit.Test)

Example 5 with SocialUser

use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.

the class ContributorsManagementPresenterTest method setupTest.

@Test
public void setupTest() {
    final List<SocialUser> users = new ArrayList<>();
    users.add(userA);
    users.add(userB);
    final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
    doReturn(users.stream().map(SocialUser::getUserName).collect(Collectors.toList())).when(organizationalUnit).getContributors();
    doReturn(userB.getUserName()).when(organizationalUnit).getOwner();
    presenter.setup(organizationalUnit);
    verify(view).init(presenter);
    verify(view).clearFilter();
    verify(contributorsManagementListItemPresenter).setup(userA);
    verify(contributorsManagementListItemPresenter).setup(userB);
    verify(contributorsManagementListItemPresenter).setup(userC);
    verify(contributorsManagementListItemPresenter, times(3)).setSelected(true);
    verify(contributorsManagementListItemPresenter, times(2)).setEnabled(true);
    verify(contributorsManagementListItemPresenter).setEnabled(false);
    verify(view).clearUsers();
    verify(view, times(3)).addUser(contributorsManagementListItemPresenter);
}
Also used : OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) SocialUser(org.ext.uberfire.social.activities.model.SocialUser) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

SocialUser (org.ext.uberfire.social.activities.model.SocialUser)14 Date (java.util.Date)4 SocialActivitiesEvent (org.ext.uberfire.social.activities.model.SocialActivitiesEvent)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)3 SocialPaged (org.ext.uberfire.social.activities.model.SocialPaged)2 Before (org.junit.Before)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 ContextNotActiveException (javax.enterprise.context.ContextNotActiveException)1 Next (org.ext.uberfire.social.activities.client.widgets.pagination.Next)1 SimpleSocialTimelineWidgetModel (org.ext.uberfire.social.activities.client.widgets.timeline.simple.model.SimpleSocialTimelineWidgetModel)1 SocialUserRepositoryAPI (org.ext.uberfire.social.activities.service.SocialUserRepositoryAPI)1 SocialUserServiceAPI (org.ext.uberfire.social.activities.service.SocialUserServiceAPI)1 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)1 NewRepositoryEvent (org.guvnor.structure.repositories.NewRepositoryEvent)1 UserImpl (org.jboss.errai.security.shared.api.identity.UserImpl)1 UserEditedEvent (org.kie.workbench.common.screens.social.hp.client.homepage.events.UserEditedEvent)1 UserHomepageSelectedEvent (org.kie.workbench.common.screens.social.hp.client.homepage.events.UserHomepageSelectedEvent)1