code: public void abortPublishJob(CmsObject cms, CmsPublishJobEnqueued publishJob, boolean removeJob)
      throws CmsException, CmsSecurityException, CmsPublishException {
  
          if (!OpenCms.getRoleManager().hasRole(cms, CmsRole.PROJECT_MANAGER)
              && !cms.getRequestContext().getCurrentUser().getId().equals(publishJob.getUserId())) {
              // Can only be executed by somebody with the role CmsRole#PROJECT_MANAGER or the owner of the job
              throw new CmsSecurityException(
                  Messages.get().container(
                      Messages.ERR_PUBLISH_ENGINE_ABORT_DENIED_1,
                      cms.getRequestContext().getCurrentUser().getName()));
          }
          m_publishEngine.abortPublishJob(cms.getRequestContext().getCurrentUser().getId(), publishJob, removeJob);
      }
docs: Aborts the given publish job.<p>
  
  @param cms the cms context
  @param publishJob the publish job to abort
  @param removeJob indicates if the job will be removed or added to history
  
  @throws CmsException if there is some problem during unlocking the resources
  @throws CmsSecurityException if the current user has not enough permissions
  @throws CmsPublishException if the publish job can not been aborted