on 09-09-2008 1:05 PM
Hi All,
I have to build an application that should be able to display a table containing the details of a folder present in KM with the assigned permission(Whatever the permissions it have ).
Pls help me in this regard.
Thanks in advance
Hi Srikant,
i too am working on listing the content of the folders in the KM and i am struck at a point , can you send me the example how to list all the content of folders in km in nwds.
cheers
zain
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi zain,
First of all i am sorry for the late reply....
i am pasting the code below ,what i have done. My main aim is to display the folder's permissions along with the folder names...
Please go thru it......
and one more thing u can find an application related to your requirement in SDN .its name is TutWD_KMBrowser.
IResourceFactory resourseFactory = ResourceFactory.getInstance();
String rid1 = "<your required path(may be "/" or "/folder")>";
RID rid = RID.getRID(resourceID);
RID rid2 = RID.getRID(rid1);
if (rid == null || rid.length() == 0)
{
// rid = RID.getRID(resourceID);
rid2 = RID.getRID(rid1);
}
ICollection collection =
(ICollection) resourseFactory.getResource(rid2,context);
IResource resource = ResourceFactory.getInstance().getResource(rid2, context);
IContent content = resource.getContent();
msgMngr.reportSuccess("Content "+ content.toString());
ISecurityManager sm = resource.getRepositoryManager().getSecurityManager(resource);
msgMngr.reportSuccess("entering security amanger "+sm.toString() );
if(sm != null && sm instanceof IAclSecurityManager){
IAclSecurityManager asm = (IAclSecurityManager)sm;
IResourceAclManager ram = asm.getAclManager();
IResourceAcl rac = ram.getAcl(resource);
IResourceAclEntryList permissions = rac.getEntries();
msgMngr.reportSuccess("outside security manager" ); //iterates the list
IResourceAclEntryListIterator iter = permissions.iterator();
IResourceAclEntryListIterator iter = permissions.iterator();
msgMngr.reportSuccess("outside security manager1" );
while(iter.hasNext())
{
IResourceAclEntry abc = iter.next();
msgMngr.reportSuccess(abc.getPrincipal().getDisplayName());
msgMngr.reportSuccess(abc.getPermission().getName());
}
}
ArrayList arr = new ArrayList();
for(IResourceListIterator itr = collection.getChildren().listIterator(); itr.hasNext();) {
IResource res = (IResource)itr.next();
IPrivateKM_TaxonomyView.IKMContentElement contentElem = null;
contentElem = wdContext.nodeKMContent().createKMContentElement();
contentElem.setIslocked(res.isLocked());
contentElem.setName(res.getDisplayName(true));
contentElem.setModifiedby(res.getLastModifiedBy());
contentElem.setModifieddate(res.getLastModified()!= null?res.getLastModified().toLocaleString():"");
//contentElem.setUrl(generateUrlForIResource(res));
try{
String str=res.getContent().getContentLength()+"";
// contentElem.setSize(res.getContent().getContentLength());
contentElem.setSize(str);
contentElem.setType(res.getContent().getContentType());
}catch(Exception e){
msgMngr.reportSuccess(contentElem.getName() + " >> " + e.toString());
}
arr.add(contentElem);
}
wdContext.nodeKMContent().bind(arr);
Hope this helps you.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.