com.ibm.workplace.wcm.api
Interface FileComponent
- All Superinterfaces:
- ContentComponent, DigitalAsset, RenditionCapability, Resource, TargetableContentComponent, WCMApiObject
public interface FileComponent
- extends TargetableContentComponent, DigitalAsset, Resource, RenditionCapability
Represents a File component.
A FileComponent
is a ContentComponent
and
cannot be stored as a separate entity in the repository.
A FileComponent
can contain one file. The contents of the
file are dealt with as raw byte content. This interface provides methods
to manipulate the file.
note: since v6.0.0
, a FileComponent
is
referred to as an "File Element" in the Authoring UI.
- See Also:
ContentComponent
Methods inherited from interface com.ibm.workplace.wcm.api.Resource |
getBytes, getInputStream, getMimeType, getResourceName, getResourceURL, getSize, removeResource, setDeliverableOverCachingNetworkSupport, setResource, setResource, supportsDeliveryOverCachingNetwork |
getDocumentType
DocumentType<? extends FileComponent> getDocumentType()
- Description copied from interface:
ContentComponent
- Returns the
DocumentType
of the ContentComponent
.
- Specified by:
getDocumentType
in interface ContentComponent
- Specified by:
getDocumentType
in interface TargetableContentComponent
- Returns:
- the type
- See Also:
ContentComponent.getDocumentType()
getFile
byte[] getFile()
throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
- Deprecated. use
Resource.getBytes()
- Returns the contents of the file contained within this component
as a byte array.
Returns an empty byte array if the byte content could not be retrieved.
- Returns:
- the file content as a byte array
- Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException
- if the user does not have access to the file
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
- if the file cannot be retrieved or is externally managed
getFileStream
java.io.InputStream getFileStream()
throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
- Deprecated. use
Resource.getInputStream()
- Returns the contents of the file contained within this component
as a input stream
Returns an empty byte array if no file has been set or the byte content
could not be retrieved.
- Returns:
- the file content as a input stream
- Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException
- if the user does not have access to the file
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
- if the file cannot be retrieved or is externally managed- Since:
- 8.0.0.1
getFileName
java.lang.String getFileName()
throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
- Deprecated. use
Resource.getResourceName()
- Returns the filename of the file contained within this
component.
Returns null if a file or filename has not
been specified.
- Returns:
- the filename
- Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException
- if the user does not have access to the file
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
- if the file cannot be retrieved
setFile
void setFile(java.lang.String fileName,
byte[] file)
throws com.ibm.workplace.wcm.api.exceptions.OperationFailedException
- Deprecated. use
Resource.setResource(String, byte[])
- Sets the file contained within this component.
This method does not accept null arguments. Passing a
null argument into this method will result in a
NullPointerException
.
- Parameters:
fileName
- the name of the filefile
- the content of the file as a byte array
- Throws:
java.lang.NullPointerException
- if fileName or file is null
com.ibm.workplace.wcm.api.exceptions.OperationFailedException
- if the file could not be set
setFile
void setFile(java.lang.String fileName,
java.io.File file)
throws com.ibm.workplace.wcm.api.exceptions.OperationFailedException
- Deprecated. use
Resource.setResource(String, File)
- Sets the file contained within this component. This is more memory friendly
then setting the bytes of the file.
This method does not accept null arguments. Passing a
null argument into this method will result in a
NullPointerException
.
- Parameters:
fileName
- the name of the filefile
- the contents of the file as a file on the file system
- Throws:
java.lang.NullPointerException
- if fileName or file is null
com.ibm.workplace.wcm.api.exceptions.OperationFailedException
- if the file could not be set
removeFile
void removeFile()
throws com.ibm.workplace.wcm.api.exceptions.OperationFailedException
- Deprecated. use
Resource.removeResource()
- Removes file contained within this component.
- Throws:
com.ibm.workplace.wcm.api.exceptions.OperationFailedException
- if an error occurred removing the file.
getLibraryComponentReference
DocumentId<LibraryFileComponent> getLibraryComponentReference()
throws com.ibm.workplace.wcm.api.exceptions.AuthorizationException,
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
- Get the referenced library file component, or null if no library file component is referenced.
- Returns:
- the DocumentId of the referenced library file component
- Throws:
com.ibm.workplace.wcm.api.exceptions.AuthorizationException
- if the user does not have the appropriate access to the LibraryFileComponent
com.ibm.workplace.wcm.api.exceptions.PropertyRetrievalException
- if the LibraryImageComponent
DocumentId cannot be retrieved- Since:
- 8.5 CF7
setLibraryComponentReference
void setLibraryComponentReference(DocumentId p_libraryFileComponentId)
- Set the library file component to reference, or null to clear the library image component reference.
- Parameters:
p_libraryFileComponentId
- the DocumentId of the library file component to reference
- Throws:
java.lang.IllegalArgumentException
- if the ID is not that of a library file component- Since:
- 8.5 CF7