Change all copyright headers to include 2012.
[Sone.git] / src / main / java / net / pterodactylus / sone / template / IdentityAccessor.java
index 4ea956d..4602188 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - IdentityAccessor.java - Copyright © 2010 David Roden
+ * Sone - IdentityAccessor.java - Copyright © 2010–2012 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
 
 package net.pterodactylus.sone.template;
 
-import java.util.Collections;
 import java.util.Set;
 
 import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.freenet.wot.Identity;
 import net.pterodactylus.sone.freenet.wot.OwnIdentity;
-import net.pterodactylus.sone.freenet.wot.PluginException;
 import net.pterodactylus.util.template.Accessor;
-import net.pterodactylus.util.template.DataProvider;
 import net.pterodactylus.util.template.ReflectionAccessor;
+import net.pterodactylus.util.template.TemplateContext;
 
 /**
  * {@link Accessor} implementation that adds a “uniqueNickname” member to an
@@ -53,17 +51,13 @@ public class IdentityAccessor extends ReflectionAccessor {
         * {@inheritDoc}
         */
        @Override
-       public Object get(DataProvider dataProvider, Object object, String member) {
+       public Object get(TemplateContext templateContext, Object object, String member) {
                Identity identity = (Identity) object;
                if ("uniqueNickname".equals(member)) {
                        int minLength = -1;
                        boolean found = false;
                        Set<OwnIdentity> ownIdentities = null;
-                       try {
-                               ownIdentities = core.getWebOfTrustConnector().loadAllOwnIdentities();
-                       } catch (PluginException e) {
-                               ownIdentities = Collections.emptySet();
-                       }
+                       ownIdentities = core.getIdentityManager().getAllOwnIdentities();
                        do {
                                boolean unique = true;
                                String abbreviatedWantedNickname = getAbbreviatedNickname(identity, ++minLength);
@@ -81,7 +75,7 @@ public class IdentityAccessor extends ReflectionAccessor {
                        } while (!found && (minLength < 43));
                        return getAbbreviatedNickname(identity, minLength);
                }
-               return super.get(dataProvider, object, member);
+               return super.get(templateContext, object, member);
        }
 
        //