use of org.structr.core.property.FunctionProperty in project structr by structr.
the class AbstractNode method setProperties.
@Override
public void setProperties(final SecurityContext securityContext, final PropertyMap properties) throws FrameworkException {
if (!isGranted(Permission.write, securityContext)) {
internalSystemPropertiesUnlocked = false;
readOnlyPropertiesUnlocked = false;
throw new FrameworkException(403, "Modification not permitted.");
}
for (final PropertyKey key : properties.keySet()) {
final Object value = properties.get(key);
final Object oldValue = getProperty(key);
// no old value exists OR old value exists and is NOT equal => set property
if (((oldValue == null) && (value != null)) || ((oldValue != null) && (!oldValue.equals(value)) || (key instanceof FunctionProperty))) {
if (!key.equals(GraphObject.id)) {
// check for system properties
if (key.isSystemInternal() && !internalSystemPropertiesUnlocked) {
throw new FrameworkException(422, "Property " + key.jsonName() + " is an internal system property", new InternalSystemPropertyToken(getClass().getSimpleName(), key));
}
// check for read-only properties
if ((key.isReadOnly() || key.isWriteOnce()) && !readOnlyPropertiesUnlocked && !securityContext.isSuperUser()) {
throw new FrameworkException(422, "Property " + key.jsonName() + " is read-only", new ReadOnlyPropertyToken(getClass().getSimpleName(), key));
}
}
}
}
NodeInterface.super.setProperties(securityContext, properties);
}
Aggregations