Search in sources :

Example 1 with MessageSearchQuery

use of com.symphony.api.model.MessageSearchQuery in project spring-bot by finos.

the class SymphonyHistoryImpl method getEntityJsonFromHistory.

@Override
public List<EntityJson> getEntityJsonFromHistory(Tag t, Addressable address, Instant since) {
    MessageSearchQuery msq = createMessageSearchQuery(null, address, since, t);
    V4MessageList out = messageApi.v1MessageSearchPost(msq, null, null, 0, 50, null, null);
    return out.stream().map(msg -> getEntityJson(msg)).filter(e -> e != null).collect(Collectors.toList());
}
Also used : Tag(org.finos.symphony.toolkit.workflow.content.Tag) UsersApi(com.symphony.api.pod.UsersApi) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) AbstractStreamResolving(org.finos.symphony.toolkit.workflow.sources.symphony.streams.AbstractStreamResolving) SymphonyApiProperties(org.finos.symphony.toolkit.spring.api.properties.SymphonyApiProperties) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) V4MessageList(com.symphony.api.model.V4MessageList) StreamsApi(com.symphony.api.pod.StreamsApi) SymphonyAddressable(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyAddressable) CashTag(org.finos.symphony.toolkit.workflow.sources.symphony.content.CashTag) MessagesApi(com.symphony.api.agent.MessagesApi) List(java.util.List) Addressable(org.finos.symphony.toolkit.workflow.content.Addressable) V4Message(com.symphony.api.model.V4Message) EntityJson(org.finos.symphony.toolkit.json.EntityJson) HashTag(org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag) TagSupport(org.finos.symphony.toolkit.workflow.sources.symphony.TagSupport) Entry(java.util.Map.Entry) Optional(java.util.Optional) EntityJsonConverter(org.finos.symphony.toolkit.workflow.sources.symphony.json.EntityJsonConverter) MessageSearchQuery(com.symphony.api.model.MessageSearchQuery) V4MessageList(com.symphony.api.model.V4MessageList) MessageSearchQuery(com.symphony.api.model.MessageSearchQuery)

Example 2 with MessageSearchQuery

use of com.symphony.api.model.MessageSearchQuery in project spring-bot by finos.

the class SymphonyHistoryImpl method getEntityJsonFromHistory.

@Override
public <X> List<EntityJson> getEntityJsonFromHistory(Class<X> type, Addressable address, Instant since) {
    MessageSearchQuery msq = createMessageSearchQuery(type, address, since, null);
    V4MessageList out = messageApi.v1MessageSearchPost(msq, null, null, 0, 50, null, null);
    return out.stream().map(msg -> getEntityJson(msg)).filter(e -> e != null).collect(Collectors.toList());
}
Also used : Tag(org.finos.symphony.toolkit.workflow.content.Tag) UsersApi(com.symphony.api.pod.UsersApi) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) AbstractStreamResolving(org.finos.symphony.toolkit.workflow.sources.symphony.streams.AbstractStreamResolving) SymphonyApiProperties(org.finos.symphony.toolkit.spring.api.properties.SymphonyApiProperties) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) V4MessageList(com.symphony.api.model.V4MessageList) StreamsApi(com.symphony.api.pod.StreamsApi) SymphonyAddressable(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyAddressable) CashTag(org.finos.symphony.toolkit.workflow.sources.symphony.content.CashTag) MessagesApi(com.symphony.api.agent.MessagesApi) List(java.util.List) Addressable(org.finos.symphony.toolkit.workflow.content.Addressable) V4Message(com.symphony.api.model.V4Message) EntityJson(org.finos.symphony.toolkit.json.EntityJson) HashTag(org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag) TagSupport(org.finos.symphony.toolkit.workflow.sources.symphony.TagSupport) Entry(java.util.Map.Entry) Optional(java.util.Optional) EntityJsonConverter(org.finos.symphony.toolkit.workflow.sources.symphony.json.EntityJsonConverter) MessageSearchQuery(com.symphony.api.model.MessageSearchQuery) V4MessageList(com.symphony.api.model.V4MessageList) MessageSearchQuery(com.symphony.api.model.MessageSearchQuery)

Example 3 with MessageSearchQuery

use of com.symphony.api.model.MessageSearchQuery in project spring-bot by finos.

the class SymphonyHistoryImpl method getLastEntityJsonFromHistory.

@Override
public <X> Optional<EntityJson> getLastEntityJsonFromHistory(Class<X> type, Addressable address) {
    MessageSearchQuery msq = createMessageSearchQuery(type, address, null, null);
    V4MessageList out = messageApi.v1MessageSearchPost(msq, null, null, 0, 1, null, null);
    return convertToOptionalEntityJson(out);
}
Also used : V4MessageList(com.symphony.api.model.V4MessageList) MessageSearchQuery(com.symphony.api.model.MessageSearchQuery)

Example 4 with MessageSearchQuery

use of com.symphony.api.model.MessageSearchQuery in project spring-bot by finos.

the class SymphonyRoomSharedLog method performQuery.

protected List<Participant> performQuery(LogMessageType messageType, int count) {
    long since = System.currentTimeMillis() - participationIntervalMillis - ONE_HOUR;
    MessageSearchQuery msq = new MessageSearchQuery().hashtag(getHashTagId()).streamId(getStreamId()).fromDate(since).streamType("ROOM");
    return messagesApi.v1MessageSearchPost(msq, null, null, 0, count, null, null).stream().map(m -> readMessage(m)).filter(o -> o.isPresent()).map(o -> o.get()).filter(cm -> cm.messageType == messageType).map(cm -> cm.getParticipant()).distinct().collect(Collectors.toList());
}
Also used : MessagesApi(com.symphony.api.agent.MessagesApi) List(java.util.List) V4Event(com.symphony.api.model.V4Event) Optional(java.util.Optional) Participant(org.finos.symphony.toolkit.stream.Participant) Collectors(java.util.stream.Collectors) MessageSearchQuery(com.symphony.api.model.MessageSearchQuery) MessageSearchQuery(com.symphony.api.model.MessageSearchQuery)

Example 5 with MessageSearchQuery

use of com.symphony.api.model.MessageSearchQuery in project spring-bot by finos.

the class SymphonyHistoryImpl method getLastEntityJsonFromHistory.

@Override
public <X> Optional<EntityJson> getLastEntityJsonFromHistory(Class<X> type, Tag t, Addressable address) {
    MessageSearchQuery msq = createMessageSearchQuery(null, address, null, t);
    V4MessageList out = messageApi.v1MessageSearchPost(msq, null, null, 0, 1, null, null);
    return convertToOptionalEntityJson(out);
}
Also used : V4MessageList(com.symphony.api.model.V4MessageList) MessageSearchQuery(com.symphony.api.model.MessageSearchQuery)

Aggregations

MessageSearchQuery (com.symphony.api.model.MessageSearchQuery)6 V4MessageList (com.symphony.api.model.V4MessageList)5 List (java.util.List)4 MessagesApi (com.symphony.api.agent.MessagesApi)3 V4Message (com.symphony.api.model.V4Message)3 Instant (java.time.Instant)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 EntityJson (org.finos.symphony.toolkit.json.EntityJson)3 EntityJsonConverter (org.finos.symphony.toolkit.workflow.sources.symphony.json.EntityJsonConverter)3 StreamsApi (com.symphony.api.pod.StreamsApi)2 UsersApi (com.symphony.api.pod.UsersApi)2 Entry (java.util.Map.Entry)2 SymphonyApiProperties (org.finos.symphony.toolkit.spring.api.properties.SymphonyApiProperties)2 Addressable (org.finos.symphony.toolkit.workflow.content.Addressable)2 Tag (org.finos.symphony.toolkit.workflow.content.Tag)2 TagSupport (org.finos.symphony.toolkit.workflow.sources.symphony.TagSupport)2 CashTag (org.finos.symphony.toolkit.workflow.sources.symphony.content.CashTag)2 HashTag (org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag)2 SymphonyAddressable (org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyAddressable)2