import java.util.List;
import javax.annotation.Nonnull;
-import net.pterodactylus.sone.database.AlbumBuilderFactory;
+import net.pterodactylus.sone.database.AlbumBuilder;
import net.pterodactylus.sone.database.ImageBuilder;
import com.google.common.base.Function;
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
-public interface Album extends Identified, Fingerprintable, AlbumBuilderFactory {
+public interface Album extends Identified, Fingerprintable {
/** Compares two {@link Album}s by {@link #getTitle()}. */
Comparator<Album> TITLE_COMPARATOR = new Comparator<Album>() {
*/
String getDescription();
+ AlbumBuilder newAlbumBuilder() throws IllegalStateException;
+
ImageBuilder newImageBuilder() throws IllegalStateException;
/**
import java.util.Set;
import net.pterodactylus.sone.core.Options;
-import net.pterodactylus.sone.database.AlbumBuilderFactory;
+import net.pterodactylus.sone.database.AlbumBuilder;
import net.pterodactylus.sone.database.PostBuilder;
import net.pterodactylus.sone.database.PostBuilderFactory;
import net.pterodactylus.sone.freenet.wot.Identity;
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
-public interface Sone extends Identified, Fingerprintable, PostBuilderFactory, AlbumBuilderFactory, Comparable<Sone> {
+public interface Sone extends Identified, Fingerprintable, PostBuilderFactory, Comparable<Sone> {
/**
* Enumeration for the possible states of a {@link Sone}.
/* TODO - remove this method again, maybe add an option provider */
void setOptions(Options options);
+ AlbumBuilder newAlbumBuilder() throws IllegalStateException;
+
PostBuilder newPostBuilder();
}
+++ /dev/null
-/*
- * Sone - AlbumBuilderFactory.java - Copyright © 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package net.pterodactylus.sone.database;
-
-/**
- * Factory for {@link AlbumBuilder}s.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
- */
-public interface AlbumBuilderFactory {
-
- /**
- * Creates a new album builder.
- *
- * @return A new album builder
- */
- AlbumBuilder newAlbumBuilder();
-
-}
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Sone;
-import net.pterodactylus.sone.database.AlbumBuilderFactory;
+import net.pterodactylus.sone.database.AlbumBuilder;
import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
private Album createAlbum(FreenetRequest request, String name) {
Sone currentSone = getCurrentSone(request.getToadletContext());
String parentId = request.getHttpRequest().getPartAsStringFailsafe("parent", 36);
- AlbumBuilderFactory parent = parentId.equals("") ? currentSone : webInterface.getCore().getAlbum(parentId).get();
- Album album = parent.newAlbumBuilder().build();
+ AlbumBuilder albumBuilder = parentId.equals("") ? currentSone.newAlbumBuilder() : webInterface.getCore().getAlbum(parentId).get().newAlbumBuilder();
+ Album album = albumBuilder.build();
return setTitleAndDescription(request, name, album);
}