X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fwot%2FDefaultOwnIdentity.java;h=6acdd70045d772b515fe472077b9cc8bbfeab7bf;hb=efb1006429e52a74f41fb6e1d7736736156bb13a;hp=ab46b43d1bcbf275af7026c7fa14621487b6d364;hpb=a23c4f218c3adf236d89d5927cae37d6e6e4feda;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/DefaultOwnIdentity.java b/src/main/java/net/pterodactylus/sone/freenet/wot/DefaultOwnIdentity.java index ab46b43..6acdd70 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/DefaultOwnIdentity.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/DefaultOwnIdentity.java @@ -1,5 +1,5 @@ /* - * Sone - DefaultOwnIdentity.java - Copyright © 2010 David Roden + * Sone - DefaultOwnIdentity.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 @@ -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 // @@ -151,7 +167,7 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity { Validation.begin().isNotNull("Trust Target", target).isNotNull("Trust Comment", comment).isLessOrEqual("Trust Value", trustValue, 100).isGreaterOrEqual("Trust Value", trustValue, -100).check(); webOfTrustConnector.setTrust(this, target, trustValue, comment); if (target instanceof DefaultIdentity) { - ((DefaultIdentity) target).setTrustPrivate(this, new Trust(trustValue, trustValue, 0)); + ((DefaultIdentity) target).setTrust(this, new Trust(trustValue, trustValue, 0)); } } @@ -163,7 +179,7 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity { Validation.begin().isNotNull("Trust Target", target).check(); webOfTrustConnector.removeTrust(this, target); if (target instanceof DefaultIdentity) { - ((DefaultIdentity) target).setTrustPrivate(this, new Trust(null, null, null)); + ((DefaultIdentity) target).setTrust(this, new Trust(null, null, null)); } }