I have a little problem with the code as below. iterator().hasNext()will never become false, because a function next()always returns the same element. It ends with an endless cycle .
I would like to set the UserLock attribute in each element of the collection (returned from GetElements()). If the item type is “Package”, I will block all the items under the package by recursively calling the lockAllElements function.
private void lockAllElements(String internalGUID) {
Element tempElem = null;
while((repo.GetPackageByGuid(internalGUID).GetElements().iterator().hasNext()) == true) {
tempElem = repo.GetPackageByGuid(internalGUID).GetElements().iterator().next();
if(tempElem.GetType().equals("Package")) {
this.lockAllElements(tempElem.GetElementGUID());
}
tempElem.ApplyUserLock();
}
}
source
share