Adds all jobs to the queue

@param $respondentId Optional, execute for just one respondent
@param $organizationId Optional, execute for just one organization
176835
public function execute($respondentId = null, $organizationId = null)
    {
        $sql = "SELECT gcj_id_job
            FROM gems__comm_jobs
            WHERE gcj_active = 1";

        if ($organizationId) {
            $sql .= $this->db->quoteInto(
                    " AND (gcj_id_organization IS NULL OR gcj_id_organization = ?)",
                    $organizationId
                    );
        }

        $sql .= "
            ORDER BY gcj_id_order,
                CASE WHEN gcj_id_survey IS NULL THEN 1 ELSE 0 END,
                CASE WHEN gcj_round_description IS NULL THEN 1 ELSE 0 END,
                CASE WHEN gcj_id_track IS NULL THEN 1 ELSE 0 END,
                CASE WHEN gcj_id_organization IS NULL THEN 1 ELSE 0 END";

        $jobs = $this->db->fetchAll($sql);

        $batch = $this->getBatch();
        if ($jobs) {
            foreach ($jobs as $job) {
                $batch->addTask('Mail\\ExecuteMailJobTask', $job['gcj_id_job'], $respondentId, $organizationId);
            }
        } else {
            $this->getBatch()->addMessage($this->_('Nothing to do, please create a mail job first.'));
        }
        // When manually running the jobs, we do not start the monitortask
        if ($batch->getId() == 'cron') {
            $batch->addTask('Mail\\CronMailMonitorTask');
        }
    }
854462
public function listOrganizationMenus($organizationId, $slug = null)
    {
        list($response) = $this->listOrganizationMenusWithHttpInfo($organizationId, $slug);
        return $response;
    }
1001357
public function create($data, $organizationId = null)
    {
        if (isset($organizationId)) {
            return $this->client()->put($data, 'organizations/{organizationId}', ['organizationId' => $organizationId]);
        }

        return $this->client()->post($data, 'organizations');
    }
791865
public function registerJob($identifier, $callback)
    {
        if (array_key_exists($identifier, $this->identifierToId)) {
            $idNum = $this->identifierToId[$identifier];
        } else {
            $idNum = count($this->identifierToId) + 1;
            $this->idToIdentifier[$idNum] = $identifier;
        }
        $this->jobs[$identifier] = call_user_func(
            $callback,
            $idNum
        );
        $this->identifierToId[$identifier] = $idNum;
    }
614233
public function addServiceTask($id, $participant, $operation, $name = null, $defaultSequenceFlow = null)
    {
        $this->serviceTasks[$id] = array($participant, $operation, $name);

        if ($defaultSequenceFlow !== null) {
            $this->defaultableFlowObjects[$defaultSequenceFlow] = $id;
        }
    }
372590
protected function queueJob($actionType, $actionId, $service, $jobType = null)
    {
        $job = new Job();
        $job->setScheduler($this->scheduler);
        //$this->scheduler->addJob($job);
        $job->setActionType($actionType);
        $job->setActionId($actionId);
        $job->setName($service);
        $job->setJobType($jobType);
        $job->setStatus(Job::STATUS_OPEN);

        $this->em->persist($job);
        $this->em->flush();
    }
149905
public function sendGroupsParticipantsAdd($groupId, $participant)
    {
        $msgId = $this->createMsgId();
        $this->sendGroupsChangeParticipants($groupId, $participant, 'add', $msgId);
    }
306967
public function addJob($id, $job)
    {
        if (is_array($job)) {
            $job = Job::fromArray($job);
        }
        $this->incomingJobs[$id] = $job;
    }
420411
public function addCoupon(string $subscriptionId, string $couponId)
    {
        // Log Debug
        $this->flow->getLogger()->debug("Adding Coupon $couponId to $subscriptionId");

        return $this->make(
            $this->flow->send(
                'post',
                $this->endpoint . '/addCoupon',
                [
                    'subscriptionId' => $subscriptionId,
                    'couponId' => $couponId,
                ]
            )
        );
    }
1105813
public function getReceptionCode($patientId, $organizationId, $respondentId = null)
    {
        $db     = $this->getAdapter();
        $select = $db->select();
        $select->from('gems__respondent2org', array('gr2o_reception_code'));

        if ($patientId) {
            $select->where('gr2o_patient_nr = ?', $patientId);
        } else {
            $select->where('gr2o_id_user = ?', $respondentId);
        }

        $select->where('gr2o_id_organization = ?', $organizationId);

        return $db->fetchOne($select);
    }
181446
public function lastPeriodbyOrganizationAndByFiscalYear($organizationId, $fiscalYearId)
  {
    $Period = $this->Period->selectRaw('id, end_date, max(month) as month')
      ->where('organization_id', '=', $organizationId)
      ->where('fiscal_year_id', '=', $fiscalYearId)
      ->orderBy('month', 'desc')
      ->groupBy(array('id', 'end_date'))
      ->first();

    return $Period;
  }
929125
protected function applyOrganizerUpdated(OrganizerUpdated $organizerUpdated)
    {
        $this->repository->storeOrganizer($organizerUpdated->getItemId(), $organizerUpdated->getOrganizerId());
    }
813986
public void associateExecutionById(String executionId) {
    Execution execution = processEngine.getRuntimeService()
      .createExecutionQuery()
      .executionId(executionId)
      .singleResult();
    if(execution == null) {
      throw new ProcessEngineCdiException("Cannot associate execution by id: no execution with id '"+executionId+"' found.");
    }
    associationManager.setExecution(execution);
  }
13204
public function addFileToJobSync($jobId, AddFileToJobParameters $parameters)
    {
        $endpoint = vsprintf('jobs/%s/file/add', [$jobId]);
        $requestData = $this->getDefaultRequestData('json', $parameters->exportToArray());
        $this->wait($this->sendRequest($endpoint, $requestData, self::HTTP_METHOD_POST));
    }
542625
public function addLocaleToJobSync($jobId, $localeId, AddLocaleToJobParameters $parameters)
    {
        $endpoint = vsprintf('jobs/%s/locales/%s', [$jobId, $localeId]);
        $requestData = $this->getDefaultRequestData('json', $parameters->exportToArray());
        $this->wait($this->sendRequest($endpoint, $requestData, self::HTTP_METHOD_POST));
    }
1077033
public function setAggregateActualResponses($responseActual, $operationId, $types = ['headers', 'body'])
    {
        if (!isset($this->aggregateActualResponses[$operationId])) {
            $this->aggregateActualResponses[$operationId] = [];
        }
        foreach ($types as $type) {
            if (!isset($this->aggregateActualResponses[$operationId][$type])) {
                $this->aggregateActualResponses[$operationId][$type] = [];
            }
            if (isset($responseActual[$type])) {
                $this->aggregateActualResponses[$operationId][$type] = array_merge(
                    $this->aggregateActualResponses[$operationId][$type],
                    $responseActual[$type]
                );
            }
        }

        return $this;
    }
562104
private function sendResponse(string $invocationId, $responseData): void
    {
        $url = "http://{$this->apiUrl}/2018-06-01/runtime/invocation/$invocationId/response";
        $this->postJson($url, $responseData);
    }