private void checkInteractionModel(final Triple triple, final Optional<String> resourceInteractionModel) { // check for interaction model change violation final String interactionModel = getInteractionModel.apply(triple); if (StringUtils.isNotBlank(interactionModel) && !interactionModel.equals(resourceInteractionModel.get())) { throw new InteractionModelViolationException("Changing the resource's interaction model from " + resourceInteractionModel.get() + " to " + interactionModel + " is not allowed!"); } }
@Override public Response toResponse(final InteractionModelViolationException e) { debugException(this, e, LOGGER); final Link link = buildConstraintLink(e, context, uriInfo); final String msg = e.getMessage(); return status(CONFLICT).entity(msg).links(link).type(TEXT_PLAIN_WITH_CHARSET).build(); }
final String interactionModel = getInteractionModel.apply(e.asTriple()); if (StringUtils.isNotBlank(interactionModel)) { throw new InteractionModelViolationException("Deleting the interaction model " + interactionModel + " is not allowed!");
private FedoraResource createFedoraResource(final String path, final String interactionModel, final MediaType contentType, final boolean contentPresent, final boolean contentExternal) { final MediaType simpleContentType = contentPresent ? getSimpleContentType(contentType) : null; final FedoraResource result; if ("ldp:NonRDFSource".equals(interactionModel) || contentExternal || (contentPresent && interactionModel == null && !isRDF(simpleContentType))) { result = binaryService.findOrCreate(session.getFedoraSession(), path); } else { result = containerService.findOrCreate(session.getFedoraSession(), path); } final String resInteractionModel = getInteractionModel(result); if (StringUtils.isNoneBlank(interactionModel) && StringUtils.isNoneBlank(resInteractionModel) && !resInteractionModel.equals(interactionModel)) { throw new InteractionModelViolationException("Changing the interaction model " + resInteractionModel + " to " + interactionModel + " is not allowed!"); } return result; }
if (StringUtils.isNoneBlank(interactionModel) && StringUtils.isNoneBlank(resInteractionModel) && !resInteractionModel.equals(interactionModel)) { throw new InteractionModelViolationException("Changing the interaction model " + resInteractionModel + " to " + interactionModel + " is not allowed!");