Sunday, August 4, 2013

Checking Cross Referencing of contents in IBM WCM Libraries

try

{

Repository repository = WCM_API.getRepository();

Workspace workspace = repository.getWorkspace(request.getUserPrincipal());
String libname="Test-library";

workspace.setCurrentDocumentLibrary(workspace.getDocumentLibrary(libNames));

DocumentIdIterator contentIterator = workspace.findByType(DocumentTypes.Content);

DocumentId contentId = null;

while(contentIterator.hasNext())

{

contentId = contentIterator.nextId();

ArrayList<String> arrayList = new ArrayList<String>();

Reference []ref =workspace.getReferencesFrom(contentId);

for(int i=0 ; i< ref.length ;i++)

{

String refLibName = ref[i].getRefererDocumentId().getContainingLibrary().getName();
System.out.println("--------------Referenced Library Name-------------"+refLibName);

}
}
}

No comments:

Post a Comment