use of won.protocol.model.unread.UnreadMessageInfoForNeed in project webofneeds by researchstudio-sat.
the class LinkedDataServiceImpl method getUnreadInformationForNeed.
@Override
@Transactional
public Model getUnreadInformationForNeed(URI needURI, Collection<URI> lastSeenMessageURIs) {
UnreadMessageInfoForNeed unreadInfo = this.unreadInformationService.getUnreadInformation(needURI, lastSeenMessageURIs);
Model ret = ModelFactory.createDefaultModel();
Resource needRes = ret.createResource(needURI.toString());
addUnreadInfoWithProperty(ret, needRes, WON.HAS_UNREAD_SUGGESTED, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.SUGGESTED));
addUnreadInfoWithProperty(ret, needRes, WON.HAS_UNREAD_CONNECTED, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.CONNECTED));
addUnreadInfoWithProperty(ret, needRes, WON.HAS_UNREAD_REQUEST_SENT, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.REQUEST_SENT));
addUnreadInfoWithProperty(ret, needRes, WON.HAS_UNREAD_REQUEST_RECEIVED, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.REQUEST_RECEIVED));
addUnreadInfoWithProperty(ret, needRes, WON.HAS_UNREAD_CLOSED, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.CLOSED));
unreadInfo.getUnreadMessageInfoForConnections().forEach(info -> {
Resource connRes = ret.createResource(info.getConnectionURI().toString());
addUnreadInfoWithProperty(ret, connRes, null, info.getUnreadInformation());
});
return ret;
}
Aggregations