Class DocumentModelResolver

  • All Implemented Interfaces:
    Serializable, ObjectResolver

    public class DocumentModelResolver
    extends AbstractObjectResolver
    implements ObjectResolver
    This ObjectResolver allows to manage integrity for fields containing DocumentModel references (id or path).

    Resolved references must be either a path or an id, default mode is id. Storing path keep link with place in the Document hierarchy no matter which Document is referenced. Storing id track the Document no matter where the Document is stored.

    All references, id or path, are prefixed with the document expected repository name. For example :

    • default:352c21bc-f908-4507-af99-411d3d84ee7d
    • test:/path/to/my/doc

    The fetch(Object) method returns DocumentModel. The fetch(Class, Object) returns DocumentModel or specific document adapter.

    To use it, put the following code in your schema XSD :

     
     <!-- default resolver is an id based resolver -->
     <xs:simpleType name="favoriteDocument1">
       <xs:restriction base="xs:string" ref:resolver="documentResolver" />
     </xs:simpleType>
    
     <!-- store id -->
     <xs:simpleType name="favoriteDocument2">
       <xs:restriction base="xs:string" ref:resolver="documentResolver" ref:store="id" />
     </xs:simpleType>
    
     <!-- store path -->
     <xs:simpleType name="bestDocumentRepositoryPlace">
       <xs:restriction base="xs:string" ref:resolver="documentResolver" ref:store="path" />
     </xs:simpleType>
     
     
    Since:
    7.1
    See Also:
    Serialized Form