use of org.olat.ims.cp.objects.CPDependency in project openolat by klemens.
the class CPCore method findReferencesToResource.
/**
* Searches for <item>-elements or <dependency>-elements which references to
* the resource with id "resourceIdentifier"
*
* if an element is found, search is aborted and the found element is returned
*
* @param resourceIdentifier
* @return the found element or null
*/
public DefaultElement findReferencesToResource(String resourceIdentifier) {
// search for <item identifierref="resourceIdentifier" >
for (Iterator<CPOrganization> it = rootNode.getOrganizations().getOrganizationIterator(); it.hasNext(); ) {
CPOrganization org = it.next();
for (Iterator<CPItem> itO = org.getItems().iterator(); itO.hasNext(); ) {
CPItem item = itO.next();
CPItem found = _findReferencesToRes(item, resourceIdentifier);
if (found != null)
return found;
}
}
// search for <dependency identifierref="resourceIdentifier" >
for (Iterator<CPResource> itRes = rootNode.getResources().getResourceIterator(); itRes.hasNext(); ) {
CPResource res = itRes.next();
for (Iterator<CPDependency> itDep = res.getDependencyIterator(); itDep.hasNext(); ) {
CPDependency dep = itDep.next();
if (dep.getIdentifierRef().equals(resourceIdentifier))
return dep;
}
}
return null;
}
Aggregations