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-03 17:08:11 +0200
commit735e9b090edf1a315823577d5d2da8c671a3d139 (patch)
tree0f6ef1dfee66788eb621b2b96557998ea4da90f5 /ucb
parentca5b90292df238ab44f740080356dff01bd73176 (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 dbc9332a80f9..057b3d62704d 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 359aaaa46105..28ff5cd14d25 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -71,6 +71,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 710f82a0824a..c459dde42f11 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.empty( ) )
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 );