Search in sources :

Example 1 with HiddenFileEntry

use of org.structr.files.ssh.filesystem.StructrPath.HiddenFileEntry in project structr by structr.

the class StructrPropertyValueChannel method setConvertedPropertyValue.

public static void setConvertedPropertyValue(final SecurityContext securityContext, final GraphObject graphObject, final PropertyKey key, final String value) throws IOException, FrameworkException {
    final PropertyConverter converter = key.inputConverter(securityContext);
    final String previousUuid = graphObject.getUuid();
    Object actualValue = value;
    if (converter != null) {
        actualValue = converter.convert(actualValue);
    }
    if (key.isReadOnly()) {
        graphObject.unlockReadOnlyPropertiesOnce();
    }
    if (key.isSystemInternal()) {
        graphObject.unlockSystemPropertiesOnce();
    }
    // set value
    graphObject.setProperty(key, actualValue);
    // move "hidden" entries to new UUID
    if (GraphObject.id.equals(key)) {
        final HiddenFileEntry entry = StructrPath.HIDDEN_PROPERTY_FILES.get(previousUuid);
        if (entry != null) {
            StructrPath.HIDDEN_PROPERTY_FILES.remove(previousUuid);
            StructrPath.HIDDEN_PROPERTY_FILES.put(value, entry);
        }
    }
}
Also used : PropertyConverter(org.structr.core.converter.PropertyConverter) GraphObject(org.structr.core.GraphObject) HiddenFileEntry(org.structr.files.ssh.filesystem.StructrPath.HiddenFileEntry)

Aggregations

GraphObject (org.structr.core.GraphObject)1 PropertyConverter (org.structr.core.converter.PropertyConverter)1 HiddenFileEntry (org.structr.files.ssh.filesystem.StructrPath.HiddenFileEntry)1