// Get the workspace
Workspace workspace = Repository.getWorkspace(
"admin user id"
,
"admin user id Password"
);
// set current working library
workspace.setCurrentDocumentLibrary(workspace.getDocumentLibrary("name of the library where you have your components"));
// retrieve library component
DocumentIdIterator docIds=workspace.findByName(DocumentTypes.LibraryComponent,"component name");
if (docIds.hasNext()){
DocumentId did = (DocumentId)docIds.next();
LibraryComponent libComp = (LibraryComponent)workspace.getById(did);
if (docIds.hasNext()){
DocumentId did = (DocumentId)docIds.next();
LibraryComponent libComp = (LibraryComponent)workspace.getById(did);
// Create the rendering context
RenderingContext context = workspace.createRenderingContext(portletRequest,
portletResponse,
new
HashMap(),
"connect"
);
// Set the path to the content to be rendered
context.setRenderedContent(
"/Library1/SiteA/SiteArea1/SiteArea1-1/myContent(refer some default content)"
);
// Get the rendered string
String renderedContent = workspace.render(context,
libComp );
No comments:
Post a Comment