Add methods to set and remove trust for identities.
[Sone.git] / src / main / java / net / pterodactylus / sone / freenet / wot / DefaultOwnIdentity.java
index f89ddda..3af8b38 100644 (file)
@@ -21,6 +21,8 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import net.pterodactylus.util.validation.Validation;
+
 /**
  * An own identity is an identity that the owner of the node has full control
  * over.
@@ -135,4 +137,22 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
                }
        }
 
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public void setTrust(Identity target, int trustValue, String comment) throws WebOfTrustException {
+               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);
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public void removeTrust(Identity target) throws WebOfTrustException {
+               Validation.begin().isNotNull("Trust Target", target).check();
+               webOfTrustConnector.removeTrust(this, target);
+       }
+
 }