Merge branch 'release-0.4'
[Sone.git] / src / main / java / net / pterodactylus / sone / freenet / wot / DefaultOwnIdentity.java
index 3af8b38..ab96756 100644 (file)
@@ -75,6 +75,7 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
        @Override
        public void addContext(String context) throws WebOfTrustException {
                webOfTrustConnector.addContext(this, context);
+               addContextPrivate(context);
        }
 
        /**
@@ -83,6 +84,7 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
        @Override
        public void removeContext(String context) throws WebOfTrustException {
                webOfTrustConnector.removeContext(this, context);
+               removeContextPrivate(context);
        }
 
        /**
@@ -100,6 +102,7 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
                                webOfTrustConnector.addContext(this, context);
                        }
                }
+               setContextsPrivate(contexts);
        }
 
        /**
@@ -108,6 +111,7 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
        @Override
        public void setProperty(String name, String value) throws WebOfTrustException {
                webOfTrustConnector.setProperty(this, name, value);
+               setPropertyPrivate(name, value);
        }
 
        /**
@@ -116,6 +120,7 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
        @Override
        public void removeProperty(String name) throws WebOfTrustException {
                webOfTrustConnector.removeProperty(this, name);
+               removePropertyPrivate(name);
        }
 
        /**
@@ -135,6 +140,7 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
                                webOfTrustConnector.setProperty(this, newProperty.getKey(), newProperty.getValue());
                        }
                }
+               setPropertiesPrivate(properties);
        }
 
        /**
@@ -144,6 +150,9 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
        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);
+               if (target instanceof DefaultIdentity) {
+                       ((DefaultIdentity) target).setTrustPrivate(this, new Trust(trustValue, trustValue, 0));
+               }
        }
 
        /**
@@ -153,6 +162,9 @@ public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
        public void removeTrust(Identity target) throws WebOfTrustException {
                Validation.begin().isNotNull("Trust Target", target).check();
                webOfTrustConnector.removeTrust(this, target);
+               if (target instanceof DefaultIdentity) {
+                       ((DefaultIdentity) target).setTrustPrivate(this, new Trust(null, null, null));
+               }
        }
 
 }