Documentum DFC to check if users exist in the docbase
Currently as part of a tool that has been designed to add users to a role we have been using the following code to add them. However, if it encounters a user that does not exist in the docbase it will stop running there, is there any way to check if the users exist before trying to add them and to then skip over the user that does not exist?
private static void loadUsers(String userfile,IDfGroup group){ System.out.println("Connecting.. and loading file," + userfile); String userName = null; try { FileReader fileReader = new FileReader(userfile); BufferedReader bufferedReader = new BufferedReader(fileReader); while((userName = bufferedReader.readLine()) != null) { System.out.println(userName); group.addUser(userName); group.save(); } bufferedReader.close(); }
Answers
-
Simply Query on dm_user and if you get result then the user exists in doc base else he is not
String dql = "SELECT * from dm_user where user_name =''";
IDfQuery query = new DfQuery();
query.setDQL(dql);
collection = null;
String docName = null;
count = 0;
try {
collection = query.execute(session, IDfQuery.DF_READ_QUERY);
while (collection.next()) {
count++;
break;
}if(count>0)
{
//Add USER
}
else
{
//SKIP User
}} finally {
if (collection != null) {
collection.close();
}
}Regards,
Akshay0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 107 General Questions
- 144 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 119 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- Docker Automation
- LiveSite Content Services (LSCS) REST API
- Single Page Application (SPA) Modules
- TeamSite Add-ons
If you are interested in gaining full access to the content, you can register for a My Support account here.