Class Files2DocsLinkDocument


  • public final class Files2DocsLinkDocument
    extends java.lang.Object
    Link class with document services
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String createDocument​(fr.paris.lutece.plugins.document.business.Document document, fr.paris.lutece.portal.business.user.AdminUser user)
      Creates a new document
      java.util.List<Attribute> getAllAttributes​(java.lang.String strDocumentTypeCode, int nIdMapping, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Get the collection of all document attributes that are mandatory or type file/image.
      java.util.Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter> getAttributeParametersValues​(int nAttributeId, java.util.Locale locale)
      Gets parameters values
      java.util.Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter> getAttributeTypeParameterList​(java.lang.String strAttributeTypeCode, java.util.Locale locale)
      Gets attribute type parameters list
      fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute getDocumentAttributeById​(int nKey)
      Returns an instance of a documentAttribute whose identifier is specified in parameter
      fr.paris.lutece.plugins.document.business.Document getDocumentById​(int nKey)
      Returns an instance of a document whose identifier is specified in parameter
      fr.paris.lutece.plugins.document.business.DocumentType getDocumentTypeByCode​(java.lang.String strCode)
      Returns an instance of a documentType whose identifier is specified in parameter
      static Files2DocsLinkDocument getInstance()
      Gets the unique instance of Files2DocsLinkDocument
      java.util.Collection<fr.paris.lutece.plugins.document.business.DocumentType> getListDocumentTypeFile​(java.util.Collection<java.lang.String> listAttributeTypeFile, boolean bIsForCreate)
      Gets the document types filtered by fields of type file
      java.util.Collection<java.lang.Integer> getListRegularExpressionKeyByIdAttribute​(int nIdAttribute)
      Gets all regular expression key associated to the attribute
      fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute getMandatoryAttributeFileImage​(java.lang.String strDocumentTypeCode)
      Get the mandatory attribute file/image from a given document type
      java.util.Collection<fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute> getMandatoryAttributes​(java.lang.String strDocumentTypeCode)
      Gets mandatory attributes for the document type
      java.lang.String getSpacesBrowser​(javax.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.business.user.AdminUser user, java.util.Locale locale)
      Gets the HTML code to display the spaces browser
      boolean isAuthorizedAdminDocument​(int nIdSpace, java.lang.String strDocumentTypeId, fr.paris.lutece.portal.business.user.AdminUser user)
      Checks that a given user is allowed to access a document type for a given permission in a document space specified in parameter.
      boolean isDocumentAttributeFile​(fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute attribute)
      Check if the given document attribute is an attribute type file
      boolean isDocumentAttributeImage​(fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute attribute)
      Check if the given document attribute is an attribute type image
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstance

        public static Files2DocsLinkDocument getInstance()
        Gets the unique instance of Files2DocsLinkDocument
        Returns:
        The unique instance of Files2DocsLinkDocument
      • getListDocumentTypeFile

        public java.util.Collection<fr.paris.lutece.plugins.document.business.DocumentType> getListDocumentTypeFile​(java.util.Collection<java.lang.String> listAttributeTypeFile,
                                                                                                                    boolean bIsForCreate)
        Gets the document types filtered by fields of type file
        Parameters:
        listAttributeTypeFile - The list of document attributes types (codes) with a field of type file
        Returns:
        A collection of document types filtered by fields of type file
      • getSpacesBrowser

        public java.lang.String getSpacesBrowser​(javax.servlet.http.HttpServletRequest request,
                                                 fr.paris.lutece.portal.business.user.AdminUser user,
                                                 java.util.Locale locale)
        Gets the HTML code to display the spaces browser
        Parameters:
        request - The HTTP request
        user - The current user
        locale - The current locale
        Returns:
        The HTML form
      • isAuthorizedAdminDocument

        public boolean isAuthorizedAdminDocument​(int nIdSpace,
                                                 java.lang.String strDocumentTypeId,
                                                 fr.paris.lutece.portal.business.user.AdminUser user)
        Checks that a given user is allowed to access a document type for a given permission in a document space specified in parameter. If permission is document creation, check if document creation is allowed for the specified space
        Parameters:
        nIdSpace - The document space identifier
        strDocumentTypeId - The identifier of the type document being considered
        user - The user trying to access the resource
        Returns:
        True if the user can access the given resource with the given permission, otherwise false
      • getMandatoryAttributes

        public java.util.Collection<fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute> getMandatoryAttributes​(java.lang.String strDocumentTypeCode)
        Gets mandatory attributes for the document type
        Parameters:
        strDocumentTypeCode - The document type code
        Returns:
        A collection of mandatory attributes
      • getMandatoryAttributeFileImage

        public fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute getMandatoryAttributeFileImage​(java.lang.String strDocumentTypeCode)
        Get the mandatory attribute file/image from a given document type
        Parameters:
        strDocumentTypeCode - the document type code
        Returns:
        the mandatory attribute file/image
      • getAttributeTypeParameterList

        public java.util.Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter> getAttributeTypeParameterList​(java.lang.String strAttributeTypeCode,
                                                                                                                                               java.util.Locale locale)
        Gets attribute type parameters list
        Parameters:
        strAttributeTypeCode - The attribute type code
        locale - The current locale
        Returns:
        A collection of attribute type parameters
      • getAttributeParametersValues

        public java.util.Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter> getAttributeParametersValues​(int nAttributeId,
                                                                                                                                              java.util.Locale locale)
        Gets parameters values
        Parameters:
        nAttributeId - The attribute identifier
        locale - The current locale
        Returns:
        A collection of attribute type parameters
      • createDocument

        public java.lang.String createDocument​(fr.paris.lutece.plugins.document.business.Document document,
                                               fr.paris.lutece.portal.business.user.AdminUser user)
        Creates a new document
        Parameters:
        document - The document
        user - The user doing the action
        Returns:
        null if document is created, otherwise the error message
      • getDocumentById

        public fr.paris.lutece.plugins.document.business.Document getDocumentById​(int nKey)
        Returns an instance of a document whose identifier is specified in parameter
        Parameters:
        nKey - The primary key of the document
        Returns:
        An instance of document
      • getDocumentTypeByCode

        public fr.paris.lutece.plugins.document.business.DocumentType getDocumentTypeByCode​(java.lang.String strCode)
        Returns an instance of a documentType whose identifier is specified in parameter
        Parameters:
        strCode - The document type code (primary key)
        Returns:
        An instance of documentType
      • getDocumentAttributeById

        public fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute getDocumentAttributeById​(int nKey)
        Returns an instance of a documentAttribute whose identifier is specified in parameter
        Parameters:
        nKey - The primary key of the documentAttribute
        Returns:
        An instance of documentAttribute
      • getListRegularExpressionKeyByIdAttribute

        public java.util.Collection<java.lang.Integer> getListRegularExpressionKeyByIdAttribute​(int nIdAttribute)
        Gets all regular expression key associated to the attribute
        Parameters:
        nIdAttribute - The identifier of the document attribute
        Returns:
        A collection of regular expression key
      • getAllAttributes

        public java.util.List<Attribute> getAllAttributes​(java.lang.String strDocumentTypeCode,
                                                          int nIdMapping,
                                                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
        Get the collection of all document attributes that are mandatory or type file/image.
        This method will also get the attributes even if they are not stored in the db.
        The format of the attribute will be formatted in HTML.
        Parameters:
        strDocumentTypeCode - the document type code
        nIdMapping - the id mapping
        plugin - the plugin
        Returns:
        the collection of attributes
      • isDocumentAttributeFile

        public boolean isDocumentAttributeFile​(fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute attribute)
        Check if the given document attribute is an attribute type file
        Parameters:
        attribute - then attribute
        Returns:
        true if it is an attribute type file, false otherwise
      • isDocumentAttributeImage

        public boolean isDocumentAttributeImage​(fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute attribute)
        Check if the given document attribute is an attribute type image
        Parameters:
        attribute - then attribute
        Returns:
        true if it is an attribute type image, false otherwise