Store fields.
This method is used to save any additional input into the current task object
if the task class matches

@param array $submittedData Array containing the data submitted by the user
@param object $task Reference to the current task object
12317
protected function saveFields( array $submittedData, $task )
	{
		$task->{$this->fieldSite} = $submittedData[$this->fieldSite];
		$task->{$this->fieldController} = $submittedData[$this->fieldController];
		$task->{$this->fieldTSconfig} = $submittedData[$this->fieldTSconfig];
	}
318377
def save
      opts = {}
      opts['priority'] = priority if priority
      opts['date_string'] = date if date
      # if we don't have an id, then we can assume this is a new task.
      unless (task_details.has_key?('id'))
        result = self.class.create(self.content, self.project_id, opts)
      else
        result = self.class.update(self.content, self.id, opts)
      end

      self.content      = result.content
      self.project_id   = result.project_id
      self.task_details = result.task_details
      self
    end
816316
protected function submitAddField()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('field');
        $this->addField();
    }
1298778
public function submissionSaveData(array $formData)
    {
        // remove empty values
        $formData = array_filter($formData);

        // get array of files to upload
        $files = [];
        foreach ($formData as $field => $value) {
            if (Request::hasFile($field)) {
                $files[$field] = Request::file($field);
                unset($formData[$field]);
            }
        }

        // save form submission
        $form_submission = new FormSubmission;
        $form_submission->form_block_id = $this->_block->id;
        $form_submission->content = serialize($formData);
        $form_submission->sent = 0;
        $form_submission->from_page_id = PageBuilder::pageId();
        $form_submission->save();
        $form_submission->uploadFiles($files);
        return $form_submission;
    }
418064
public void register(Task task) {
        Optional.ofNullable(task)
                .filter(t -> t.getTask() != null)
                .filter(t -> StringUtils.hasText(t.getName()))
                .ifPresent(t -> checkTaskMap.put(t.getName(), t));
    }
1127966
public function storeResponse(Response $response, $method, $url, array $data = [], array $headers = [], $basicAuthCredentials = '', $minutes = 30)
    {
        $signature = $this->signature->generate($method, $url, $data, $headers, $basicAuthCredentials);

        $this->cacheManager->store($signature, $response, $minutes);
    }
1168630
private function convertTaskToArray(Task $task, $addOutput = false, $outputOffset = null)
    {
        $data = [
            'id'         => $task->getId(),
            'status'     => $task->getStatus(),
            'type'       => $task->getType(),
            'created_at' => $task->getCreatedAt()->format(\DateTime::ISO8601),
            'user_data'  => $task->getUserData()
        ];

        if (true === $addOutput) {
            $data['output'] = $task->getOutput($outputOffset);
        }

        return $data;
    }
10800
protected function CommitProcessData()
    {
        TdbShopSearchFieldWeight::AddQueryBlock(false, null, null);
        $sTmp = serialize($this->aTablesToProcess);
        $aData = $this->sqlData;
        $aData['processdata'] = $sTmp;
        $this->LoadFromRow($aData);
        $this->AllowEditByAll(true);
        $this->Save();
    }
810041
public function setInputData($inputData = array())
    {
        $this->inputData = $inputData;
        $this->logger->debug(__FUNCTION__, 'Input Data => ' . json_encode($this->inputData));

        return $this;
    }
1137347
public function saveFields(array $fieldData)
    {
        $trackEngine = $this->getTrackEngine();

        if (! $trackEngine) {
            return 0;
        }

        //\MUtil_Echo::track($fieldData);
        $this->_fieldData = $this->_mergeFieldValues($fieldData, $this->getFieldData(), $trackEngine);

        $changed = $trackEngine->getFieldsDefinition()->saveFields($this->_respTrackId, $this->_fieldData);

        if ($changed) {
            $this->_ensureFieldData(true);
        }

        $this->handleFieldUpdate();

        return $changed;
    }
1231529
private TaskRecord storeTaskRecord(Tenant tenant, Task task) {
        DBTransaction dbTran = DBService.instance(tenant).startTransaction();
        TaskRecord taskRecord = new TaskRecord(task.getTaskID());
        Map<String, String> propMap = taskRecord.getProperties();
        assert propMap.size() > 0 : "Need at least one property to store a row!";
        for (String propName : propMap.keySet()) {
            dbTran.addColumn(TaskManagerService.TASKS_STORE_NAME, task.getTaskID(), propName, propMap.get(propName));
        }
        DBService.instance(tenant).commit(dbTran);
        return taskRecord;
    }
145336
public void submit(Task<? extends TaskResult> task) {

        // Increment the counter which indicates the number of results to
        // expect. This must be done BEFORE actually submitting the task for
        // execution.
        remainingTasks.incrementAndGet();

        // Increment the statistics and put the task on the correct queue.
        stats.incrementStartedTasks(task.resultType);
        executors.get(task.resultType).submit(task);

        // Make sure that the task gets added to the results queue.
        resultsQueue.add(task);
        stats.updateMemoryInfo();
    }
746678
public function tasksEdit($task, $site = null)
    {
        if (!count($task)) {
            throw new \InvalidArgumentException(
                'Parameter `task` must contain a data'
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            "/tasks/{$task['id']}/edit",
            "POST",
            $this->fillSite(
                $site,
                ['task' => json_encode($task)]
            )
        );
    }
489045
public function saveAdditionalFields(
        array $submittedData,
        AbstractTask $task
    ) {
        /** @var $task ReIndexTask */
        if (!$this->isTaskInstanceofReIndexTask($task)) {
            return;
        }

        $task->setRootPageId($submittedData['site']);

        $indexingConfigurations = [];
        if (!empty($submittedData['indexingConfigurations'])) {
            $indexingConfigurations = $submittedData['indexingConfigurations'];
        }
        $task->setIndexingConfigurationsToReIndex($indexingConfigurations);
    }
921322
public function serialize(Task $task)
    {
        $assignedUser = $this->userManager->find($task->getAssignedUserId());
        $createUser = $this->userManager->find($task->getCreateUserId());

        $type = $this->types->get($task->getType());

        $transitions = [];
        foreach ($task->getTransitions() as $transition) {
            $transitionUser = $this->userManager->find($transition->getCreateUserId());
            $createdAt = $transition->getCreatedAt()->format('Y-m-d H:i:s');
            $transitions[$createdAt.'_'.$transition->getId()] = [
                'id' => $transition->getId(),
                'name' => $transition->getName(),
                'new_state' => $transition->getNewState(),
                'old_state' => $transition->getOldState(),
                'created_at' => $createdAt,
                'create_user' => $transitionUser->getDisplayName(),
            ];
        }
        ksort($transitions);
        $transitions = array_values($transitions);

        $comments = [];
        foreach ($task->getComments() as $comment) {
            $commentUser = $this->userManager->find($comment->getCreateUserId());
            $createdAt = $comment->getCreatedAt()->format('Y-m-d H:i:s');
            $comments[$createdAt.'_'.$comment->getId()] = [
                'id' => $comment->getId(),
                'current_state' => $comment->getCurrentState(),
                'comment' => $comment->getComment(),
                'created_at' => $createdAt,
                'create_user' => $commentUser->getDisplayName(),
            ];
        }
        ksort($comments);
        $comments = array_values($comments);

        $taskData = [
            'id' => $task->getId(),
            'type' => $task->getType(),
            'generic' => $task->getType() === 'generic',
            'name' => $type->getName(),
            'summary' => $task->getSummary(),
            'description' => $task->getDescription(),
            'component' => $type->getComponent(),
            'link' => $type->getLink($task),
            'assigned_user_id' => $task->getAssignedUserId(),
            'assigned_user' => $assignedUser->getDisplayName(),
            'status' => $task->getFiniteState(),
            'create_user' => $createUser->getDisplayName(),
            'create_user_id' => $task->getCreateUserId(),
            'created_at' => $task->getCreatedAt()->format('Y-m-d H:i:s'),
            'transitions' => $transitions,
            'comments' => $comments,
            'states' => $this->taskManager->getTransitions($task),
        ];

        return $taskData;
    }
1054152
public static function create($belongsTo, $type, $data, $attributes = [])
    {
        $obj = new Task();
        $obj->belongsTo = $belongsTo;
        $obj->type = $type;
        $obj->data = $data;
        $obj->additional = $attributes;
        $obj->save();
    }
1028696
public static function save_field_configuration(field_controller $field, \stdClass $formdata) {
        foreach ($formdata as $key => $value) {
            if ($key === 'configdata' && is_array($formdata->configdata)) {
                $field->set($key, json_encode($value));
            } else if ($key === 'id' || ($key === 'type' && $field->get('id'))) {
                continue;
            } else if (field::has_property($key)) {
                $field->set($key, $value);
            }
        }

        $isnewfield = empty($field->get('id'));

        // Process files in description.
        if (isset($formdata->description_editor)) {
            if (!$field->get('id')) {
                // We need 'id' field to store files used in description.
                $field->save();
            }

            $data = (object) ['description_editor' => $formdata->description_editor];
            $textoptions = $field->get_handler()->get_description_text_options();
            $data = file_postupdate_standard_editor($data, 'description', $textoptions, $textoptions['context'],
                'core_customfield', 'description', $field->get('id'));
            $field->set('description', $data->description);
            $field->set('descriptionformat', $data->descriptionformat);
        }

        // Save the field.
        $field->save();

        if ($isnewfield) {
            // Move to the end of the category.
            self::move_field($field, $field->get('categoryid'));
        }

        if ($isnewfield) {
            field_created::create_from_object($field)->trigger();
        } else {
            field_updated::create_from_object($field)->trigger();
        }
    }