<wcm:initworkspace user="<%= request.getUserPrincipal() %>" />
<%
String libraryName="library Name";
String strConfigSiteArea = "SiteAreaName";
HashMap contentItemsMap = new HashMap();
ArrayList contentItemsList = new ArrayList();
try{
wcmWorkspace.setCurrentDocumentLibrary(wcmWorkspace.getDocumentLibrary(libraryName));
DocumentIdIterator docIds=wcmWorkspace.findByName(DocumentTypes.SiteArea,strConfigSiteArea);
if(docIds.hasNext()){
DocumentId siteAreaID = (DocumentId)docIds.nextId();
SiteArea configSiteArea = (SiteArea)wcmWorkspace.getById(siteAreaID);
DocumentIdIterator contentItemIds = configSiteArea.getAllDirectChildren();
while(contentItemIds.hasNext()) {
DocumentId contentItemId = (DocumentId)contentItemIds.nextId();
if(contentItemId.getType().toString().equalsIgnoreCase(DocumentTypes.Content.toString())){
Content childContent = (Content)wcmWorkspace.getById(contentItemId);
contentItemsList.add(childContent.getName());
contentItemsMap.put(childContent.getName(),childContent);
}
}
}
}Catch(Exception e){
out.println("Error while retrieving contnet Items");
}
%>
No comments:
Post a Comment