summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-07-02 16:41:01 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-07-04 11:54:36 +0200
commitdc825ad0ba119aaed32bef4ce5f67d59aaa5d1e1 (patch)
tree04df39c885bfb22d320189562244ef288f699175 /ucb
parentf6610381befe2b122fb9a5c38d6522e86b045064 (diff)
CMIS UCP: fallback to URL with id as the mark if we can't get the path
This situation will happen in several cases: * We don't have the permission to retrieve the object parents * For unfiled objects... though I'm still wondering how those could sneak into the UI. Change-Id: I2095334fa1c9152389c5c824e34375bf48bfbedf
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx9
-rw-r--r--ucb/source/ucp/cmis/cmis_content.hxx1
-rw-r--r--ucb/source/ucp/cmis/cmis_datasupplier.cxx8
-rw-r--r--ucb/source/ucp/cmis/cmis_url.cxx23
-rw-r--r--ucb/source/ucp/cmis/cmis_url.hxx2
5 files changed, 39 insertions, 4 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 332d0c732e5c..ff10bd543f40 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -162,6 +162,7 @@ namespace cmis
// Split the URL into bits
m_sURL = m_xIdentifier->getContentIdentifier( );
cmis::URL url( m_sURL );
+ SAL_INFO( "cmisucp", "Content::Content() " << m_sURL );
// Look for a cached session, key is binding url + repo id
rtl::OUString sSessionId = url.getBindingUrl( ) + url.getRepositoryId( );
@@ -174,6 +175,7 @@ namespace cmis
}
m_sObjectPath = url.getObjectPath( );
+ m_sObjectId = url.getObjectId( );
m_sBindingUrl = url.getBindingUrl( );
}
@@ -189,6 +191,7 @@ namespace cmis
// Split the URL into bits
m_sURL = m_xIdentifier->getContentIdentifier( );
cmis::URL url( m_sURL );
+ SAL_INFO( "cmisucp", "Content::Content() " << m_sURL );
// Look for a cached session, key is binding url + repo id
rtl::OUString sSessionId = url.getBindingUrl( ) + url.getRepositoryId( );
@@ -201,6 +204,7 @@ namespace cmis
}
m_sObjectPath = url.getObjectPath( );
+ m_sObjectId = url.getObjectId( );
m_sBindingUrl = url.getBindingUrl( );
// Get the object type
@@ -218,10 +222,13 @@ namespace cmis
{
if ( !m_sObjectPath.isEmpty( ) )
m_pObject = m_pSession->getObjectByPath( OUSTR_TO_STDSTR( m_sObjectPath ) );
+ else if (!m_sObjectId.isEmpty( ) )
+ m_pObject = m_pSession->getObject( OUSTR_TO_STDSTR( m_sObjectId ) );
else
{
m_pObject = m_pSession->getRootFolder( );
m_sObjectPath = "/";
+ m_sObjectId = rtl::OUString( );
}
}
@@ -440,6 +447,8 @@ namespace cmis
{
if ( !m_sObjectPath.isEmpty( ) )
m_pSession->getObjectByPath( OUSTR_TO_STDSTR( m_sObjectPath ) );
+ else if ( !m_sObjectId.isEmpty( ) )
+ m_pSession->getObject( OUSTR_TO_STDSTR( m_sObjectId ) );
// No need to handle the root folder case... how can it not exists?
}
catch ( const libcmis::Exception& )
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index e98c88d0fd33..e61a223b147a 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -72,6 +72,7 @@ private:
libcmis::Session* m_pSession;
libcmis::ObjectPtr m_pObject;
rtl::OUString m_sObjectPath;
+ rtl::OUString m_sObjectId;
rtl::OUString m_sURL;
rtl::OUString m_sBindingUrl;
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
index edddc9e8e3b9..29458b27ff1b 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.cxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
@@ -96,7 +96,13 @@ namespace cmis
vector< string > paths = maResults[nIndex]->pObject->getPaths( );
if ( paths.size( ) > 0 )
sObjectPath = paths.front( );
- // TODO Handle the unfiled objects with their id... but can they manage to come here?
+ else
+ {
+ // Handle the unfiled objects with their id...
+ // They manage to sneak here if we don't have the permission to get the object
+ // parents (and then the path)
+ sObjectPath += "#" + maResults[nIndex]->pObject->getId( );
+ }
// Get the URL from the Path
URL aUrl( mxContent->getIdentifier( )->getContentIdentifier( ) );
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
index d7a8e7ede8f7..3357a247c3ed 100644
--- a/ucb/source/ucp/cmis/cmis_url.cxx
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -57,6 +57,10 @@ namespace cmis
// Store the path to the object
m_sPath = aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
+ m_sId = aUrl.GetMark( );
+
+ if ( !m_sId.isEmpty( ) )
+ m_sPath = rtl::OUString( );
}
map< int, string > URL::getSessionParams( )
@@ -75,6 +79,11 @@ namespace cmis
return m_sPath;
}
+ rtl::OUString& URL::getObjectId( )
+ {
+ return m_sId;
+ }
+
rtl::OUString& URL::getBindingUrl( )
{
return m_sBindingUrl;
@@ -88,6 +97,7 @@ namespace cmis
void URL::setObjectPath( rtl::OUString sPath )
{
m_sPath = sPath;
+ m_sId = rtl::OUString( );
}
rtl::OUString URL::asString( )
@@ -100,9 +110,16 @@ namespace cmis
RTL_TEXTENCODING_UTF8 );
sUrl = "vnd.libreoffice.cmis+atom://" + sEncodedBinding;
- if ( m_sPath[0] != '/' )
- sUrl += "/";
- sUrl += m_sPath;
+ if ( !m_sPath.isEmpty( ) )
+ {
+ if ( m_sPath[0] != '/' )
+ sUrl += "/";
+ sUrl += m_sPath;
+ }
+ else if ( !m_sId.isEmpty( ) )
+ {
+ sUrl += "#" + m_sId;
+ }
return sUrl;
}
diff --git a/ucb/source/ucp/cmis/cmis_url.hxx b/ucb/source/ucp/cmis/cmis_url.hxx
index 4033a176a2c3..3d416901cf29 100644
--- a/ucb/source/ucp/cmis/cmis_url.hxx
+++ b/ucb/source/ucp/cmis/cmis_url.hxx
@@ -42,6 +42,7 @@ namespace cmis
rtl::OUString m_sBindingUrl;
rtl::OUString m_sRepositoryId;
rtl::OUString m_sPath;
+ rtl::OUString m_sId;
rtl::OUString m_sUser;
rtl::OUString m_sPass;
@@ -50,6 +51,7 @@ namespace cmis
std::map< int, std::string > getSessionParams( );
rtl::OUString& getObjectPath( );
+ rtl::OUString& getObjectId( );
rtl::OUString& getBindingUrl( );
rtl::OUString& getRepositoryId( );
void setObjectPath( rtl::OUString sPath );