I have a little problem with the code as seen below. The iterator().hasNext()
will never turn into false because the next()
function always returns the same element. It ends in an infinite loop.
I would like to set the attribute UserLock in every element in the collection (returned from GetElements()
). If the type of the element is "Package", I will lock all elements under the package with a recursive call of 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(); } }