use of com.enonic.xp.lib.value.ScriptValueTranslatorResult 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.ScriptValueTranslatorResult in project xp by enonic.
the class CreateNodeParamsFactoryTest method createWithStringProperty.
private CreateNodeParams createWithStringProperty(final String nodeName, final String myNode) {
final PropertyTree properties = new PropertyTree();
properties.setString(nodeName, myNode);
return new CreateNodeParamsFactory().create(new ScriptValueTranslatorResult(properties, BinaryAttachments.empty()));
}
use of com.enonic.xp.lib.value.ScriptValueTranslatorResult 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.ScriptValueTranslatorResult 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.ScriptValueTranslatorResult in project xp by enonic.
the class CreateNodeHandler method execute.
@Override
public Object execute() {
final ScriptValueTranslatorResult params = getParams(this.params);
final CreateNodeParams createNodeParams = new CreateNodeParamsFactory().create(params);
final Node node = this.nodeService.create(createNodeParams);
return new NodeMapper(node);
}
Aggregations