Fix ALL the logging!
[Sone.git] / src / main / java / net / pterodactylus / sone / freenet / wot / DefaultOwnIdentity.java
index ab96756..be2a3e7 100644 (file)
@@ -57,6 +57,22 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
                this.insertUri = insertUri;
        }
 
+       /**
+        * Copy constructor for an own identity.
+        *
+        * @param webOfTrustConnector
+        *            The web of trust connector
+        * @param ownIdentity
+        *            The own identity to copy
+        */
+       public DefaultOwnIdentity(WebOfTrustConnector webOfTrustConnector, OwnIdentity ownIdentity) {
+               super(webOfTrustConnector, ownIdentity.getId(), ownIdentity.getNickname(), ownIdentity.getRequestUri());
+               this.webOfTrustConnector = webOfTrustConnector;
+               this.insertUri = ownIdentity.getInsertUri();
+               setContextsPrivate(ownIdentity.getContexts());
+               setPropertiesPrivate(ownIdentity.getProperties());
+       }
+
        //
        // ACCESSORS
        //
@@ -167,4 +183,26 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
                }
        }
 
+       //
+       // OBJECT METHODS
+       //
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public int hashCode() {
+               /* The hash of DefaultIdentity is fine. */
+               return super.hashCode();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public boolean equals(Object object) {
+               /* The ID of the superclass is still enough. */
+               return super.equals(object);
+       }
+
 }