public class DocumentModelFactory extends Object
DocumentModel
and a Document
for creation / update.Modifier and Type | Method and Description |
---|---|
static DataModel |
createDataModel(Document doc,
Schema schema)
Creates a data model from a document and a schema.
|
static DocumentModelImpl |
createDocumentModel(Document doc,
String sid,
String[] schemas)
Creates a document model for an existing document.
|
static DocumentModelImpl |
createDocumentModel(String docType)
Returns a document model computed from its type, querying the
SchemaManager service. |
static DocumentModelImpl |
createDocumentModel(String sessionId,
DocumentType docType)
Creates a document model for a new document.
|
static DocumentModel |
createDocumentModel(String type,
String id)
Create an empty documentmodel for a given type with its id already setted.
|
protected static Prefetch |
getPrefetch(Document doc,
PrefetchInfo prefetchInfo,
Set<String> docSchemas)
Prefetches from a document.
|
protected static boolean |
isScalarField(Field field)
Checks if a field is a primitive type or array.
|
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.
|
public static DocumentModelImpl createDocumentModel(Document doc, String sid, String[] schemas)
doc
- the documentsid
- the session id for this documentschemas
- the schemas to prefetch (deprecated), or null
public static DocumentModelImpl createDocumentModel(String docType)
SchemaManager
service.
The created document model is not linked to any core session.
public static DocumentModelImpl createDocumentModel(String sessionId, DocumentType docType)
Initializes the proper data models according to the type info.
sessionId
- the CoreSession iddocType
- the document typepublic static DataModel createDataModel(Document doc, Schema schema)
public static DocumentModel writeDocumentModel(DocumentModel docModel, Document doc)
public static DocumentModel.DocumentModelRefresh refreshDocumentModel(Document doc, int flags, String[] schemas) throws LifeCycleException
LifeCycleException
protected static Prefetch getPrefetch(Document doc, PrefetchInfo prefetchInfo, Set<String> docSchemas)
protected static boolean isScalarField(Field field)
public static DocumentModel createDocumentModel(String type, String id)
type
- id
- Copyright © 2016 Nuxeo SA. All rights reserved.