on 09-26-2005 10:43 AM
Hi ,
In my webdynpro view i have a LinkToUrl button.I want to supply a URL to this button property Reference.
I have a HTML file in KM under documents/mydocs/test.html
my coding looks like this
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
IResourceContext resourceContext = new ResourceContext(ep5User);
IResourceFactory resourceFactory = ResourceFactory.getInstance();
RID pathRID = RID.getRID(wdContext.currentContextElement().getPath());
IResource resource = resourceFactory.getResource(pathRID, resourceContext);
after this coding,i dont know how to get the URL or full path.I have checked getTargetUrl but it returns null.
Can someone help me with this. ??
The complete path is
"http://server:port/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docsdocuments/mydocs/test.html"
You can also omit the "http://server:port" part.
You can get all the documents inside the folder by the following
IResource resource = resourceFactory.getResource(ridpath,
resourceContext);
// cast the object to a Collection
ICollection collection = (ICollection) resource;
// get the Collection's children
IResourceList resourceList = collection.getChildren();
// and finally get an iterator to walk through the set of children
IResourceListIterator resourceListIterator = resourceList.listIterator();
while (resourceListIterator.hasNext()) {
// and create a new context element for each of them
IResource tempResource = resourceListIterator.next();
fileName = tempResource.getName();
}
You can refer this weblog
free to ask more
award points. if useful.
Geogi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
This is the code for opening the document on clicking the link.The body of the function is below.
IWDWindow newwindow = wdComponentAPI.getWindowManager().createExternalWindow( "http://<servername>:<port>/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs"wdContext.currentContextElement().getPath()"/"+name,"from km repository",false);
newwindow.open();
(Here Path=/documents/mydocs and variable name=test.html)
Regards
Geogi
Try something like:
IURLGeneratorService generator = (IURLGeneratorService)ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
IUriReference target = generator.getRelativeUri(PathKey.CONTENT_ACCESS_PATH).appendPath(res.getRID().toExternalForm());
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.