Search in sources :

Example 1 with NodeMapper

use of com.enonic.xp.lib.node.mapper.NodeMapper in project xp by enonic.

the class ModifyNodeHandler method execute.

@Override
public Object execute() {
    final Node node = getExistingNode();
    final ScriptValue updatedNodeScriptValue = applyEditor(node);
    final BinaryAttachments binaryAttachments = getBinaryAttachments(updatedNodeScriptValue);
    final UpdateNodeParams updateNodeParams = UpdateNodeParams.create().id(node.id()).editor(createEditor(updatedNodeScriptValue)).setBinaryAttachments(binaryAttachments).build();
    final Node updatedNode = this.nodeService.update(updateNodeParams);
    return new NodeMapper(updatedNode, false);
}
Also used : ScriptValue(com.enonic.xp.script.ScriptValue) BinaryAttachments(com.enonic.xp.node.BinaryAttachments) Node(com.enonic.xp.node.Node) EditableNode(com.enonic.xp.node.EditableNode) UpdateNodeParams(com.enonic.xp.node.UpdateNodeParams) NodeMapper(com.enonic.xp.lib.node.mapper.NodeMapper)

Example 2 with NodeMapper

use of com.enonic.xp.lib.node.mapper.NodeMapper 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);
}
Also used : ScriptValueTranslatorResult(com.enonic.xp.lib.value.ScriptValueTranslatorResult) Node(com.enonic.xp.node.Node) NodeMapper(com.enonic.xp.lib.node.mapper.NodeMapper) CreateNodeParams(com.enonic.xp.node.CreateNodeParams)

Aggregations

NodeMapper (com.enonic.xp.lib.node.mapper.NodeMapper)2 Node (com.enonic.xp.node.Node)2 ScriptValueTranslatorResult (com.enonic.xp.lib.value.ScriptValueTranslatorResult)1 BinaryAttachments (com.enonic.xp.node.BinaryAttachments)1 CreateNodeParams (com.enonic.xp.node.CreateNodeParams)1 EditableNode (com.enonic.xp.node.EditableNode)1 UpdateNodeParams (com.enonic.xp.node.UpdateNodeParams)1 ScriptValue (com.enonic.xp.script.ScriptValue)1