Search in sources :

Example 1 with ProjectsUpdateMessage

use of org.eclipse.che.plugin.maven.shared.dto.ProjectsUpdateMessage in project che by eclipse.

the class MavenWebSocketCommunication method sendUpdateMassage.

@Override
public void sendUpdateMassage(Set<MavenProject> updated, List<MavenProject> removed) {
    ProjectsUpdateMessage dto = DtoFactory.newDto(ProjectsUpdateMessage.class);
    List<String> updatedPaths = updated.stream().map(project -> project.getProject().getFullPath().toOSString()).collect(Collectors.toList());
    dto.setUpdatedProjects(updatedPaths);
    List<String> removedPaths = removed.stream().map(project -> project.getProject().getFullPath().toOSString()).collect(Collectors.toList());
    dto.setDeletedProjects(removedPaths);
    send(DtoFactory.getInstance().toJsonElement(dto).getAsJsonObject(), MessageType.UPDATE);
}
Also used : JsonObject(com.google.gson.JsonObject) Logger(org.slf4j.Logger) MavenAttributes(org.eclipse.che.plugin.maven.shared.MavenAttributes) ChannelBroadcastMessage(org.everrest.websockets.message.ChannelBroadcastMessage) LoggerFactory(org.slf4j.LoggerFactory) MessageType(org.eclipse.che.plugin.maven.shared.MessageType) Set(java.util.Set) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) EncodeException(javax.websocket.EncodeException) NotificationMessage(org.eclipse.che.plugin.maven.shared.dto.NotificationMessage) List(java.util.List) MavenProject(org.eclipse.che.plugin.maven.server.core.project.MavenProject) ProjectsUpdateMessage(org.eclipse.che.plugin.maven.shared.dto.ProjectsUpdateMessage) WSConnectionContext(org.everrest.websockets.WSConnectionContext) DtoFactory(org.eclipse.che.dto.server.DtoFactory) Singleton(com.google.inject.Singleton) ProjectsUpdateMessage(org.eclipse.che.plugin.maven.shared.dto.ProjectsUpdateMessage)

Aggregations

JsonObject (com.google.gson.JsonObject)1 Singleton (com.google.inject.Singleton)1 IOException (java.io.IOException)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 EncodeException (javax.websocket.EncodeException)1 DtoFactory (org.eclipse.che.dto.server.DtoFactory)1 MavenProject (org.eclipse.che.plugin.maven.server.core.project.MavenProject)1 MavenAttributes (org.eclipse.che.plugin.maven.shared.MavenAttributes)1 MessageType (org.eclipse.che.plugin.maven.shared.MessageType)1 NotificationMessage (org.eclipse.che.plugin.maven.shared.dto.NotificationMessage)1 ProjectsUpdateMessage (org.eclipse.che.plugin.maven.shared.dto.ProjectsUpdateMessage)1 WSConnectionContext (org.everrest.websockets.WSConnectionContext)1 ChannelBroadcastMessage (org.everrest.websockets.message.ChannelBroadcastMessage)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1