Search in sources :

Example 1 with UriAlreadyInUseException

use of won.protocol.exception.UriAlreadyInUseException in project webofneeds by researchstudio-sat.

the class UriAlreadyUsedCheckingWonMessageProcessor method checkAtomURI.

private void checkAtomURI(final WonMessage message) {
    if (message.getMessageType() == WonMessageType.CREATE_ATOM) {
        URI atomURI = WonRdfUtils.AtomUtils.getAtomURI(message.getCompleteDataset());
        Optional<Atom> atom = atomService.getAtom(atomURI);
        if (!atom.isPresent()) {
            return;
        } else {
            throw new UriAlreadyInUseException(message.getSenderAtomURI().toString());
        }
    }
    return;
}
Also used : UriAlreadyInUseException(won.protocol.exception.UriAlreadyInUseException) URI(java.net.URI) Atom(won.protocol.model.Atom)

Aggregations

URI (java.net.URI)1 UriAlreadyInUseException (won.protocol.exception.UriAlreadyInUseException)1 Atom (won.protocol.model.Atom)1