From beff419a6e9e5ae16e84366d628ca478ab1afdb8 Mon Sep 17 00:00:00 2001 From: Cao Cuong Ngo Date: Mon, 17 Jun 2013 15:17:00 +0200 Subject: CMIS properties Create a CmisPropertyValue with additional DisplayName, Updatable and Required properties. Change-Id: Ia20d76a739ac5c51d7c89ef6f1a40a299697cb0e --- ucb/source/ucp/cmis/cmis_content.cxx | 39 ++++++++++-------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 2f8da9ef13a9..ac206e7cb80e 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -577,14 +578,20 @@ namespace cmis { libcmis::ObjectPtr object = getObject( xEnv ); map< string, libcmis::PropertyPtr >& aProperties = object->getProperties( ); - beans::PropertyValues aCmisProperties( aProperties.size( ) ); - beans::PropertyValue* pCmisProps = aCmisProperties.getArray( ); + uno::Sequence< document::CmisPropertyValue > aCmisProperties( aProperties.size( ) ); + document::CmisPropertyValue* pCmisProps = aCmisProperties.getArray( ); sal_Int32 i = 0; for ( map< string, libcmis::PropertyPtr >::iterator it = aProperties.begin(); it != aProperties.end( ); ++it, ++i ) { - string name = it->first; - pCmisProps[i].Name = STD_TO_OUSTR( name ); + string sId = it->first; + string sDisplayName = it->second->getPropertyType()->getDisplayName( ); + bool isUpdatable = it->second->getPropertyType()->isUpdatable( ); + bool isRequired = it->second->getPropertyType()->isRequired( ); + pCmisProps[i].Id = STD_TO_OUSTR( sId ); + pCmisProps[i].Name = STD_TO_OUSTR( sDisplayName ); + pCmisProps[i].Updatable = isUpdatable; + pCmisProps[i].Required = isRequired; pCmisProps[i].Value = lcl_cmisPropertyToUno( it->second ); } xRow->appendObject( rProp.Name, uno::makeAny( aCmisProperties ) ); @@ -594,30 +601,6 @@ namespace cmis xRow->appendVoid( rProp ); } } - else if ( rProp.Name == "CmisPropertiesDisplayNames" ) - { - try - { - libcmis::ObjectPtr object = getObject( xEnv ); - map< string, libcmis::PropertyPtr >& aProperties = object->getProperties( ); - beans::PropertyValues aCmisProperties( aProperties.size( ) ); - beans::PropertyValue* pCmisProps = aCmisProperties.getArray( ); - sal_Int32 i = 0; - for ( map< string, libcmis::PropertyPtr >::iterator it = aProperties.begin(); - it != aProperties.end( ); ++it, ++i ) - { - string name = it->first; - string displayName = it->second->getPropertyType()->getDisplayName( ); - pCmisProps[i].Name = STD_TO_OUSTR( name ); - pCmisProps[i].Value = uno::makeAny( STD_TO_OUSTR( displayName ) ); - } - xRow->appendObject( rProp.Name, uno::makeAny( aCmisProperties ) ); - } - catch ( const libcmis::Exception& ) - { - xRow->appendVoid( rProp ); - } - } else if ( rProp.Name == "IsVersionable" ) { try -- cgit