private void checkNeedURI(final WonMessage message) { if (message.getMessageType() == WonMessageType.CREATE_NEED) { URI needURI = WonRdfUtils.NeedUtils.getNeedURI(message.getCompleteDataset()); Need need = needRepository.findOneByNeedURI(needURI); if (need == null) { return; } else { throw new UriAlreadyInUseException(message.getSenderNeedURI().toString()); } } return; }
private void checkEventURI(final WonMessage message) { MessageEventPlaceholder event = messageEventRepository.findOneByMessageURI(message.getMessageURI()); if (event == null) { return; } else { if (hasResponse(event) && isDuplicateMessage(message, event)) { // the same massage as the one already processed is received throw new EventAlreadyProcessedException(message.getMessageURI().toString()); } else { throw new UriAlreadyInUseException(message.getMessageURI().toString()); } } }
needEventContainer = new NeedEventContainer(need, need.getNeedURI()); } else { throw new UriAlreadyInUseException("Found a NeedEventContainer for the need we're about to create (" + needURI + ") - aborting");