}
}
public void setLock(List<String> paths, boolean toLock, JCRSessionWrapper currentUserSession)
throws GWTJahiaServiceException {
JahiaUser user = currentUserSession.getUser();
List<String> missedPaths = new ArrayList<String>();
List<JCRNodeWrapper> nodes = new ArrayList<JCRNodeWrapper>();
for (String path : paths) {
JCRNodeWrapper node;
try {
node = currentUserSession.getNode(path);
addSub(nodes, node);
} catch (RepositoryException e) {
logger.error(e.toString(), e);
missedPaths.add(new StringBuilder(path).append(" could not be accessed : ")
.append(e.toString()).toString());
continue;
}
}
for (JCRNodeWrapper node : nodes) {
try {
if (!node.hasPermission(Privilege.JCR_LOCK_MANAGEMENT)) {
missedPaths.add(new StringBuilder(node.getName()).append(": write access denied").toString());
} else if (node.getLockedLocales().contains(currentUserSession.getLocale())) {
if (!toLock) {
try {
node.unlock();
} catch (LockException e) {
logger.error(e.toString(), e);
missedPaths
.add(new StringBuilder(node.getName()).append(": repository exception").toString());
}
} else {
String lockOwner = node.getLockOwner();
if (lockOwner != null && !lockOwner.equals(user.getUsername())) {
missedPaths.add(new StringBuilder(node.getName()).append(": locked by ").append(lockOwner).toString());
}
}
} else {
if (toLock) {