Search in sources :

Example 1 with UnreadMessageInfoForNeed

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;
}
Also used : Model(org.apache.jena.rdf.model.Model) Resource(org.apache.jena.rdf.model.Resource) UnreadMessageInfoForNeed(won.protocol.model.unread.UnreadMessageInfoForNeed) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Model (org.apache.jena.rdf.model.Model)1 Resource (org.apache.jena.rdf.model.Resource)1 Transactional (org.springframework.transaction.annotation.Transactional)1 UnreadMessageInfoForNeed (won.protocol.model.unread.UnreadMessageInfoForNeed)1