use of io.milton.resource.DeletableCollectionResource in project lobcder by skoulouzis.
the class DeleteHelperImpl method isLockedOut.
@Override
public boolean isLockedOut(Request req, Resource r) throws NotAuthorizedException, BadRequestException {
if (r instanceof DeletableCollectionResource) {
DeletableCollectionResource dcr = (DeletableCollectionResource) r;
boolean locked = dcr.isLockedOutRecursive(req);
if (locked && log.isInfoEnabled()) {
log.info("isLocked, as reported by DeletableCollectionResource: " + dcr.getName());
}
return locked;
} else if (r instanceof CollectionResource) {
CollectionResource col = (CollectionResource) r;
List<Resource> list = new ArrayList<Resource>();
list.addAll(col.getChildren());
for (Resource rChild : list) {
if (rChild instanceof DeletableResource) {
DeletableResource rChildDel = (DeletableResource) rChild;
if (isLockedOut(req, rChildDel)) {
if (log.isInfoEnabled()) {
log.info("isLocked: " + rChild.getName() + " type:" + rChild.getClass());
}
return true;
}
} else {
if (log.isInfoEnabled()) {
log.info("a child resource is not deletable: " + rChild.getName() + " type: " + rChild.getClass());
}
return true;
}
}
return false;
} else {
boolean locked = handlerHelper.isLockedOut(req, r);
if (locked && log.isInfoEnabled()) {
log.info("isLocked, as reported by handlerHelper on resource: " + r.getName());
}
return locked;
}
}
Aggregations