Search in sources :

Example 1 with NewRepositoryEvent

use of org.guvnor.structure.repositories.NewRepositoryEvent in project kie-wb-common by kiegroup.

the class NewRepositoryEventAdapter method toSocial.

@Override
public SocialActivitiesEvent toSocial(Object object) {
    NewRepositoryEvent event = (NewRepositoryEvent) object;
    SocialUser socialUser = null;
    try {
        socialUser = socialUserRepositoryAPI.findSocialUser(loggedUser.getIdentifier());
    } catch (ContextNotActiveException e) {
        // clean repository
        socialUser = new SocialUser("system");
    }
    String additionalInfo = "Created";
    return new SocialActivitiesEvent(socialUser, ExtendedTypes.NEW_REPOSITORY_EVENT, new Date()).withAdicionalInfo(additionalInfo).withLink(event.getNewRepository().getAlias(), event.getNewRepository().getUri()).withDescription("");
}
Also used : SocialUser(org.ext.uberfire.social.activities.model.SocialUser) ContextNotActiveException(javax.enterprise.context.ContextNotActiveException) SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) NewRepositoryEvent(org.guvnor.structure.repositories.NewRepositoryEvent) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 ContextNotActiveException (javax.enterprise.context.ContextNotActiveException)1 SocialActivitiesEvent (org.ext.uberfire.social.activities.model.SocialActivitiesEvent)1 SocialUser (org.ext.uberfire.social.activities.model.SocialUser)1 NewRepositoryEvent (org.guvnor.structure.repositories.NewRepositoryEvent)1