public Document cmisDocument ( CmisObject cmisObject ) { org . apache . chemistry . opencmis . client . api . Document doc = ( org . apache . chemistry . opencmis . client . api . Document ) cmisObject ; DocumentWriter writer = newDocument ( ObjectId . toString ( ObjectId . Type . OBJECT , doc . getId ( ) ) ) ; ObjectType objectType = cmisObject . getType ( ) ; if ( objectType . isBaseType ( ) ) { writer . setPrimaryType ( NodeType . NT_FILE ) ; } else { writer . setPrimaryType ( objectType . getId ( ) ) ; } List < Folder > parents = doc . getParents ( ) ; ArrayList < String > parentIds = new ArrayList < String > ( ) ; for ( Folder f : parents ) { parentIds . add ( ObjectId . toString ( ObjectId . Type . OBJECT , f . getId ( ) ) ) ; } writer . setParents ( parentIds ) ; writer . addMixinType ( NodeType . MIX_REFERENCEABLE ) ; writer . addMixinType ( NodeType . MIX_LAST_MODIFIED ) ; // document specific property conversation cmisProperties ( doc , writer ) ; writer . addChild ( ObjectId . toString ( ObjectId . Type . CONTENT , doc . getId ( ) ) , JcrConstants . JCR_CONTENT ) ; writer . addMixinType ( "mode:accessControllable" ) ; writer . addChild ( ObjectId . toString ( ObjectId . Type . ACL , cmisObject . getId ( ) ) , "mode:acl" ) ; return writer . document ( ) ; }
Translates cmis document object to JCR node .