com.ibm.commerce.tools.attachment.beans

Class AttachmentDataBean

  • All Implemented Interfaces:
    DataBean, InputDataBean, SmartDataBean, java.io.Serializable


    public class AttachmentDataBean
    extends SmartDataBeanImpl
    This bean is used in the attachment UI. It is used in the dynamic list panel when browsing the directory structure of the attachments. It is also used in the result of a search. This bean has been tailored for its use in the UI.
    See Also:
    Serialized Form
    • Field Detail

      • CLASSNAME

        public static final java.lang.String CLASSNAME
        Define the CLASSNAME.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AttachmentDataBean

        public AttachmentDataBean(java.lang.String aFilenamePath,
                                  java.lang.String tool,
                                  java.lang.String storeDir)
        This constructor takes three arguments:
        • the file name,
        • the tool, and
        • the store directory.
        Based on these three values, we set the different fields which we will be used in the result page in the Attachment UI.
        Parameters:
        aFilenamePath - The full name of the file including its directory
        tool - The tool which will be using this databean. Two possible values: browser or search.
        storeDir - The store directory that this asset is located in
      • AttachmentDataBean

        public AttachmentDataBean(java.lang.String aFilenamePath,
                                  java.lang.String tool,
                                  java.lang.String strMimeType,
                                  java.lang.String storeDir)
        This constructor takes four arguments:
        • the file name,
        • the tool,
        • the file's mimetype, and
        • the store directory.
        Based on these four values, we set the different fields which we will be used in the result page in the Attachment UI.
        Parameters:
        aFilenamePath - The full name of the file including its directory
        tool - The tool which will be using this databean. Two possible values: browser or search.
        strMimeType - the mimetype of the file aFilenamePath. We have the empty string '' to represent a URL and 'm' to represent a managed file.
        storeDir - The store directory that this asset is located in
    • Method Detail

      • getOwner

        public java.lang.Long getOwner()
                                throws java.lang.Exception
        Gets the member Id of the store.
        Returns:
        The member Id.
        Throws:
        java.lang.Exception
      • populate

        public void populate()
                      throws java.lang.Exception
        Populates the databean based on the directory and file name. Using the directory and file name, it can determine if the attachment is a managed file. It can determine if the attachment asset is for all languages or for specific languages. It can also determine that it is not a file asset but a URL asset.
        Specified by:
        populate in interface SmartDataBean
        Overrides:
        populate in class SmartDataBeanImpl
        Throws:
        java.lang.Exception - Any exception captured
      • getDirectoryPath

        public java.lang.String getDirectoryPath()
        This get method returns the directory path of the attachment. This does not include the filename. For example, if the attachment is /storeXYZ/images/catalog/Shirt.jpg. The value return is /storeXYZ/images/catalog.
        Returns:
        The directory path only. The file name is not included.
      • getFilename

        public java.lang.String getFilename()
        This get method returns the filename of the attachment. For example, if the attachment is /storeXYZ/images/catalog/Shirt.jpg. The value return is Shirt.jpg.
        Returns:
        The filename only.
      • getMimeType

        public java.lang.String getMimeType()
        This get method returns the MIME type. For example, the mimeType representing the file Short.jpg is "image/jpg". Then "image/jpg" will be returned.
        Returns:
        string
      • getFilenamePath

        public java.lang.String getFilenamePath()
        This get method returns the full filename, that is, the directory path plus the filename of the attachment. For example, if the attachment is /storeXYZ/images/catalog/Shirt.jpg. The value return is /storeXYZ/images/catalog/Shirt.jpg.
        Returns:
        The full filename, that is, the directory path plus the filename.
      • setDirectoryPath

        public void setDirectoryPath(java.lang.String string)
        This method sets the Directory Path. For example,if the file representing the attachment is /storeXYZ/images/catalog/Shirt.jpg, then the directory path should be set to /storeXYZ/images/catalog.
        Parameters:
        string -
      • setFilename

        public void setFilename(java.lang.String string)
        This method sets the file name. For example,if the file representing the attachment is /storeXYZ/images/catalog/Shirt.jpg, then the filename should be set to Shirt.jpg.
        Parameters:
        string -
      • setMimeType

        public void setMimeType(java.lang.String string)
        This method sets the mimeType. For example, the mimeType representing the file Short.jpg is "image/jpg", then the mimeType should be set accordingly. mimeTypes library can be access from com.ibm.commerce.server.MimeUtil.java
        Parameters:
        string - The MIME type of the attachment asset
      • setFilenamePath

        public void setFilenamePath(java.lang.String string)
        This method sets the directory path plus the file name. For example,if the file representing the attachment is /storeXYZ/images/catalog/Shirt.jpg, then the filename path should be set to /storeXYZ/images/catalog/Shirt.jpg.
        Parameters:
        string -
      • getIsAttachmentAsset

        public boolean getIsAttachmentAsset()
        Getter to determine if a file is already an attachment asset.
        Returns:
        True if the file is already an attachment asset ; false otherwise.
      • getIsAnAttachmentTarget

        public boolean getIsAnAttachmentTarget()
        Getter to determine if a file is already an attachment target.
        Returns:
        True if the file is already an attachment target ; false otherwise.
      • getAttachmentTargetId

        public java.lang.String getAttachmentTargetId()
        Getter for the attachment target Id.
        Returns:
        The target attachment Id associated with the file.
      • getDisplayName

        public java.lang.String getDisplayName()
        Getter for the display name used in the UI.
        Returns:
        The display name use in the UI.
      • setDisplayName

        public void setDisplayName(java.lang.String string)
        Setter for the display name to be used in the UI.
        Parameters:
        string - The display name
      • getStoreRelativeFilenamePath

        public java.lang.String getStoreRelativeFilenamePath()
        Getter for the store relative directory path of the file.
        Returns:
        The store relative directory path of the file.
      • setStoreRelativeFilenamePath

        public void setStoreRelativeFilenamePath(java.lang.String string)
        Setter for the store relative directory path of the file.
        Parameters:
        string - The store relative directory path of the file.
      • isContentManagedFile

        public boolean isContentManagedFile()
        Getter to determine if the file is content managed, not an attachment asset yet.
        Returns:
        True if the file is content managed only ; false otherwise.
      • isLanguageSpecificFile

        public boolean isLanguageSpecificFile()
        Getter to determine if the file is an attachment asset for a specific language.
        Returns:
        True if the file is an attachment asset for a specific language ; false otherwise.
      • isLanguageUniversalFile

        public boolean isLanguageUniversalFile()
        This method determines if the file is an attachment asset for all languages.
        Returns:
        True if the file is an attachment asset which is for all languages; false otherwise.
      • setContentManagedFile

        public void setContentManagedFile(boolean b)
        Setter for the content managed file flag.
        Parameters:
        b - Set to true to indicate that the file is content managed only ; false otherwise.
      • setLanguageSpecificFile

        public void setLanguageSpecificFile(boolean b)
        Setter for the language specific file flag.
        Parameters:
        b - Set to true to indicate that the file is an attachment asset targeted for a specific language ; false otherwise.
      • setLanguageUniversalFile

        public void setLanguageUniversalFile(boolean b)
        Setter for the language universal file flag.
        Parameters:
        b - Set to true to indicate that the file is an attachment asset targeted for all languages ; false otherwise.
      • getAttachmentType

        public java.lang.String getAttachmentType()
        Get method for the attachment type.
        Returns:
        The type of the attachment to be used by the UI. There 3 possible types: ManagedFile, LanguageUniversal and LanguageSpecific.
      • setAttachmentType

        public void setAttachmentType(java.lang.String string)
        Set method for the attachment type.
        Parameters:
        string - The type of attachments. It should be one of these 3 possible values:
        • ManagedFile,
        • LanguageUniversal, and
        • LanguageSpecific.
      • getFileSize

        public java.lang.String getFileSize()
        Getter for the size of the file.
        Returns:
        The size of the attachment file in byte
      • setFileSize

        public void setFileSize(java.lang.String string)
        Setter for the size of the file.
        Parameters:
        string - Set the size of the attachment in byte
      • isWorkspaceCorrupted

        public boolean isWorkspaceCorrupted()
        Getter for the file conflict flag with respect to workspace.
        Returns:
        True if there is a workspace conflict; false otherwise.
      • setWorkspaceCorrupted

        public void setWorkspaceCorrupted(boolean hasWorkspaceCorrupted)
        Setter for the file conflict flag with respect to workspace.
        Parameters:
        hasWorkspaceCorrupted - True to indicate a workspace conflict; false otherwise.
      • getErrorCode

        public java.lang.String getErrorCode()
        Getter for the error code.
        Returns:
        The error code.
      • setErrorCode

        public void setErrorCode(java.lang.String anErrorCode)
        Setter for the error code.
        Parameters:
        anErrorCode - The error code.