diff options
author | Kai Sommerfeld <kso@openoffice.org> | 2001-09-06 09:37:56 +0000 |
---|---|---|
committer | Kai Sommerfeld <kso@openoffice.org> | 2001-09-06 09:37:56 +0000 |
commit | 5e4220dbe590d7469b6922a1d04bb60ee4852186 (patch) | |
tree | c92e9168263db2284f21bbfd3cdbf03c995273c9 /ucb | |
parent | fc4770d31e6a8face277adb8e5a50c256e8e07b6 (diff) |
#91127# - Non-existing contents no longer support properties "IsFolder",
"IsDocument" and "ContentType".
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav/ContentProperties.cxx | 27 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/ContentProperties.hxx | 7 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/webdavcontent.cxx | 97 | ||||
-rw-r--r-- | ucb/source/ucp/webdav/webdavcontentcaps.cxx | 20 |
4 files changed, 141 insertions, 10 deletions
diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx index 1c0af0530937..b1aed6b778e5 100644 --- a/ucb/source/ucp/webdav/ContentProperties.cxx +++ b/ucb/source/ucp/webdav/ContentProperties.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ContentProperties.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: kso $ $Date: 2001-05-16 14:58:06 $ + * last change: $Author: kso $ $Date: 2001-09-06 10:37:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -250,6 +250,29 @@ ContentProperties::ContentProperties( } //========================================================================= +ContentProperties::ContentProperties( const rtl::OUString & rTitle ) +: aTitle( rTitle ), + pIsDocument( 0 ), + pIsFolder( 0 ), + pSize( 0 ), + pDateCreated( 0 ), + pDateModified( 0 ), + pgetcontenttype( 0 ), + pcreationdate( 0 ), + pdisplayname( 0 ), + pgetcontentlanguage( 0 ), + pgetcontentlength( 0 ), + pgetetag( 0 ), + pgetlastmodified( 0 ), + plockdiscovery( 0 ), + presourcetype( 0 ), + psource( 0 ), + psupportedlock( 0 ), + pOtherProps( 0 ) +{ +} + +//========================================================================= // static void ContentProperties::UCBNamesToDAVNames( const uno::Sequence< beans::Property > & rProps, diff --git a/ucb/source/ucp/webdav/ContentProperties.hxx b/ucb/source/ucp/webdav/ContentProperties.hxx index a2997c81ebbd..098103f61937 100644 --- a/ucb/source/ucp/webdav/ContentProperties.hxx +++ b/ucb/source/ucp/webdav/ContentProperties.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ContentProperties.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: kso $ $Date: 2001-05-16 14:58:06 $ + * last change: $Author: kso $ $Date: 2001-09-06 10:37:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -159,6 +159,9 @@ public: // Mini props for transient contents. ContentProperties( const rtl::OUString & rTitle, sal_Bool bFolder ); + // Micro props for non-existing contents. + ContentProperties( const rtl::OUString & rTitle ); + inline ~ContentProperties(); // Substitutes UCB property names by DAV property names. The list diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index 683a4313656e..6df6987e072f 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -2,9 +2,9 @@ * * $RCSfile: webdavcontent.cxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * - * last change: $Author: kso $ $Date: 2001-07-16 14:08:27 $ + * last change: $Author: kso $ $Date: 2001-09-06 10:37:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1161,6 +1161,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( // Process Core properties. +#if 0 if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) ) { @@ -1192,6 +1193,41 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( else xRow->appendBoolean( rProp, sal_False ); } +#else + if ( rProp.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) ) + { + if ( rData.pIsFolder && *rData.pIsFolder ) + xRow->appendString( rProp, rtl::OUString::createFromAscii( + WEBDAV_COLLECTION_TYPE ) ); + else if ( rData.pIsDocument && *rData.pIsDocument ) + xRow->appendString( rProp, rtl::OUString::createFromAscii( + WEBDAV_CONTENT_TYPE ) ); + else + xRow->appendVoid( rProp ); + } + else if ( rProp.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) + { + xRow->appendString ( rProp, rData.aTitle ); + } + else if ( rProp.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ) + { + if ( rData.pIsDocument ) + xRow->appendBoolean( rProp, *rData.pIsDocument ); + else + xRow->appendVoid( rProp ); + } + else if ( rProp.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ) + { + if ( rData.pIsFolder ) + xRow->appendBoolean( rProp, *rData.pIsFolder ); + else + xRow->appendVoid( rProp ); + } +#endif else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ) { @@ -1358,6 +1394,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( = static_cast< ContentProvider * >( rProvider.get() ); beans::Property aProp; +#if 0 pProvider->getProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ), aProp ); @@ -1385,7 +1422,44 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( xRow->appendBoolean( aProp, *rData.pIsFolder ); else xRow->appendBoolean( aProp, sal_False ); +#else + pProvider->getProperty( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), aProp ); + xRow->appendString( aProp, rData.aTitle ); + + if ( rData.pIsFolder && *rData.pIsFolder ) + { + pProvider->getProperty( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ), aProp ); + xRow->appendString( aProp, rtl::OUString::createFromAscii( + WEBDAV_COLLECTION_TYPE ) ); + } + else if ( rData.pIsDocument && *rData.pIsDocument ) + { + pProvider->getProperty( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ), aProp ); + xRow->appendString( aProp, rtl::OUString::createFromAscii( + WEBDAV_CONTENT_TYPE ) ); + } + + if ( rData.pIsDocument ) + { + pProvider->getProperty( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ), aProp ); + xRow->appendBoolean( aProp, *rData.pIsDocument ); + } + if ( rData.pIsFolder ) + { + pProvider->getProperty( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ), aProp ); + xRow->appendBoolean( aProp, *rData.pIsFolder ); + } +#endif if ( rData.pSize ) { pProvider->getProperty( @@ -1557,8 +1631,25 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { m_xResAccess->PROPFIND( ZERO, aPropNames, resources, xEnv ); } - catch ( DAVException const & ) + catch ( DAVException const & e ) { +#if 1 + if ( ( e.getStatus() == 404 /* not found */ ) || + ( e.getError() == DAVException::DAV_HTTP_LOOKUP ) ) + { + // PROPFIND failed, only Title prop available. + return getPropertyValues( m_xSMgr, + rProperties, + ContentProperties( + NeonUri::unescape( + m_aEscapedTitle ) ), + rtl::Reference< + ::ucb::ContentProviderImplHelper >( + m_xProvider.getBodyPtr() ), + m_xIdentifier->getContentIdentifier() ); + } +#endif + bSuccess = false; } } diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx index 9150a2da3745..5815798a805c 100644 --- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx +++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx @@ -2,9 +2,9 @@ * * $RCSfile: webdavcontentcaps.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: kso $ $Date: 2001-08-30 12:28:43 $ + * last change: $Author: kso $ $Date: 2001-09-06 10:37:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -362,8 +362,22 @@ uno::Sequence< beans::Property > Content::getProperties( // we used a depth of ZERO for PROPFIND. aProps = (*props.begin()).properties; } - catch ( DAVException const & ) + catch ( DAVException const & e ) { +#if 1 + if ( ( e.getStatus() == 404 /* not found */ ) || + ( e.getError() == DAVException::DAV_HTTP_LOOKUP ) ) + { + // Only "Title" available! + uno::Sequence< beans::Property > aProperties( 1 ); + beans::Property aProp; + m_pProvider->getProperty( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), + aProp ); + aProperties[ 0 ] = aProp; + return aProperties; + } +#endif } sal_Int32 nTotal = aProps.size(); |