use of won.protocol.model.unread.UnreadMessageInfoForAtom in project webofneeds by researchstudio-sat.
the class LinkedDataServiceImpl method getUnreadInformationForAtom.
@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, readOnly = true)
public Model getUnreadInformationForAtom(URI atomURI, Collection<URI> lastSeenMessageURIs) {
UnreadMessageInfoForAtom unreadInfo = this.unreadInformationService.getUnreadInformation(atomURI, lastSeenMessageURIs);
Model ret = ModelFactory.createDefaultModel();
Resource atomRes = ret.createResource(atomURI.toString());
addUnreadInfoWithProperty(ret, atomRes, WON.unreadSuggested, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.SUGGESTED));
addUnreadInfoWithProperty(ret, atomRes, WON.unreadConnected, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.CONNECTED));
addUnreadInfoWithProperty(ret, atomRes, WON.unreadRequestSent, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.REQUEST_SENT));
addUnreadInfoWithProperty(ret, atomRes, WON.unreadRequestReceived, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.REQUEST_RECEIVED));
addUnreadInfoWithProperty(ret, atomRes, WON.unreadClosed, unreadInfo.getUnreadInfoByConnectionState().get(ConnectionState.CLOSED));
unreadInfo.getUnreadMessageInfoForConnections().forEach(info -> {
Resource connRes = ret.createResource(info.getConnectionURI().toString());
addUnreadInfoWithProperty(ret, connRes, null, info.getUnreadInformation());
});
return ret;
}
use of won.protocol.model.unread.UnreadMessageInfoForAtom in project webofneeds by researchstudio-sat.
the class UnreadInformationService method getUnreadInformation.
public UnreadMessageInfoForAtom getUnreadInformation(URI atomURI, Collection<URI> lastSeenMessageURIs) {
List<UnreadMessageInfoForConnection> unreadInfoForConnections = messageEventRepository.getUnreadInfoForAtom(atomURI, lastSeenMessageURIs);
UnreadMessageInfoForAtom result = new UnreadMessageInfoForAtom(atomURI);
unreadInfoForConnections.forEach(result::addUnreadMessageInfoForConnection);
return result;
}
Aggregations