Class Files2DocsLinkDocument
- java.lang.Object
-
- fr.paris.lutece.plugins.files2docs.service.Files2DocsLinkDocument
-
public final class Files2DocsLinkDocument extends java.lang.ObjectLink class with document services
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcreateDocument(fr.paris.lutece.plugins.document.business.Document document, fr.paris.lutece.portal.business.user.AdminUser user)Creates a new documentjava.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 valuesjava.util.Collection<fr.paris.lutece.plugins.document.business.attributes.AttributeTypeParameter>getAttributeTypeParameterList(java.lang.String strAttributeTypeCode, java.util.Locale locale)Gets attribute type parameters listfr.paris.lutece.plugins.document.business.attributes.DocumentAttributegetDocumentAttributeById(int nKey)Returns an instance of a documentAttribute whose identifier is specified in parameterfr.paris.lutece.plugins.document.business.DocumentgetDocumentById(int nKey)Returns an instance of a document whose identifier is specified in parameterfr.paris.lutece.plugins.document.business.DocumentTypegetDocumentTypeByCode(java.lang.String strCode)Returns an instance of a documentType whose identifier is specified in parameterstatic Files2DocsLinkDocumentgetInstance()Gets the unique instance of Files2DocsLinkDocumentjava.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 filejava.util.Collection<java.lang.Integer>getListRegularExpressionKeyByIdAttribute(int nIdAttribute)Gets all regular expression key associated to the attributefr.paris.lutece.plugins.document.business.attributes.DocumentAttributegetMandatoryAttributeFileImage(java.lang.String strDocumentTypeCode)Get the mandatory attribute file/image from a given document typejava.util.Collection<fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute>getMandatoryAttributes(java.lang.String strDocumentTypeCode)Gets mandatory attributes for the document typejava.lang.StringgetSpacesBrowser(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 browserbooleanisAuthorizedAdminDocument(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.booleanisDocumentAttributeFile(fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute attribute)Check if the given document attribute is an attribute type filebooleanisDocumentAttributeImage(fr.paris.lutece.plugins.document.business.attributes.DocumentAttribute attribute)Check if the given document attribute is an attribute type image
-
-
-
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 requestuser- The current userlocale- 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 identifierstrDocumentTypeId- The identifier of the type document being considereduser- 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 codelocale- 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 identifierlocale- 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 documentuser- 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 codenIdMapping- the id mappingplugin- 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
-
-