use of won.protocol.util.NeedModelWrapper in project webofneeds by researchstudio-sat.
the class GroupCycleBot method createNeedDataset.
private Dataset createNeedDataset(String title, String description) {
URI needURI = getEventListenerContext().getWonNodeInformationService().generateNeedURI();
NeedModelWrapper needModelWrapper = new NeedModelWrapper(needURI.toString());
needModelWrapper.setContentPropertyStringValue(NeedContentPropertyType.IS, DC.title, title);
needModelWrapper.setContentPropertyStringValue(NeedContentPropertyType.IS, DC.description, description);
return needModelWrapper.copyDataset();
}
use of won.protocol.util.NeedModelWrapper in project webofneeds by researchstudio-sat.
the class LinkedDataCacheInvalidator method process.
@Override
public WonMessage process(final WonMessage message) throws WonMessageProcessingException {
WonMessageType type = message.getMessageType();
if (type == WonMessageType.SUCCESS_RESPONSE) {
type = message.getIsResponseToMessageType();
}
URI webId = message.getReceiverNeedURI();
if (message.getReceiverURI() != null) {
// the cached list of events of the receiver need for the involved connection
// should be invalidated, since one more
// message was created
logger.debug("invalidating events list for need " + message.getReceiverNeedURI() + " for connection " + message.getReceiverURI());
URI eventContainerUri = WonLinkedDataUtils.getEventContainerURIforConnectionURI(message.getReceiverURI(), linkedDataSource);
invalidate(eventContainerUri, webId);
if (type.causesConnectionStateChange()) {
invalidate(message.getReceiverURI(), webId);
}
}
if (type.causesNewConnection()) {
// the list of connections of the receiver need should be invalidated, since
// these type
// of messages mean that the new connection has been created recently
logger.debug("invalidating connections list for need " + message.getReceiverNeedURI());
Dataset need = linkedDataSource.getDataForResource(message.getReceiverNeedURI());
NeedModelWrapper wrapper = new NeedModelWrapper(need);
URI connectionsListUri = URI.create(wrapper.getConnectionContainerUri());
invalidate(connectionsListUri, webId);
}
if (type.causesNeedStateChange()) {
invalidate(message.getReceiverNeedURI(), webId);
}
return message;
}
Aggregations