diff options
Diffstat (limited to 'ucb/source/ucp/cmis/cmis_content.cxx')
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 43f8c35afc04..4bc7c3c6fc7c 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1054,6 +1054,46 @@ namespace cmis return aRet; } + uno::Sequence< document::CmisVersion> Content::getAllVersions( const uno::Reference< ucb::XCommandEnvironment > & xEnv ) + throw( uno::Exception ) + { + try + { + // get the document + libcmis::DocumentPtr pDoc = boost::dynamic_pointer_cast< libcmis::Document >( getObject( xEnv ) ); + if ( pDoc.get( ) == NULL ) + { + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_GENERAL, + uno::Sequence< uno::Any >( 0 ), + xEnv, + "Can not get the document" ); + } + vector< libcmis::DocumentPtr > aCmisVersions = pDoc->getAllVersions( ); + uno::Sequence< document::CmisVersion > aVersions( aCmisVersions.size( ) ); + int i = 0; + for ( vector< libcmis::DocumentPtr >::iterator it = aCmisVersions.begin(); + it != aCmisVersions.end( ); ++it, ++i ) + { + libcmis::DocumentPtr pVersion = *it; + aVersions[i].Id = STD_TO_OUSTR( pVersion->getId( ) ); + aVersions[i].Author = STD_TO_OUSTR( pVersion->getCreatedBy( ) ); + aVersions[i].TimeStamp = lcl_boostToUnoTime( pVersion->getCreationDate( ) ); + } + return aVersions; + } + catch ( const libcmis::Exception& e ) + { + SAL_INFO( "ucb.ucp.cmis", "Unexpected libcmis exception: " << e.what( ) ); + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_GENERAL, + uno::Sequence< uno::Any >( 0 ), + xEnv, + OUString::createFromAscii( e.what() ) ); + } + return uno::Sequence< document::CmisVersion > ( ); + } + void Content::transfer( const ucb::TransferInfo& rTransferInfo, const uno::Reference< ucb::XCommandEnvironment > & xEnv ) throw( uno::Exception ) @@ -1472,6 +1512,9 @@ namespace cmis ucb::CommandInfo ( OUString( "checkIn" ), -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ), ucb::CommandInfo ( OUString( "updateProperties" ), -1, getCppuVoidType() ), + ucb::CommandInfo + ( OUString( "getAllVersions" ), + -1, getCppuType( static_cast<uno::Sequence< document::CmisVersion > * >( 0 ) ) ), // Folder Only, omitted if not a folder @@ -1645,6 +1688,10 @@ namespace cmis } aRet <<= checkIn( aArg, xEnv ); } + else if ( aCommand.Name == "getAllVersions" ) + { + aRet <<= getAllVersions( xEnv ); + } else if ( aCommand.Name == "updateProperties" ) { updateProperties( aCommand.Argument, xEnv ); |