use of com.enonic.xp.lib.value.ScriptValueTranslator in project xp by enonic.
the class ModifyProfileHandler method updateUser.
private void updateUser(final EditableUser target, final ScriptValue value) {
if (value == null) {
if (scope != null) {
target.profile.removeProperty(scope);
}
return;
}
final ScriptValueTranslatorResult scriptValueTranslatorResult = new ScriptValueTranslator(false).create(value);
final PropertyTree propertyTree = scriptValueTranslatorResult.getPropertyTree();
if (this.scope == null) {
target.profile = propertyTree;
} else {
target.profile.setSet(scope, propertyTree.getRoot());
}
}
use of com.enonic.xp.lib.value.ScriptValueTranslator in project xp by enonic.
the class ModifyRepositoryHandler method updateRepositoryData.
private void updateRepositoryData(final EditableRepository target, final ScriptValue value) {
if (value == null) {
if (scope != null) {
target.data.removeProperty(scope);
}
} else {
final ScriptValueTranslatorResult scriptValueTranslatorResult = new ScriptValueTranslator().create(value);
target.binaryAttachments = ImmutableList.copyOf(scriptValueTranslatorResult.getBinaryAttachments());
final PropertyTree propertyTree = scriptValueTranslatorResult.getPropertyTree();
if (scope == null) {
target.data = propertyTree;
} else {
target.data.setSet(scope, propertyTree.getRoot());
}
}
}
use of com.enonic.xp.lib.value.ScriptValueTranslator in project xp by enonic.
the class NodeHandler method setRootPermissions.
@SuppressWarnings("unused")
public Object setRootPermissions(final ScriptValue value) {
final ScriptValueTranslatorResult translatorResult = new ScriptValueTranslator(false).create(value);
final PropertyTree asPropertyTree = translatorResult.getPropertyTree();
final Iterable<PropertySet> asPropertySets = asPropertyTree.getSets("_permissions");
final boolean inheritPermissions = asPropertyTree.getBoolean("_inheritsPermissions") != null ? asPropertyTree.getBoolean("_inheritsPermissions") : true;
if (asPropertySets == null) {
throw new IllegalArgumentException("Did not find parameter [_permissions]");
}
final AccessControlList permissions = new PermissionsFactory(asPropertySets).create();
return execute(SetRootPermissionsHandler.create().permissions(permissions).inheritPermissions(inheritPermissions).nodeService(this.nodeService).build());
}
use of com.enonic.xp.lib.value.ScriptValueTranslator in project xp by enonic.
the class ModifyNodeHandler method updateNode.
private void updateNode(final EditableNode target, final ScriptValue scriptValue) {
final ScriptValueTranslatorResult scriptValueTranslatorResult = new ScriptValueTranslator(false).create(scriptValue);
final PropertyTree nodeAsPropertyTree = scriptValueTranslatorResult.getPropertyTree();
ModifyNodeExecutor.create().editableNode(target).propertyTree(nodeAsPropertyTree).build().execute();
}
Aggregations