Documentum - getting a list of sub folders - documentum

Is there a way in Documentum to get all sub folders of a folder? Can someone suggest a DQL or some thing where I can specify a parent folder and the DQL returns me a folder path of all the sub folders.

select distinct r_folder_path from dm_folder where folder('/Folder1/Folder2', descend)
This will return all the folders and subfolders under /Folder1/Folder2

One thing to keep in mind:
Documentum supports linking objects to multiple parent folders. This means that one folder can have multiple parent folders.
If you have a folder structure like this
Cabinet1
/Test1
/Test3
/Test2/
/Test3
Where Test3 is sub folder of Test1 but also of (as it can be linked to) Test2!
Documentum acomplishes this using repeating attributes. r_folder_path is a repating attribute of dm_folder (actually of dm_sysobject which is it's super type).
So, running a DQL :
select distinct r_folder_path from dm_folder where folder('/Folder1/Folder2', descend)
will return all folder paths your folder is part of (linked to):
/Cabinet1/Test1/Test3
/Cabinet1/Test2/Test3
Which might not be what you are looking for!
As DQL does not allow you to specify which repeating attribute value (you can not specify the index of repeating attribute) to be returned there is not elegant ( and fail safe) way to do it in DQL.
What you can do is to fetch all object_name of subfolders and prefix them with folder path of the parent folder you used in search (but that is with some coding).
Check Documentum Content Server System Object Reference guide (it is available on EMC developer community or for now also here)

Related

How to iterate through node while there is a relationship

I have nodes that are structured like folder, subfolder and files. Any folder can have a relationship with a subfolder, which can have a relationship with another subfolder, which can have a relationship with files. I'd like to iterate through every folder to find every subfolder and files inside a given folder.
In one query, I'd like to be able to get every file that is inside a folder or in his subfolders. I can't find any way to do it with Cypher. I saw FOREACH and UNWIND but I don't think it helps me.
Assuming you have labelled the nodes accordingly as Folder and File, the following query will fetch all the files belonging to the starting folder, directly or through a chain of one or more sub-folders:
MATCH(ParentFolder:Folder)-[*]->(childFile:File)
WHERE ParentFolder.name='Folder1'
RETURN childFile
If you haven't used Labels (highly recommend using them), you can look for all the paths starting with the specified folder and find all the last nodes in that path.
MATCH(ParentFolder)-[*]->(childFile)
WHERE ParentFolder.name='Folder1' AND NOT (childFile)-->()
RETURN childFile
The second query will fetch all the terminal nodes, even if they are folders. You would have to use labels or add filters in the where clause to ensure only files are fetched for childFile.
Both versions of the query work based on varying length paths. The wild character(*) retrieves all paths of any length starting from ParentFolder.

Azure ADF GetMetadata childItems if folder might not exist

I have a path to DataLakeStorage, which may or may not exist.
I want to iterate over the contents of that folder, if it exists.
In C# I would arrange to have a children collection, that was empty if the folder didn't exist, and then iterate over that (possibly empty) collection.
Can I do the same in ADF (v2)?
If I do a Get Metadata activity returning both exists and childItems, then it nearly works:
It works if the folder does exist
It doesn't error if the folder does NOT exist.
But the childItems property is not defined if the folder doesn't exist, so I don't get an empty array to iterate over.
The first solution that comes to mind is to try to build Azure ADF expression that returns either an existing array, or an empty array, based on a bool, which I've asked as a direct question. But if there's a nicer / more idiomatic approach, then I'm open to that too :)
Please try something like this:
1.create a variable,type is array,value is empty,like this:
2.create a For Each activity which depends on your Get Metadata success.
Expression:
#if( contains(activity('Get Metadata1').output,'childitems'), activity('Get Metadata1').output.childitems, variables('emptyArr'))
or
#if( activity('Get Metadata1').output.exists, activity('Get Metadata1').output.childitems, variables('emptyArr'))
Below is my test:
Scenario one:path exists
Scenario two:path not exists
Hope this can help you:)

How do I delete folders recursively using DQL?

I work on an application using Documentum.
Let's say I have the following structure :
MyCabinetName
|->Folder 1
|->Folder 2
|-> Folder 3
I am trying to delete all the folders inside a cabinet.
I am running the following DQL query :
delete dm_folder objects where folder ('MyCabinetName', DESCEND);
But when I run the query, I get a DQL ERROR :
[DM_FOLDER_E_CANT_DESTROY]error : "Cannot destroy folder with path name /MyCabinetName/Folder1 as it is not empty
I thought my query would delete recursively all folders inside MyCabinetName, but it does not seem to be the case, for if I run :
delete dm_folder objects where folder ('MyCabinetName/Folder1/Folder2', DESCEND);
and then
delete dm_folder objects where folder ('MyCabinetName/Folder1', DESCEND);
delete dm_folder objects where folder ('MyCabinetName/Folder3', DESCEND);
then
delete dm_folder objects where folder ('MyCabinetName', DESCEND);
will work.
Problem is that in real life, I don't know what my folder tree looks like. I just know the name of the cabinet whose content I want to delete.
Is there any way to delete a cabinet and its content recursively without having to delete each folder one by one?
It is not possible to delete folder with deep folder structure by DQL.
But you can do it by Delete Operation, it means you can write a tool in Java, Groovy, ...
Here is an example how to do that:
IDfDeleteOperation operation = new DfClientX().getDeleteOperation();
operation.setVersionDeletionPolicy(IDfDeleteOperation.ALL_VERSIONS);
operation.setDeepFolders(true);
operation.add("/MyCabinetName");
if (!operation.execute()) {
IDfList errors = operation.getErrors();
// process errors
}
This line operation.setDeepFolders(true) instructs the operation to delete the folder with all sub-folders and other objects contained in the structure.

Alfresco lucene search cannot find folder

I have a folder in document library of a site. I want to find all content of that folder. Running following lucene/alfresco-fts query in Node Browser returns No items found:
PATH:"/app:company_home/st:sites/cm:mysite/cm:documentLibrary/cm:MyFolder/*"
Which is wrong, as I have documents in that folder and running same query for different folder returns proper result. Another strange thing is that I cannot get this folder: following query also returns No items found:
PATH:"/app:company_home/st:sites/cm:mysite/cm:documentLibrary/cm:MyFolder"
Also if I get content of document library then MyFolder is skipped in the results and subfolder is returned:
PATH:"/app:company_home/st:sites/cm:mysite/cm:documentLibrary/*"
Name | Parent
--------------|---------------------
cm:MyFolder2 | /app:company_home/st:sites/cm:mysite/cm:documentLibrary
cm:MySubfolder| /app:company_home/st:sites/cm:mysite/cm:documentLibrary/cm:MyFolder
I have checked the aspects and properties of MyFolder and they are the same as MyFolder2. I do not have any custom behaviours/rules/etc.
How can I make first lucene query work and return content of MyFolder?
Try updating metadata on the folder so Solr re-indexes it. You could also get its db id and then tell solr to re-index it by db id. If it has over 1000 children, a FTS query may fail. - Known issue. Try using a txmd query.
I would suggest you to get the node ref of the folder from folder details page and search in node browser. There you can get the primary path. Please cross verify the path you use to search using lucene or use that primary path to search for the folder in lucene search.
Another possibility is that the locale property(sys:locale) of the folder(MyFolder) will be different from the locale of your browser. Please check whether the locale of MyFolder and the other folders for which result is shown, are same or not. If not that can also be a reason.

Pathname property in IBM FileNet P8 backend database

Appreciate if anyone can tell me which table "PathName" property exists in the backend database of IBM Filenet P8 ECM system.
Thanks.
just for your understanding.
PathName is not simple property like others. It is not present in full form in tables.
Path of Document can have multiple values, cause of document from [DocVersion] table (and custom object from [Generic] table) link with the Folder placed in [Container] table through ReferencialContainmentRelationship object in [Relationship] table.
So you can get the PathName for Document as concatinations of Relationship.Name (ContainmentName) and Container.PathName (* + FolderName) where Relationship.Tail_Id equals DocVersion.Object_Id and Container.Object_Id equals Relationship.Head_Id
You have to use recursion for get Container.**PathName cause of you need to get all parent objects [Container.Parent_Id == (Parent)Container.Object_Id].
Threre is the link for documentation with Tables overview
http://www-01.ibm.com/support/knowledgecenter/SSNW2F_5.2.0/com.ibm.p8.ce.dev.ce.doc/database_table_schemas.htm
But, you have to find another way to get PathName, Tom Purl was right try to query this information via API.