Package org.nuxeo.ecm.core.api
Class DocumentModelFactory
- java.lang.Object
-
- org.nuxeo.ecm.core.api.DocumentModelFactory
-
public class DocumentModelFactory extends Object
Bridge between aDocumentModel
and aDocument
for creation / update.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static DataModel
createDataModel(Document doc, Schema schema)
Creates a data model from a document and a schema.static DocumentModelImpl
createDocumentModel(String docType)
Returns a document model computed from its type, querying theSchemaManager
service.static DocumentModel
createDocumentModel(String type, String id)
Deprecated.since 11.1, unusedstatic DocumentModelImpl
createDocumentModel(String typeName, DocumentRef parentRef, CoreSession coreSession)
Creates a document model for a new document.static DocumentModelImpl
createDocumentModel(Document doc, CoreSession coreSession)
Creates a document model for an existing document.static DocumentModel.DocumentModelRefresh
refreshDocumentModel(Document doc, int flags, String[] schemas)
Gets what's to refresh in a model (except for the ACPs, which need the session).static DocumentModel
writeDocumentModel(DocumentModel docModel, Document doc)
Writes a document model to a document.static DocumentModel
writeDocumentModel(DocumentModel docModel, Document doc, boolean create)
Writes a document model to a document.
-
-
-
Method Detail
-
createDocumentModel
public static DocumentModelImpl createDocumentModel(Document doc, CoreSession coreSession)
Creates a document model for an existing document.- Parameters:
doc
- the document- Returns:
- the new document model
-
createDocumentModel
public static DocumentModelImpl createDocumentModel(String docType)
Returns a document model computed from its type, querying theSchemaManager
service.The created document model is not linked to any core session.
- Since:
- 5.4.2
-
createDocumentModel
public static DocumentModelImpl createDocumentModel(String typeName, DocumentRef parentRef, CoreSession coreSession)
Creates a document model for a new document.Initializes the proper data models according to the type info.
- Parameters:
typeName
- the document typeparentRef
- the parent ref- Returns:
- the document model
- Since:
- 11.1
-
createDataModel
public static DataModel createDataModel(Document doc, Schema schema)
Creates a data model from a document and a schema. If the document is null, just creates empty data models.
-
writeDocumentModel
public static DocumentModel writeDocumentModel(DocumentModel docModel, Document doc)
Writes a document model to a document. Returns the re-read document model.
-
writeDocumentModel
public static DocumentModel writeDocumentModel(DocumentModel docModel, Document doc, boolean create)
Writes a document model to a document. Returns the re-read document model.- Since:
- 11.1
-
refreshDocumentModel
public static DocumentModel.DocumentModelRefresh refreshDocumentModel(Document doc, int flags, String[] schemas) throws LifeCycleException
Gets what's to refresh in a model (except for the ACPs, which need the session).- Throws:
LifeCycleException
-
createDocumentModel
@Deprecated public static DocumentModel createDocumentModel(String type, String id)
Deprecated.since 11.1, unusedCreate an empty documentmodel for a given type with its id already setted. This can be useful when trying to attach a documentmodel that has been serialized and modified.- Since:
- 5.7.2
-
-