/** Locked local Sones. */
/* synchronize on itself. */
- private final Set<Sone> lockedSones = new HashSet<Sone>();
+ private final Set<LocalSone> lockedSones = new HashSet<LocalSone>();
/** Sone inserters. */
/* synchronize access on this on sones. */
* The sone to check
* @return {@code true} if the Sone is locked, {@code false} if it is not
*/
- public boolean isLocked(Sone sone) {
+ public boolean isLocked(LocalSone sone) {
synchronized (lockedSones) {
return lockedSones.contains(sone);
}
/**
* Locks the given Sone. A locked Sone will not be inserted by
- * {@link SoneInserter} until it is {@link #unlockSone(Sone) unlocked}
+ * {@link SoneInserter} until it is {@link #unlockSone(LocalSone) unlocked}
* again.
*
* @param sone
* The sone to lock
*/
- public void lockSone(Sone sone) {
+ public void lockSone(LocalSone sone) {
synchronized (lockedSones) {
if (lockedSones.add(sone)) {
eventBus.post(new SoneLockedEvent(sone));
/**
* Unlocks the given Sone.
*
- * @see #lockSone(Sone)
+ * @see #lockSone(LocalSone)
* @param sone
* The sone to unlock
*/
- public void unlockSone(Sone sone) {
+ public void unlockSone(LocalSone sone) {
synchronized (lockedSones) {
if (lockedSones.remove(sone)) {
eventBus.post(new SoneUnlockedEvent(sone));
import net.pterodactylus.sone.core.event.SoneInsertedEvent;
import net.pterodactylus.sone.core.event.SoneInsertingEvent;
import net.pterodactylus.sone.data.Album;
+import net.pterodactylus.sone.data.LocalSone;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
this(core, eventBus, freenetInterface, soneId, new SoneModificationDetector(new LockableFingerprintProvider() {
@Override
public boolean isLocked() {
- final Optional<Sone> sone = core.getSone(soneId);
+ final Optional<LocalSone> sone = core.getLocalSone(soneId);
if (!sone.isPresent()) {
return false;
}
import java.util.logging.Logger;
import net.pterodactylus.sone.core.Core;
+import net.pterodactylus.sone.data.LocalSone;
import net.pterodactylus.sone.data.Profile;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.Sone.SoneStatus;
} else if (member.equals("new")) {
return !sone.isKnown();
} else if (member.equals("locked")) {
- return core.isLocked(sone);
+ return sone.isLocal() ? core.isLocked((LocalSone) sone) : false;
} else if (member.equals("lastUpdatedText")) {
return GetTimesAjaxPage.getTime((WebInterface) templateContext.get("webInterface"), sone.getTime());
} else if (member.equals("trust")) {
jsonSone.put("local", sone.getInsertUri() != null);
jsonSone.put("status", sone.getStatus().name());
jsonSone.put("modified", webInterface.getCore().isModifiedSone(sone));
- jsonSone.put("locked", webInterface.getCore().isLocked(sone));
+ jsonSone.put("locked", sone.isLocal() ? webInterface.getCore().isLocked((LocalSone) sone) : false);
jsonSone.put("lastUpdatedUnknown", sone.getTime() == 0);
synchronized (dateFormat) {
jsonSone.put("lastUpdated", dateFormat.format(new Date(sone.getTime())));