Class Files2DocsLinkDocument

java.lang.Object
fr.paris.lutece.plugins.files2docs.service.Files2DocsLinkDocument

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

    Modifier and Type
    Method
    Description
    createDocument(fr.paris.lutece.plugins.document.business.Document document, fr.paris.lutece.portal.business.user.AdminUser user)
    Creates a new document
    getAllAttributes(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.
    Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter>
    getAttributeParametersValues(int nAttributeId, Locale locale)
    Gets parameters values
    Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter>
    getAttributeTypeParameterList(String strAttributeTypeCode, Locale locale)
    Gets attribute type parameters list
    fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute
    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
    Returns an instance of a documentType whose identifier is specified in parameter
    Gets the unique instance of Files2DocsLinkDocument
    Collection<fr.paris.lutece.plugins.document.business.DocumentType>
    getListDocumentTypeFile(Collection<String> listAttributeTypeFile, boolean bIsForCreate)
    Gets the document types filtered by fields of type file
    Gets all regular expression key associated to the attribute
    fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute
    Get the mandatory attribute file/image from a given document type
    Collection<fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute>
    getMandatoryAttributes(String strDocumentTypeCode)
    Gets mandatory attributes for the document type
    getSpacesBrowser(jakarta.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.business.user.AdminUser user, Locale locale, String strActionUrl)
    Gets the HTML code to display the spaces browser
    boolean
    isAuthorizedAdminDocument(int nIdSpace, 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 Details

    • getInstance

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

      public Collection<fr.paris.lutece.plugins.document.business.DocumentType> getListDocumentTypeFile(Collection<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 String getSpacesBrowser(jakarta.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.business.user.AdminUser user, Locale locale, String strActionUrl)
      Gets the HTML code to display the spaces browser
      Parameters:
      request - The HTTP request
      user - The current user
      locale - The current locale
      strActionUrl - The URL the browser posts to when it opens a space
      Returns:
      The HTML form
    • isAuthorizedAdminDocument

      public boolean isAuthorizedAdminDocument(int nIdSpace, 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 Collection<fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute> getMandatoryAttributes(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(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 Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter> getAttributeTypeParameterList(String strAttributeTypeCode, 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 Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter> getAttributeParametersValues(int nAttributeId, Locale locale)
      Gets parameters values
      Parameters:
      nAttributeId - The attribute identifier
      locale - The current locale
      Returns:
      A collection of attribute type parameters
    • createDocument

      public 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(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 Collection<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 List<Attribute> getAllAttributes(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