## com.imcode.imcms.mapping
Class DocumentSaver

    java.lang.Object
      com.imcode.imcms.mapping.DocumentSaver

    public class DocumentSaver

extends java.lang.Object

To enable transactions support this class must be instantiated using spring framework.

Constructor Summary
`DocumentSaver()`
`DocumentSaver(DocumentMapper documentMapper)`

Method Summary
`void` `checkIfAliasAlreadyExist(DocumentDomainObject document)`
`void` `createWorkingDocumentFromExisting(DocumentDomainObject document, UserDomainObject user)` Creates working document version from existing document.
`DocumentMapper` `getDocumentMapper()`
`MetaDao` `getMetaDao()`
`void` `publishWorkingDocument(DocumentDomainObject document, UserDomainObject user)` Published working version of a document.
`void` `saveDocumentFragment(DocumentDomainObject document, UserDomainObject user, org.springframework.orm.hibernate3.HibernateCallback hibernateCallback)` --experimental-- Existing API saves whole document even if only a fragment of it (say text field or image) was modified.
`void` `saveNewDocument(UserDomainObject user, DocumentDomainObject document, boolean copying)`
`void` `setDocumentMapper(DocumentMapper documentMapper)`
`void` `setMetaDao(MetaDao metaDao)`
`void` `updateDocument(DocumentDomainObject document, DocumentDomainObject oldDocument, UserDomainObject user)` Updates published or working document.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DocumentSaver

    public DocumentSaver()

### DocumentSaver

    public DocumentSaver(DocumentMapper documentMapper)

Method Detail

### saveDocumentFragment

    @Transactional
    public void saveDocumentFragment(DocumentDomainObject document,
                                                   UserDomainObject user,
                                                   org.springframework.orm.hibernate3.HibernateCallback hibernateCallback)
                              throws NoPermissionInternalException,
                                     DocumentSaveException

  --experimental-- Existing API saves whole document even if only a fragment of it (say text field or image) was modified. TODO: Create concrete calls: saveText saveImages saveMenus, etc

  Throws:
    `NoPermissionInternalException`
    `DocumentSaveException`

### publishWorkingDocument

    @Transactional
    public void publishWorkingDocument(DocumentDomainObject document,
                                                     UserDomainObject user)

  Published working version of a document.

### updateDocument

    @Transactional
    public void updateDocument(DocumentDomainObject document,
                                             DocumentDomainObject oldDocument,
                                             UserDomainObject user)
                        throws NoPermissionInternalException,
                               DocumentSaveException

  Updates published or working document.

  Throws:
    `NoPermissionInternalException`
    `DocumentSaveException`

### createWorkingDocumentFromExisting

    @Transactional
    public void createWorkingDocumentFromExisting(DocumentDomainObject document,
                                                                UserDomainObject user)
                                           throws NoPermissionInternalException,
                                                  DocumentSaveException

  Creates working document version from existing document. Actually only texts and images are copied into new document.

  Parameters:
    `document` - an instance of `TextDocumentDomainObject`
  Throws:
    `NoPermissionInternalException`
    `DocumentSaveException`

### saveNewDocument

    @Transactional
    public void saveNewDocument(UserDomainObject user,
                                              DocumentDomainObject document,
                                              boolean copying)
                         throws NoPermissionToAddDocumentToMenuException,
                                DocumentSaveException

  Throws:
    `NoPermissionToAddDocumentToMenuException`
    `DocumentSaveException`

### checkIfAliasAlreadyExist

    public void checkIfAliasAlreadyExist(DocumentDomainObject document)
                                  throws AliasAlreadyExistsInternalException

  Throws:
    `AliasAlreadyExistsInternalException`

### getDocumentMapper

    public DocumentMapper getDocumentMapper()

### setDocumentMapper

    public void setDocumentMapper(DocumentMapper documentMapper)

### getMetaDao

    public MetaDao getMetaDao()

### setMetaDao

    public void setMetaDao(MetaDao metaDao)