use of com.enonic.xp.node.NodeEditor in project xp by enonic.
the class UpdateNodeParamsFactory method produce.
public UpdateNodeParams produce() {
final Content editedContent = params.getEditedContent();
final CreateAttachments createAttachments = params.getCreateAttachments();
final NodeEditor nodeEditor = toNodeEditor(params);
final UpdateNodeParams.Builder builder = UpdateNodeParams.create().id(NodeId.from(editedContent.getId())).editor(nodeEditor);
if (createAttachments != null) {
for (final CreateAttachment createAttachment : createAttachments) {
builder.attachBinary(createAttachment.getBinaryReference(), createAttachment.getByteSource());
}
}
return builder.build();
}
use of com.enonic.xp.node.NodeEditor in project xp by enonic.
the class UpdateNodeParamsFactory method toNodeEditor.
private NodeEditor toNodeEditor(final UpdateContentTranslatorParams params) {
final Content content = params.getEditedContent();
final PropertyTree nodeData = contentDataSerializer.toUpdateNodeData(params);
final ContentIndexConfigFactory indexConfigFactory = ContentIndexConfigFactory.create().contentTypeService(contentTypeService).pageDescriptorService(pageDescriptorService).partDescriptorService(partDescriptorService).layoutDescriptorService(layoutDescriptorService).siteService(this.siteService).xDataService(this.xDataService).contentTypeName(content.getType()).page(content.getPage()).siteConfigs(content.isSite() ? ((Site) content).getSiteConfigs() : null).extraDatas(content.getAllExtraData()).language(content.getLanguage() != null ? content.getLanguage().getLanguage() : null).build();
return editableNode -> {
editableNode.indexConfigDocument = indexConfigFactory.produce();
editableNode.data = nodeData;
editableNode.manualOrderValue = content.getManualOrderValue();
editableNode.permissions = content.getPermissions();
editableNode.inheritPermissions = content.inheritsPermissions();
};
}
use of com.enonic.xp.node.NodeEditor in project xp by enonic.
the class ModifyNodeHandlerTest method getEditedNode.
private EditableNode getEditedNode(final Node node) {
final NodeEditor editor = updateCaptor.getValue().getEditor();
assertNotNull(editor);
final EditableNode editableNode = new EditableNode(node);
editor.edit(editableNode);
return editableNode;
}
Aggregations