- /**
- * {@inheritDoc}
- */
- @Override
- public void addContext(String context) throws WebOfTrustException {
- webOfTrustConnector.addContext(this, context);
- addContextPrivate(context);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeContext(String context) throws WebOfTrustException {
- webOfTrustConnector.removeContext(this, context);
- removeContextPrivate(context);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setContexts(Set<String> contexts) throws WebOfTrustException {
- for (String context : getContexts()) {
- if (!contexts.contains(context)) {
- webOfTrustConnector.removeContext(this, context);
- }
- }
- for (String context : contexts) {
- if (!getContexts().contains(context)) {
- webOfTrustConnector.addContext(this, context);
- }
- }
- setContextsPrivate(contexts);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setProperty(String name, String value) throws WebOfTrustException {
- webOfTrustConnector.setProperty(this, name, value);
- setPropertyPrivate(name, value);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeProperty(String name) throws WebOfTrustException {
- webOfTrustConnector.removeProperty(this, name);
- removePropertyPrivate(name);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setProperties(Map<String, String> properties) throws WebOfTrustException {
- for (Entry<String, String> oldProperty : getProperties().entrySet()) {
- if (!properties.containsKey(oldProperty.getKey())) {
- webOfTrustConnector.removeProperty(this, oldProperty.getKey());
- } else {
- webOfTrustConnector.setProperty(this, oldProperty.getKey(), properties.get(oldProperty.getKey()));
- }
- }
- for (Entry<String, String> newProperty : properties.entrySet()) {
- if (!getProperties().containsKey(newProperty.getKey())) {
- webOfTrustConnector.setProperty(this, newProperty.getKey(), newProperty.getValue());
- }
- }
- setPropertiesPrivate(properties);
- }
-
- /**
- * {@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);
- if (target instanceof DefaultIdentity) {
- ((DefaultIdentity) target).setTrustPrivate(this, new Trust(trustValue, trustValue, 0));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- 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));
- }
- }
-