Esempio n. 1
0
  /** Unlock the VFS lock only */
  @Override
  public boolean unlock(VFSItem item, Identity identity, Roles roles) {
    if (item instanceof MetaTagged) {
      MetaInfoFileImpl info = (MetaInfoFileImpl) ((MetaTagged) item).getMetaInfo();
      if (info == null) return false;

      info.setLockedBy(null);
      info.setLockedDate(null);
      info.setLocked(false);
      info.write();

      boolean unlocked = false;
      File file = extractFile(item);
      if (file != null && fileLocks.containsKey(file)) {
        LockInfo lock = fileLocks.get(file);
        if (lock.isWebDAVLock()) {
          lock.setVfsLock(false);
        } else {
          if (lock.getWebPath() != null) {
            // LOCK resourceLocks.remove(lock.getWebPath());
          }
          fileLocks.remove(file);
          unlocked = true;
        }
      } else {
        unlocked = true;
      }
      return unlocked;
    }
    return false;
  }
Esempio n. 2
0
  @Override
  public boolean lock(VFSItem item, Identity identity, Roles roles) {
    if (item instanceof MetaTagged) {
      MetaInfoFileImpl info = (MetaInfoFileImpl) ((MetaTagged) item).getMetaInfo();
      info.setLockedBy(identity.getKey());
      info.setLockedDate(new Date());
      info.setLocked(true);
      info.write();

      File file = extractFile(item);
      if (file != null && fileLocks.containsKey(file)) {
        LockInfo lock = fileLocks.get(file);
        if (lock != null) {
          lock.setVfsLock(true);
        }
      }

      return true;
    }
    return false;
  }