CMIS - Folder creation with namespace
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 11:54 AM
Hi everyone,
After upgrading alfresco environment from 3.4.d to 4.0.e if i create a folder with this code :
where "F:test:folder" is a folder type that i created :
this query returns empty result even though there is some documents inside the folder :
But if i change "test" with "cm" the results are shown.
Thank you.
After upgrading alfresco environment from 3.4.d to 4.0.e if i create a folder with this code :
Folder rootFolder = getSession().getRootFolder();Map<String, Object> lFolderProps = new HashMap<String, Object>();lFolderProps.put(PropertyIds.NAME, "folder test");lFolderProps.put(PropertyIds.OBJECT_TYPE_ID, "F:test:folder");rootFolder.createFolder(lFolderProps);
where "F:test:folder" is a folder type that i created :
<type name="test:folder"> <title>Test type folder</title> <parent>cm:folder</parent></type>
this query returns empty result even though there is some documents inside the folder :
SELECT * FROM cmis:document D WHERE CONTAINS(D,'PATH:"/app:company_home/test:folder_x0020_test//*"')
But if i change "test" with "cm" the results are shown.
Thank you.
Labels:
- Labels:
-
Archive
8 REPLIES 8
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 12:54 PM
I'm using 5.0 Its working for me.
SELECT * FROM test:folder
should work.
And does SELECT * FROM cmis:folder show your folder?
EDIT - Just spotted that your path is wrong. Its a cm:contains relationship and by convention that name is used to make an assoc name of cm:{sanitised name}
The app namespace for company home and a few other folders is odd.
Use the node browser if you are unsure of the fully qualified path.
PATH:"/app:company_home/cm:folder_x0020_test
SELECT * FROM test:folder
should work.
And does SELECT * FROM cmis:folder show your folder?
EDIT - Just spotted that your path is wrong. Its a cm:contains relationship and by convention that name is used to make an assoc name of cm:{sanitised name}
The app namespace for company home and a few other folders is odd.
Use the node browser if you are unsure of the fully qualified path.
PATH:"/app:company_home/cm:folder_x0020_test
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 01:03 PM
Yes both queries shows me the folder i created. the problem is only when i want to list documents with the query i posted.
EDIT : is there a solution to make my query work ? because we already have data from the version 3.4.d that's accessed with that query
EDIT : is there a solution to make my query work ? because we already have data from the version 3.4.d that's accessed with that query
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 09:39 PM
The correct query is
SELECT * FROM cmis:document D WHERE CONTAINS(D,'PATH:"/app:company_home/cm:folder_x0020_test//*"')
Your query is wrong ,it will not work,becuase:
test:folder_x0020_test
is the qualified name of the child association,it is made up using your PropertyIds.NAME("folder test") as local name and cm: as prefix.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2014 07:30 AM
how come my query works with the existing folders (data from 3.4.d , we were using Alfresco WS to create folders and now CMIS) ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2014 07:46 AM
So you used a different interface! That's a big difference.
There is either a bug/feature in your code or alfresco's that its created an assoc with an unexpected namespace. That's not necessarily wrong but there may be bits of alfresco (or your queries) expecting the cm namespace.
For the avoidance of doubt PATH:"/app:company_home/cm:folder_x0020_test is the correct path that I would expect and alfresco would create itself with "create folder" from one of the UIs.
There is either a bug/feature in your code or alfresco's that its created an assoc with an unexpected namespace. That's not necessarily wrong but there may be bits of alfresco (or your queries) expecting the cm namespace.
For the avoidance of doubt PATH:"/app:company_home/cm:folder_x0020_test is the correct path that I would expect and alfresco would create itself with "create folder" from one of the UIs.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2014 12:02 PM
Thank you all for you replies.
i think i'm going to change the namespace of the already created folders with a sql script. is it possible ? if yes, which tables i have to use ?
EDIT : after looking into alfresco database the child associations are stored in the table : alf_child_assoc and the qname_ns_id define the id of the namespace.
i think i'm going to change the namespace of the already created folders with a sql script. is it possible ? if yes, which tables i have to use ?
EDIT : after looking into alfresco database the child associations are stored in the table : alf_child_assoc and the qname_ns_id define the id of the namespace.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2014 02:27 AM
Folder name(in facts all nodes' name) are saved in alf_node_properties table,and parent-child relationship are saved in alf_child_assoc table.
So you can update "qname" related columns in alf_node_properties and alf_child_assoc table and then rebuild index.
And make sure you have make a backup of these tables before you update them.
So you can update "qname" related columns in alf_node_properties and alf_child_assoc table and then rebuild index.
And make sure you have make a backup of these tables before you update them.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2014 07:20 AM
Great that confirms my thoughts.
thank you again kaynezhang & mrogers for your replies and your time.
thank you again kaynezhang & mrogers for your replies and your time.