/*
- * Sone - LockSonePage.java - Copyright © 2010–2012 David Roden
+ * Sone - LockSonePage.java - Copyright © 2010–2013 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
+import com.google.common.base.Optional;
+
/**
* This page lets the user lock a {@link Sone} to prevent it from being
* inserted.
// TEMPLATEPAGE METHODS
//
- /**
- * {@inheritDoc}
- */
@Override
protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
super.processTemplate(request, templateContext);
String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone", 44);
- Sone sone = webInterface.getCore().getLocalSone(soneId, false);
- if (sone != null) {
- webInterface.getCore().lockSone(sone);
+ Optional<Sone> sone = webInterface.getCore().getLocalSone(soneId);
+ if (sone.isPresent()) {
+ webInterface.getCore().lockSone(sone.get());
}
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
throw new RedirectException(returnPage);