Class DocumentService
java.lang.Object
fr.paris.lutece.plugins.document.service.DocumentService
This Service manages document actions (create, move, delete, validate ...)
and notify listeners.
-
Method Summary
Modifier and TypeMethodDescriptionvoidarchiveDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user, int nStateId) Archive a documentvoidchangeDocumentState(Document document, fr.paris.lutece.portal.business.user.AdminUser user, int nStateId) Change the state of the documentvoidcreateDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user) Create a new documentvoidgetActions(Document document, Locale locale, fr.paris.lutece.portal.business.user.AdminUser user) Add to the document all permitted actions according to the current user and using the current localegetCreateForm(String strDocumentTypeCode, Locale locale, String strBaseUrl) Build an HTML form for the document creation for a given document typegetDocumentData(fr.paris.lutece.portal.web.upload.MultipartHttpServletRequest mRequest, Document document, Locale locale) Return the data of a document objectstatic DocumentServiceGet the unique instance of the servicegetModifyForm(Document document, Locale locale, String strBaseUrl) Build an HTML form for the document modification for a given documentgetModifyForm(String strDocumentId, Locale locale, String strBaseUrl) Build an HTML form for the document modification for a given document ID.voidgetPublishedStatus(Document document) Get the published status of a documentbooleanisAuthorizedAdminDocument(int nIdSpace, String strDocumentTypeId, String strPermission, fr.paris.lutece.portal.business.user.AdminUser user) Check 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.voidmodifyDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user) Modify a the content of a documentvoidmoveDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user, int nNewSpace) Move a document from a space to anothervoidvalidateDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user, int nStateId) Validate a document
-
Method Details
-
getInstance
Get the unique instance of the service- Returns:
- The unique instance
-
changeDocumentState
public void changeDocumentState(Document document, fr.paris.lutece.portal.business.user.AdminUser user, int nStateId) throws DocumentException Change the state of the document- Parameters:
document- The documentuser- The user doing the actionnStateId- The new state Id- Throws:
DocumentException- raise when error occurs in event or rule
-
createDocument
public void createDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user) throws DocumentException Create a new document- Parameters:
document- The documentuser- The user doing the action- Throws:
DocumentException- raise when error occurs in event or rule
-
modifyDocument
public void modifyDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user) throws DocumentException Modify a the content of a document- Parameters:
document- The documentuser- The user doing the action- Throws:
DocumentException- raise when error occurs in event or rule
-
validateDocument
public void validateDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user, int nStateId) throws DocumentException Validate a document- Parameters:
nStateId- The new state id for a validated documentdocument- The documentuser- The user doing the action- Throws:
DocumentException- raise when error occurs in event or rule
-
archiveDocument
public void archiveDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user, int nStateId) throws DocumentException Archive a document- Parameters:
nStateId- The new state id for a validated documentdocument- The documentuser- The user doing the action- Throws:
DocumentException- raise when error occurs in event or rule
-
moveDocument
public void moveDocument(Document document, fr.paris.lutece.portal.business.user.AdminUser user, int nNewSpace) throws DocumentException Move a document from a space to another- Parameters:
document- The documentuser- The user doing the actionnNewSpace- The Id of the destination space- Throws:
DocumentException- raise when error occurs in event or rule
-
getActions
public void getActions(Document document, Locale locale, fr.paris.lutece.portal.business.user.AdminUser user) Add to the document all permitted actions according to the current user and using the current locale- Parameters:
user- The current userdocument- The documentlocale- The Locale
-
getPublishedStatus
Get the published status of a document- Parameters:
document- The document to get the published status of
-
getCreateForm
Build an HTML form for the document creation for a given document type- Parameters:
strDocumentTypeCode- The Document type codelocale- The LocalestrBaseUrl- The base Url- Returns:
- The HTML form
-
getModifyForm
Build an HTML form for the document modification for a given document ID. Warning : This method loads the binaries of the document.- Parameters:
strDocumentId- The Id of the document to modifylocale- The LocalestrBaseUrl- The base url- Returns:
- The HTML form
-
getModifyForm
Build an HTML form for the document modification for a given document- Parameters:
document- The documentlocale- The LocalestrBaseUrl- The base url- Returns:
- The HTML form
-
isAuthorizedAdminDocument
public boolean isAuthorizedAdminDocument(int nIdSpace, String strDocumentTypeId, String strPermission, fr.paris.lutece.portal.business.user.AdminUser user) Check 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 id of the document spacestrDocumentTypeId- the id of the type document being consideredstrPermission- the permission neededuser- the user trying to access the ressource- Returns:
- true if the user can access the given resource with the given permission, false otherwise
-
getDocumentData
public String getDocumentData(fr.paris.lutece.portal.web.upload.MultipartHttpServletRequest mRequest, Document document, Locale locale) Return the data of a document object- Parameters:
mRequest- The MultipartHttpServletRequestdocument- The document objectlocale- The locale- Returns:
- data of document object
-