Class DocumentHome
- java.lang.Object
-
- fr.paris.lutece.plugins.document.business.DocumentHome
-
public final class DocumentHome extends java.lang.ObjectThis class provides instances management methods (create, find, ...) for Document objects
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Documentcreate(Document document)Creation of an instance of documentstatic java.util.List<Document>findAll()Get the list of every documentsstatic java.util.Collection<java.lang.Integer>findAllPrimaryKeys()Gets all documents idstatic java.util.List<Document>findByFilter(DocumentFilter filter, java.util.Locale locale)Returns a collection of documents objectsstatic DocumentfindByPrimaryKey(int nKey)Returns an instance of a document whose identifier is specified in parameterstatic DocumentfindByPrimaryKeyWithoutBinaries(int nKey)Returns an instance of a document whose identifier is specified in parameterstatic java.util.List<Document>findByRelatedCategories(Document document, java.util.Locale locale)Returns a collection of documents objects If more than one category is specified on filter, the result will corresponding to the document wich matched with one category at least.static java.util.List<Document>findBySpaceKey(int nSpaceId)Returns documents by space idstatic java.util.Collection<java.lang.Integer>findPrimaryKeysByFilter(DocumentFilter filter, java.util.Locale locale)Returns a collection of documents idsstatic java.lang.StringgetPageTemplateDocumentPath(int idPageTemplateDocument)Load document pageTemplatePathstatic DocumentResourcegetResource(int nDocumentId)Get a document resourcestatic DocumentResourcegetValidatedResource(int nDocumentId, int nAttributeId)Get the validated resource of an attribute of a documentstatic DocumentResourcegetWorkingResource(int nDocumentId, int nAttributeId)Get the working resource of an attribute of a documentstatic voidloadAttributes(Document document)Load document attributesstatic voidloadAttributesWithoutBinaries(Document document, boolean bValidated)Load document attributesstatic DocumentloadLastModifiedAttributes(int nDocumentId)Load document type and date last modification for HTTP GET conditional request ("If-Modified-Since")static DocumentloadLastModifiedDocumentFromUser(java.lang.String strUserName)Load the data of last Document the user worked in from the tablestatic DocumentloadLastPublishedDocument()Load the data of last Document the user worked in from the tablestatic intnewPrimaryKey()Get a new primary keystatic voidremove(int nDocumentId)Remove the Document whose identifier is specified in parameterstatic Documentupdate(Document document, boolean bUpdateContent)Update of the document which is specified in parameterstatic voidvalidateAttributes(int nIdDocument)Validate of the document attributes
-
-
-
Method Detail
-
create
public static Document create(Document document)
Creation of an instance of document- Parameters:
document- The instance of the document which contains the informations to store- Returns:
- The instance of document which has been created with its primary key.
-
update
public static Document update(Document document, boolean bUpdateContent)
Update of the document which is specified in parameter- Parameters:
bUpdateContent- True to update content, false otherwisedocument- The instance of the document which contains the data to store- Returns:
- The instance of the document which has been updated
-
validateAttributes
public static void validateAttributes(int nIdDocument)
Validate of the document attributes- Parameters:
nIdDocument- The id of the document
-
remove
public static void remove(int nDocumentId)
Remove the Document whose identifier is specified in parameter- Parameters:
nDocumentId- The id of the document to remove
-
findByPrimaryKey
public static Document findByPrimaryKey(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
-
findByPrimaryKeyWithoutBinaries
public static Document findByPrimaryKeyWithoutBinaries(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
-
findBySpaceKey
public static java.util.List<Document> findBySpaceKey(int nSpaceId)
Returns documents by space id- Parameters:
nSpaceId- The space Id- Returns:
- A list of documents
-
findPrimaryKeysByFilter
public static java.util.Collection<java.lang.Integer> findPrimaryKeysByFilter(DocumentFilter filter, java.util.Locale locale)
Returns a collection of documents ids- Parameters:
filter- The filterlocale- The locale- Returns:
- A collection of documents ids
-
findByFilter
public static java.util.List<Document> findByFilter(DocumentFilter filter, java.util.Locale locale)
Returns a collection of documents objects- Parameters:
filter- The filterlocale- The locale- Returns:
- A collection of documents
-
findByRelatedCategories
public static java.util.List<Document> findByRelatedCategories(Document document, java.util.Locale locale)
Returns a collection of documents objects If more than one category is specified on filter, the result will corresponding to the document wich matched with one category at least.- Parameters:
document- TheDocumentlocale- TheLocale- Returns:
- A collection of documents
-
getValidatedResource
public static DocumentResource getValidatedResource(int nDocumentId, int nAttributeId)
Get the validated resource of an attribute of a document- Parameters:
nDocumentId- The id of the documentnAttributeId- The id of the attribute to get the resource of- Returns:
- the document resource, of null if none was found
-
getWorkingResource
public static DocumentResource getWorkingResource(int nDocumentId, int nAttributeId)
Get the working resource of an attribute of a document- Parameters:
nDocumentId- The id of the documentnAttributeId- the id of the attribute- Returns:
- the document resource, of null if none was found
-
getResource
public static DocumentResource getResource(int nDocumentId)
Get a document resource- Parameters:
nDocumentId- The id of the document- Returns:
- The document resource
-
newPrimaryKey
public static int newPrimaryKey()
Get a new primary key- Returns:
- The new primary key
-
findAllPrimaryKeys
public static java.util.Collection<java.lang.Integer> findAllPrimaryKeys()
Gets all documents id- Returns:
- A collection of Integer
-
findAll
public static java.util.List<Document> findAll()
Get the list of every documents- Returns:
- The list of every documents
-
loadAttributes
public static void loadAttributes(Document document)
Load document attributes- Parameters:
document- the document reference
-
loadAttributesWithoutBinaries
public static void loadAttributesWithoutBinaries(Document document, boolean bValidated)
Load document attributes- Parameters:
document- the document referencebValidated- true if the content of the document must be validated, false otherwise
-
getPageTemplateDocumentPath
public static java.lang.String getPageTemplateDocumentPath(int idPageTemplateDocument)
Load document pageTemplatePath- Parameters:
idPageTemplateDocument- the Id page template identifier- Returns:
- the page template document path
-
loadLastModifiedAttributes
public static Document loadLastModifiedAttributes(int nDocumentId)
Load document type and date last modification for HTTP GET conditional request ("If-Modified-Since")- Parameters:
nDocumentId- The document id- Returns:
- the document
-
loadLastModifiedDocumentFromUser
public static Document loadLastModifiedDocumentFromUser(java.lang.String strUserName)
Load the data of last Document the user worked in from the table- Parameters:
strUserName- the user name- Returns:
- the instance of the Document
-
loadLastPublishedDocument
public static Document loadLastPublishedDocument()
Load the data of last Document the user worked in from the table- Returns:
- the instance of the Document
-
-