/**
* This file is auto generated from JavaDoc. Do not modify it manually.
*/
import type { Node } from "../../types/javax/jcr/Node";
import type { Map } from "../../types/java/util/Map";
import type { String } from "../../types/java/lang/String";
/**
* File utility interface that handles nodes with primary node type sv:file and sv:temporaryFile.
*
*
* Note! This interface is used to create files. You would typically use * {@link senselogic.sitevision.api.webresource.structure.StructureUtil} to move a file * and {@link senselogic.sitevision.api.webresource.structure.TrashcanUtil} to delete a file. * To check MIME/Content-Type for a file you would typically use {@link senselogic.sitevision.api.webresource.mime.MimeTypeUtil}. *
* *
* An instance of the Sitevision class implementing this interface can be obtained via {@link senselogic.sitevision.api.Utils#getFileUtil()}.
* See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface.
*
* Adds several files to a sv:localFileRepository, sv:fileRepository, sv:personalFileRepository or a sv:folder * residing as sub node to a file repository. *
** Files are specified by a map where the keys denotes the file names (will correspond to the property fileName * of the sv:file nodes) and the values denotes the URIs pointing to the file resources. The file resources * (i.e. the URIs) must be accessible from the Sitevision server. Sitevision opens a stream with the URI value * when creating/uploading the binary content of the file. If a firewall or such blocks outgoing communication * from the server - file creation will fail. *
** Permission note! Current user must be authorized to alter the parent node * (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
** A warning will be written to the system log if Sitevision for any reason is unable to create one of the files. *
* @param aParent the parent node for the files * @param aFileMappings a map of file name to URI pairs * @throws java.lang.NullPointerException ifaParent or aFileMappings is null
* @throws ConstraintViolationException if the user is not authorized to alter the parent node, if an invalid
parent node is specified or if file exceeds file size limit
* @throws RepositoryException if something else goes wrong
*/
createFiles(aParent: Node, aFileMappings: Map | {}): void;
/**
* Creates a file using a uri string.
*
*
* Note that the aParent of the file must be a sv:localFileRepository, sv:fileRepository,
* sv:personalFileRepository or a sv:folder residing as sub node to a file repository.
*
* Permission note! Current user must be authorized to alter the parent node * (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
*
* URI note! The file resource must be accessible from the Sitevision server! Sitevision opens
* a stream to an URL with the aUri value when creating/uploading the binary content of the file.
* If a firewall or such blocks outgoing communication from the server - file creation will fail.
*
null
* @throws java.lang.NullPointerException if aParent, aFileName or aUri is null
* @throws ConstraintViolationException if the user is not authorized to alter the parent node, if an invalid
parent node is specified or if file exceeds file size limit
* @throws RepositoryException if something else goes wrong
*/
createFile(
aParent: Node,
aFileName: String | string,
aUri: String | string
): Node;
/**
* Creates a file using a base64 string.
*
* * The base64 decoder uses "The Base64 Alphabet" as specified in Table 1 of RFC 4648 and RFC 2045 for decoding operation. * The decoder rejects data that contains characters outside the base64 alphabet. *
*
* Note that the aParent of the file must be a sv:localFileRepository, sv:fileRepository,
* sv:personalFileRepository or a sv:folder residing as sub node to a file repository.
*
* Permission note! Current user must be authorized to alter the parent node * (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
* @param aParent the parent node of the file * @param aFileName the filename * @param aBase64EncodedString a base64 encoded string * @return a sv:file node corresponding to the newly created file. Will never returnnull
* @throws java.lang.NullPointerException if aParent, aFileName or aBase64EncodedString is null
* @throws ConstraintViolationException if the user is not authorized to alter the parent node, if an invalid parent node is specified, if
aBase64EncodedString is not base64 encoded or if file exceeds file size limit
* @throws RepositoryException if something else goes wrong
* @since Sitevision 4.5.4
*/
createFileFromBase64(
aParent: Node,
aFileName: String | string,
aBase64EncodedString: String | string
): Node;
/**
* Creates a file using a sv:temporaryFile.
*
*
* Note that the aParent of the file must be a sv:localFileRepository, sv:fileRepository,
* sv:personalFileRepository or a sv:folder residing as sub node to a file repository.
*
* Permission note! Current user must be authorized to alter the parent node * (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
* @param aParent the parent node of the file * @param aTemporaryFile a sv:temporaryFile (typically created via {@link senselogic.sitevision.api.node.builder.TemporaryFileNodeBuilder}) * @return a sv:file node corresponding to the newly created file. Will never returnnull
* @throws ConstraintViolationException if the user is not authorized to alter the parent node, if an invalid
parent node is specified, if an invalid temporary node is specified or if file exceeds file size limit
* @throws RepositoryException if something else goes wrong
* @since Sitevision 4.5.4
*/
createFileFromTemporary(aParent: Node, aTemporaryFile: Node): Node;
/**
* Copies a file to a given parent.
*
*
* Note that the aParent of the file must be a sv:localFileRepository, sv:fileRepository,
* sv:personalFileRepository or a sv:folder residing as sub node to a file repository.
* The aParent must not be trashed.
*
* Permission note! Current user must be authorized to alter the parent node * (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
* @param aFile the file node to copy * @param aParent the parent node where the file should be copied to * @return a file node corresponding to the newly created file * @throws ConstraintViolationException if the user is not authorized to alter the parent node, if an invalid parent node is specified, if an invalid file node is specified * @throws RepositoryException if something else goes wrong * @since Sitevision 2026.01.1 */ copyFile(aFile: Node, aParent: Node): Node; /** * Updates the binary content of an existing file using a uri string. * *
* Properties related to the binary content will also be updated (e.g. length). A new version will
* be created if the binary content of a group file is updated.
*
* URI note! The URI must be accessible from the Sitevision server and the ending part
* of the URI must match the file extension of the existing file that should be updated! Sitevision opens
* a stream to an URL with the anUri value when uploading the binary content of the file.
* If a firewall or such blocks outgoing communication from the server - file update will fail.
*
* Permission note! Current user must be authorized to alter the file node that * should be updated (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
* @param aFile the file * @param aUri the URI pointing to the file resource to fetch new binary content from * @throws ConstraintViolationException if the user is not authorized to alter the file node, if an invalid node is specified, if the end part ofaUri doesn't match the file extension
of aFile or if file exceeds file size limit
* @throws RepositoryException if something else goes wrong
* @since Sitevision 3.6.3
*/
updateBinaryContent(aFile: Node, aUri: String | string): void;
/**
* Updates the binary content of an existing file using a base64 string.
*
* * The base64 decoder uses "The Base64 Alphabet" as specified in Table 1 of RFC 4648 and RFC 2045 for decoding operation. * The decoder rejects data that contains characters outside the base64 alphabet. *
*
* Properties related to the binary content will also be updated (e.g. length). A new version will
* be created if the binary content of a group file is updated.
*
* Permission note! Current user must be authorized to alter the file node that * should be updated (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
* @param aFile the file * @param aBase64EncodedString a base64 encoded string * @throws ConstraintViolationException if the user is not authorized to alter the file node, if an invalid node is specified, ifaBase64EncodedString is not base64 encoded, if file exceeds file size limit
or if file exceeds file size limit
* @throws RepositoryException if something else goes wrong
* @since Sitevision 4.5.4
*/
updateBinaryContentFromBase64(
aFile: Node,
aBase64EncodedString: String | string
): void;
/**
* Updates the binary content of an existing file using a sv:temporaryFile.
*
*
* Properties related to the binary content will also be updated (e.g. length). A new version will
* be created if the binary content of a group file is updated.
*
* Permission note! Current user must be authorized to alter the file node that * should be updated (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
* @param aFile the file * @param aTemporaryFile the sv:temporaryFile (typically created via {@link senselogic.sitevision.api.node.builder.TemporaryFileNodeBuilder}) * @throws ConstraintViolationException if the user is not authorized to alter the file node, if an invalid node is specified, if the end part of the file represented byaTemporaryFile doesn't match the file extension
of aFile or if file exceeds file size limit
* @throws RepositoryException if something else goes wrong
* @since Sitevision 4.5.4
*/
updateBinaryContentFromTemporary(aFile: Node, aTemporaryFile: Node): void;
/**
* Gets the contents of a file as a String using the UTF-8 character encoding.
*
* * Note! This is mere a convenience method for {@link #getContentAsString(Node, String)} using UTF-8 as character encoding. *
* @param aFile the file Node (sv:file or sv:temporaryFile) * @return the UTF-8 file content, or null if aFile isn't a character-based file * @see #getContentAsString(Node, String) * @since Sitevision 4.1.1 */ getContentAsString(aFile: Node): string; /** * Gets the contents of a file as a String using a given character encoding. * ** Note! This method operates on character-based file nodes only! That is: *
*
* If no file is specified a NullPointerException is thrown.
* If the node is not a sv:file an IllegalArgumentException is thrown.
* If no name is provided a NullPointerException is thrown.
*
* Permission note! Current user (the invoker of this method) must have WRITE permission
* on the file node that should be updated (see {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}).
* Updating a file for a sv:userIdentity requires
* {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_USER_IDENTITIES} on current page.
*
null
* @param aNewName the new name of the file. May not be null
* @throws ConstraintViolationException if the current user is not authorized to alter the name of the file or if the file extension doesn't match
* @throws RepositoryException if something else goes wrong
* @since Sitevision 4.5.2
*/
renameFile(aFile: Node, aNewName: String | string): void;
/**
* Modifies versioning for a file.
*
* * Permission note! Current user (the invoker of this method) must have WRITE permission * on the file node that should be updated (see {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}). *
* @param aFile the sv:file. May not be null * @param aVersioned the new state of versioning for this file * @throws ConstraintViolationException if the current user is not authorized to mutate aFile or if aFile is not a sv:file * @throws RepositoryException if something else goes wrong * @since Sitevision 9.1 */ setVersioned(aFile: Node, aVersioned: boolean): void; /** * Modifies download protection for a file. * ** Permission note! Current user (the invoker of this method) must have WRITE permission and MANAGE_DOWNLOAD_PROTECTION * permission on the file node that should be updated (see {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE} * and {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_DOWNLOAD_PROTECTION}). *
* ** Tip! Use {@link senselogic.sitevision.api.property.PropertyUtil} or {@link senselogic.sitevision.api.property.Properties} * to check current state, i.e. the "downloadProtected" boolean property. *
* @param aFile the sv:file. May not be null * @param aDownloadProtected the new state of download protection for aFile * @throws ConstraintViolationException if the current user is not authorized to mutate aFile or if aFile is not a sv:file * @throws RepositoryException if something else goes wrong * @since Sitevision 2022.08.1 */ setDownloadProtected(aFile: Node, aDownloadProtected: boolean): void; } declare namespace FileUtil {} declare var fileUtil: FileUtil; export default fileUtil;