code: public CmsLock getLock(CmsDbContext dbc, CmsResource resource, boolean includeSiblings) throws CmsException {
  
          // resources are never locked in the online project
          // and non-existent resources are never locked
          if ((resource == null) || (dbc.currentProject().isOnlineProject())) {
              return CmsLock.getNullLock();
          }
  
          // check exclusive direct locks first
          CmsLock lock = getDirectLock(resource.getRootPath());
          if ((lock == null) && includeSiblings) {
              // check if siblings are exclusively locked
              List<CmsResource> siblings = internalReadSiblings(dbc, resource);
              lock = getSiblingsLock(siblings, resource.getRootPath());
          }
          if (lock == null) {
              // if there is no parent lock, this will be the null lock as well
              lock = getParentLock(resource.getRootPath());
          }
          if (!lock.getSystemLock().isUnlocked()) {
              lock = lock.getSystemLock();
          } else {
              lock = lock.getEditionLock();
          }
          return lock;
      }
docs: Returns the lock state of the given resource.<p>
  
  In case no lock is set, the <code>null lock</code> which can be obtained
  by {@link CmsLock#getNullLock()} is returned.<p>
  
  @param dbc the current database context
  @param resource the resource
  @param includeSiblings if siblings (shared locks) should be included in the search
  
  @return the lock state of the given resource
  
  @throws CmsException if something goes wrong