on 07-16-2012 6:22 AM
Hi All,
I am working on a scripting requirement i.e. In project, only those users can be assigned as 'Director' collaborator Role if that particular user is not having security profile as 'BPO User'.
a) There is no IAPI method available to retrieve the security profiles from the particular user account. So used method getCollectionMetadata("ROLES") for extracting the same. But its giving null pointer exception whenever I try to extract its field values.
b) I have tried via extracting the value from database, through scripting.
But both these ways are not working.
Can anyone suggest me some other alternative.
Your help is appreciated.
Thanks,
Anshu
Hi,
Do you think you could post a snippet of the script so we can have a look at how it stands and where it should go?
Thanks,
Paul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Paul,
PFB the piece of code which I had written in which I am able to retrieve only one of he security profiles assigned to the user instead of extracting the collection.
member=doc.getCollaborators().get(0);
ApplicationException db5 = new ApplicationException(session);
try
{
dbHandle = session.getDbHandle();
dbHandle.beginTransaction();
ProObjectId = member.getObjectReference().getObjectId().toString();
userNameObjectId = dbHandle.executeIsolatedQuery("select USER_NAME_OBJECT_ID from FCI_DOC_COLLABORATOR where OBJECTID="+ProObjectId);
//throw doc.createApplicationException(null,userNameObjectId.toString());
userObjectId = dbHandle.executeIsolatedQuery("select OBJECTID from FCI_UPP_USER_ACCOUNT where OBJECTID ="+userNameObjectId);
//throw doc.createApplicationException(null,userObjectId.toString());
roleObjectId = dbHandle.executeIsolatedQuery("select OBJECTID from FCI_UPP_ROLE_REF where PARENT_OBJECT_ID ="+userObjectId);
//throw doc.createApplicationException(null,roleObjectId2.toString());
rolename = dbHandle.executeIsolatedQuery("select DISPLAY_NAME from FCI_UPP_ROLE where OBJECTID ="+roleObjectId);
throw doc.createApplicationException(null,rolename.toString());
dbHandle.endTransaction();
}
catch (Exception e)
{
db5.chainAtEnd(doc.createApplicationException("null",e.getMessage()));
}
finally
{
if (dbHandle != null @and dbHandle.isInsideTransaction())
{
dbHandle.abortTransaction();
}
}
if (db5.getChain() != null)
{
throw db5.getChain();
}
Please have a look and let me know where I am wrong.
Thanks.
Hi Anshu,
I haven't studied your code thoroughly but I think the problem is in using the executeIsolatedQuery() method. This method is used when the query is expected to return a single value only.
Try using the executeQuery() method. This will return the entire result set. You can then iterate over the result by calling the dbHandle.next() method and fetch values from columns using any of the getters that are available for the dbHandle.
If this too returns a single value then we shall try to look into the code.
Thanks
Devesh
Hi Anshu,
If executeIsolatedQuery() is returning a value it is highly unlikely that executeQuery() should return null. Did you go through the iapiDbHandleIfc APIs? Please see that everything is in correct format and then try to iterate over the result set.
It would be good if we could see the code snippet that you used.
Thanks
Devesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.