Removes all resources locked in a project.<p>

@param projectId the ID of the project where the resources have been locked
@param removeSystemLocks if <code>true</code>, also system locks are removed
196857
public void removeResourcesInProject(CmsUUID projectId, boolean removeSystemLocks) {

        Iterator<CmsLock> itLocks = OpenCms.getMemoryMonitor().getAllCachedLocks().iterator();
        while (itLocks.hasNext()) {
            CmsLock currentLock = itLocks.next();
            if (removeSystemLocks && currentLock.getSystemLock().getProjectId().equals(projectId)) {
                unlockResource(currentLock.getResourceName(), true);
            }
            if (currentLock.getEditionLock().getProjectId().equals(projectId)) {
                unlockResource(currentLock.getResourceName(), false);
            }
        }
    }
745329
def remove_project(self, project_id):
        

        if project_id not in self._projects:
            raise aiohttp.web.HTTPNotFound(text="Project ID {} doesn't exist".format(project_id))
        del self._projects[project_id]
352179
private void deleteResource(final CmsUUID structureId) {

        CmsRpcAction<Void> action = new CmsRpcAction<Void>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                CmsCoreProvider.getVfsService().deleteResource(structureId, this);

            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(Void result) {

                onAfterDeletion();
            }
        };
        action.execute();
    }
990419
protected void clearLocks(CmsProject project, List<CmsResource> resources) throws CmsException {

        CmsObject rootCms = OpenCms.initCmsObject(m_adminCms);
        rootCms.getRequestContext().setCurrentProject(project);
        rootCms.getRequestContext().setSiteRoot("");
        for (CmsResource resource : resources) {
            CmsLock lock = rootCms.getLock(resource);
            if (lock.isUnlocked()) {
                continue;
            }
            String currentPath = resource.getRootPath();
            while (lock.isInherited()) {
                currentPath = CmsResource.getParentFolder(currentPath);
                lock = rootCms.getLock(currentPath);
            }
            rootCms.changeLock(currentPath);
            rootCms.unlockResource(currentPath);
        }
    }
248193
public void finish() throws CmsException {

        m_finished = true;
        m_requiresCleanup = false;
        CmsProject project = getProject();
        CmsObject projectCms = OpenCms.initCmsObject(m_adminCms);
        projectCms.getRequestContext().setCurrentProject(project);
        if (m_configuration.isAutoPublish()) {
            // we don't necessarily publish with the user who has the locks on the resources, so we need to steal the locks
            List<CmsResource> projectResources = projectCms.readProjectView(project.getUuid(), CmsResource.STATE_KEEP);
            for (CmsResource projectResource : projectResources) {
                CmsLock lock = projectCms.getLock(projectResource);
                if (!lock.isUnlocked() && !lock.isLockableBy(projectCms.getRequestContext().getCurrentUser())) {
                    projectCms.changeLock(projectResource);
                }
            }
            OpenCms.getPublishManager().publishProject(
                projectCms,
                new CmsLogReport(Locale.ENGLISH, CmsUgcSession.class));
        } else {
            // try to unlock everything - we don't need this in case of auto-publish, since publishing already unlocks the resources
            projectCms.unlockProject(project.getUuid());
        }

    }
1068317
public void lockResource(CmsResource resource) throws CmsException {

        getResourceType(resource).lockResource(this, m_securityManager, resource, CmsLockType.EXCLUSIVE);
    }
878440
protected void checkSystemLocks(CmsDbContext dbc, CmsResource resource) throws CmsException {

        if (m_lockManager.hasSystemLocks(dbc, resource)) {
            throw new CmsLockException(
                Messages.get().container(
                    Messages.ERR_RESOURCE_SYSTEM_LOCKED_1,
                    dbc.removeSiteRoot(resource.getRootPath())));
        }
    }
414100
public void removeTempLockedObject() {
        if (this != _resourceLocks._tempRoot) {
            // removing from tree
            if (_parent != null && _parent._children != null) {
                int size = _parent._children.length;
                for (int i = 0; i < size; i++) {
                    if (_parent._children[i].equals(this)) {
                        LockedObject[] newChildren = new LockedObject[size - 1];
                        for (int i2 = 0; i2 < (size - 1); i2++) {
                            if (i2 < i) {
                                newChildren[i2] = _parent._children[i2];
                            } else {
                                newChildren[i2] = _parent._children[i2 + 1];
                            }
                        }
                        if (newChildren.length != 0) {
                            _parent._children = newChildren;
                        } else {
                            _parent._children = null;
                        }
                        break;
                    }
                }

                // removing from hashtable
                _resourceLocks._tempLocksByID.remove(getID());
                _resourceLocks._tempLocks.remove(getPath());

                // now the garbage collector has some work to do
            }
        }
    }
50386
public synchronized void removeExpired()
   {
      final List<String> removeLockList = new ArrayList<String>();

      for (LockData lock : getLockList())
      {
         if (!lock.isSessionScoped() && lock.getTimeToDeath() < 0)
         {
            removeLockList.add(lock.getNodeIdentifier());
         }
      }

      Collections.sort(removeLockList);

      for (String rLock : removeLockList)
      {
         removeLock(rLock);
      }
   }
245713
protected void performSingleDeleteOperation(String resource, CmsResourceDeleteMode deleteOption)
    throws CmsException {

        // lock resource if autolock is enabled
        checkLock(resource);
        // delete the resource
        getCms().deleteResource(resource, deleteOption);
    }
794590
@Override
	public void removeActions(String nodeID) {

		// Stop local services
		if (this.nodeID.equals(nodeID)) {
			stopAllLocalServices();
		}

		// Remove actions
		final long stamp = lock.writeLock();
		try {
			Iterator<Strategy<ActionEndpoint>> endpoints = strategies.values().iterator();
			while (endpoints.hasNext()) {
				Strategy<ActionEndpoint> strategy = endpoints.next();
				strategy.remove(nodeID);
				if (strategy.isEmpty()) {
					endpoints.remove();
				}
			}

			// Update service names
			names.clear();
			names.addAll(strategies.keySet());

			// Delete cached node descriptor
			if (this.nodeID.equals(nodeID)) {
				clearDescriptorCache();
			}

		} finally {
			lock.unlockWrite(stamp);
		}

		// Reject promises
		Iterator<PendingPromise> pendingPromises = promises.values().iterator();
		boolean removed = false;
		while (pendingPromises.hasNext()) {
			PendingPromise pending = pendingPromises.next();
			if (pending.nodeID.equals(nodeID)) {
				removed = true;
				pendingPromises.remove();
				executor.execute(() -> {
					try {
						pending.promise.complete(new RequestRejectedError(nodeID, pending.action));
					} catch (Throwable cause) {
						logger.warn("Unable to reject action \"" + pending.action + "\"!", cause);
					}
				});
			}
		}

		// Reschedule timeout checker
		if (removed) {
			scheduler.execute(() -> {
				reschedule(Long.MAX_VALUE);
			});
		}

		// Notify listeners
		if (this.nodeID.equals(nodeID)) {

			// Notify local listeners (LOCAL services changed)
			broadcastServicesChanged(true);
		} else {

			// Notify local listeners (REMOTE services changed)
			broadcastServicesChanged(false);
		}
	}
1328422
void unlockResource() {

        if (!shouldUnlockAutomatically()) {
            return;
        }
        if (m_entityId != null) {
            final CmsUUID structureId = CmsContentDefinition.entityIdToUuid(m_entityId);
            if (m_deleteOnCancel) {
                CmsRpcAction<Void> action = new CmsRpcAction<Void>() {

                    @Override
                    public void execute() {

                        CmsCoreProvider.getVfsService().syncDeleteResource(structureId, this);
                    }

                    @Override
                    protected void onResponse(Void result) {

                        // nothing to do
                    }
                };
                action.executeSync();
            } else {
                CmsCoreProvider.get().unlock(structureId);
            }
        }
    }
1087914
public void cleanupProjectArtifacts(final int projectId) {
    try {
      this.storageCleaner.cleanupProjectArtifacts(projectId);
    } catch (final Exception e) {
      log.error("Error occured during cleanup. Ignoring and continuing...", e);
    }
  }
1111642
public void removeLocks(CmsUUID userId) {

        Iterator<CmsLock> itLocks = OpenCms.getMemoryMonitor().getAllCachedLocks().iterator();
        while (itLocks.hasNext()) {
            CmsLock currentLock = itLocks.next();
            boolean editLock = currentLock.getEditionLock().getUserId().equals(userId);
            boolean sysLock = currentLock.getSystemLock().getUserId().equals(userId);
            if (editLock) {
                unlockResource(currentLock.getResourceName(), false);
            }
            if (sysLock) {
                unlockResource(currentLock.getResourceName(), true);
            }
        }
    }
467870
public void setRemoveSecurityGroupIds(java.util.Collection<String> removeSecurityGroupIds) {
        if (removeSecurityGroupIds == null) {
            this.removeSecurityGroupIds = null;
            return;
        }

        this.removeSecurityGroupIds = new com.amazonaws.internal.SdkInternalList<String>(removeSecurityGroupIds);
    }
612578
public void deleteByKeys(String projectUuid, Collection<String> issueKeys) {
    if (issueKeys.isEmpty()) {
      return;
    }

    BulkIndexer bulkIndexer = createBulkIndexer(Size.REGULAR, IndexingListener.FAIL_ON_ERROR);
    bulkIndexer.start();
    issueKeys.forEach(issueKey -> bulkIndexer.addDeletion(TYPE_ISSUE.getMainType(), issueKey, AuthorizationDoc.idOf(projectUuid)));
    bulkIndexer.stop();
  }
726245
function closeProject(projectId, callback) {
            var prevBranchName = state.branchName;
            state.project = null;
            state.projectAccess = null;
            state.projectInfo = null;
            state.readOnlyProject = false;
            //TODO what if for some reason we are in transaction?
            storage.closeProject(projectId, function (err) {
                if (err) {
                    callback(err);
                    return;
                }

                state.core = null;
                state.branchName = null;
                state.commitHash = null;
                //self.dispatchEvent(null);
                state.patterns = {};
                //state.gHash = 0;
                state.nodes = {};
                state.loadNodes = {};
                state.loadError = 0;
                state.rootHash = null;
                //state.rootObject = null;
                state.transactions.opened = 0;
                state.transactions.callbacks = [];
                state.msg = '';

                cleanUsersTerritories();
                if (prevBranchName) {
                    self.dispatchEvent(CONSTANTS.BRANCH_CLOSED, prevBranchName);
                }

                self.dispatchEvent(CONSTANTS.BRANCH_CHANGED, null);
                self.dispatchEvent(CONSTANTS.PROJECT_CLOSED, projectId);

                callback(null);
            });
        }