...
Implements XML RPC method 'grav.saveData'.
@todo		test, code doc
484006
public function saveImage( $email, $password, $imageDataBase64, $rating = 0 ){
		throw new RuntimeException( 'Not tested yet' );
		$response	= $this->callXmlRpc( $email, 'saveData', array(
			'password'	=> $password,
			'data'		=> $imageDataBase64,
			'rating'	=> $rating
		) );
		return $response[0];
	}
1229923
protected function _storeData() {
        if ($this->_currentCellIsDirty) {
            $this->_currentObject->detach();

            if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
                $this->__destruct();
                throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
            }
            $this->_currentCellIsDirty = false;
        }
        $this->_currentObjectID = $this->_currentObject = null;
    }
322086
private ClientProperties onParseXML(String propertyFileName, PersistenceUnitMetadata puMetadata)
    {
        InputStream inStream = puMetadata.getClassLoader().getResourceAsStream(propertyFileName);
        if (inStream == null)
        {
            propertyFileName = KunderaCoreUtils.resolvePath(propertyFileName);
            try
            {
                inStream = new FileInputStream(new File(propertyFileName));
            }
            catch (FileNotFoundException e)
            {
                log.warn("File {} not found, Caused by ", propertyFileName);
                return null;
            }

        }

        if (inStream != null)
        {
            xStream = getXStreamObject();
            Object o = xStream.fromXML(inStream);
            return (ClientProperties) o;
        }

        return null;
    }
612291
void submit() {

        try {
            saveData();
            m_context.finish(null);
        } catch (Exception e) {
            m_context.error(e);
        }
    }
1043267
private function writeStoredRoutineMetadata(): void
  {
    $json_data = json_encode($this->phpStratumMetadata, JSON_PRETTY_PRINT);
    if (json_last_error()!=JSON_ERROR_NONE)
    {
      throw new RuntimeException("Error of encoding to JSON: '%s'.", json_last_error_msg());
    }

    // Save the metadata.
    $this->writeTwoPhases($this->phpStratumMetadataFilename, $json_data);
  }
934979
public function save($data = null) {
		if (!parent::save()) {
			return false;
		}

		if ($data) {
			// new image
			$this->simpletype = 'image';
			$this->saveImageFile($data);
			$this->saveThumbnails();
			$this->extractExifData();
		}

		return true;
	}
1035970
function storeDOMTree( $domTree, $storeAttribute, $contentObjectAttributeRef )
    {
        if ( !$domTree )
            return false;
        $this->ContentObjectAttributeData['DataTypeCustom']['dom_tree'] = $domTree;
        $this->ContentObjectAttributeData['DataTypeCustom']['is_storage_required'] = false;
        $xmlString = $domTree->saveXML();
        $this->ContentObjectAttributeData['data_text'] = $xmlString;

        if ( $storeAttribute )
        {
            if ( is_object( $contentObjectAttributeRef )  )
            {
                $contentObjectAttribute = $contentObjectAttributeRef;
            }
            else
            {
                $contentObjectAttribute = eZContentObjectAttribute::fetch( $this->ContentObjectAttributeData['id'],
                                                                           $this->ContentObjectAttributeData['version'] );
            }

            if ( is_object( $contentObjectAttribute )  )
            {
                $contentObjectAttribute->setAttribute( 'data_text', $xmlString );
                $contentObjectAttribute->storeData();
            }
            else
            {
                eZDebug::writeError( "Invalid objectAttribute: id = " . $this->ContentObjectAttributeData['id'] .
                                    " version = " . $this->ContentObjectAttributeData['version'] ,
                                    __METHOD__ );
            }
        }

        return true;
    }
408149
def saveXml(self, xml):
        
        # save grouping
        xtree = ElementTree.SubElement(xml, 'tree')
        self.uiRecordTREE.saveXml(xtree)
        
        # save the query
        query = self.query()
        if query:
            query.toXml(ElementTree.SubElement(xml, 'query'))
382115
public function save()
    {
        $path = $this->paths['customPath'];

        $result = true;
        if (!empty($this->changedData)) {
            foreach ($this->changedData as $key1 => $keyData) {
                foreach ($keyData as $key2 => $data) {
                    if (!empty($data)) {
                        $result &= $this->getFileManager()->mergeContents(array($path, $key1, $key2.'.json'), $data, true);
                    }
                }
            }
        }

        if (!empty($this->deletedData)) {
            foreach ($this->deletedData as $key1 => $keyData) {
                foreach ($keyData as $key2 => $unsetData) {
                    if (!empty($unsetData)) {
                        $rowResult = $this->getFileManager()->unsetContents(array($path, $key1, $key2.'.json'), $unsetData, true);
                        if ($rowResult == false) {
                            $GLOBALS['log']->warning('Metadata items ['.$key1.'.'.$key2.'] can be deleted for custom code only.');
                        }
                        $result &= $rowResult;
                    }
                }
            }
        }

        if ($result == false) {
            throw new Error("Error saving metadata. See log file for details.");
        }

        $this->clearChanges();

        return (bool) $result;
    }
1331957
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion != false )
        {
            $xmlText = eZXMLTextType::rawXMLText( $originalContentObjectAttribute );
            $contentObjectAttribute->setAttribute( "data_text", $xmlText );
        }
        else
        {
            $parser = new eZXMLInputParser();
            $doc = $parser->createRootNode();
            $xmlText = eZXMLTextType::domString( $doc );
            $contentObjectAttribute->setAttribute( "data_text", $xmlText );
        }
    }
1262053
function saveTransformedData(uri) {
  return function (data) {
    return db.put(uri, JSON.stringify(data))
      .then(function () {
        // If the Promise resolves it means we saved,
        // so let's return the data
        return data;
      });
  };
}
944363
void doSave(XMLWriter w) throws KNXMLException
	{
		// <expiration timeout=int />
		w.writeEmptyElement(TAG_EXPIRATION, Arrays
			.asList(new Attribute[] { new Attribute(ATTR_TIMEOUT, Integer
				.toString(timeout)) }));
		w.writeElement(TAG_UPDATING, Collections.EMPTY_LIST, null);
		synchronized (updating) {
			for (final Iterator i = updating.iterator(); i.hasNext();)
				((GroupAddress) i.next()).save(w);
		}
		w.endElement();
		w.writeElement(TAG_INVALIDATING, Collections.EMPTY_LIST, null);
		synchronized (invalidating) {
			for (final Iterator i = invalidating.iterator(); i.hasNext();)
				((GroupAddress) i.next()).save(w);
		}
		w.endElement();
	}
154266
protected function saveData()
    {
        $this->beforeSave();

        $changed = $this->setReceptionCode(
                $this->formData[$this->receptionCodeItem],
                $this->loader->getCurrentUser()->getUserId()
                );

        $this->afterSave($changed);

        $this->accesslog->logChange($this->request, null, $this->formData);
    }
54292
@Override
    public String getWsagAsSerializedData(String serializedData) throws ParserException {
        StringWriter stringWriter = new StringWriter();
        try {
            Template template = getWsagObject(serializedData);
            JAXBContext jaxbContext = JAXBContext.newInstance(Template.class);
            Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
            jaxbMarshaller.setEventHandler(new ValidationHandler());
            jaxbMarshaller.marshal(template, stringWriter);
        } catch (JAXBException e) {
            throw new ParserException(e);
        }
        return stringWriter.toString();
    }
616423
public function saveExtension(
        $uuid,
        $data,
        $extensionName,
        $webspaceKey,
        $locale,
        $userId
    ) {
        $document = $this->loadDocument(
            $uuid,
            $locale,
            [
                'exclude_ghost' => true,
            ]
        );

        if (null === $document) {
            throw new TranslatedNodeNotFoundException($uuid, $locale);
        }

        if (!$document instanceof ExtensionBehavior) {
            throw new \RuntimeException(
                sprintf(
                    'Document of class "%s" must implement the ExtensionableBehavior if it is to be extended',
                    get_class($document)
                )
            );
        }

        // save data of extensions
        $extension = $this->extensionManager->getExtension($document->getStructureType(), $extensionName);
        $node = $this->inspector->getNode($document);

        $extension->save($node, $data, $webspaceKey, $locale);
        $extensionData = $extension->load($node, $webspaceKey, $locale);

        $document->setExtension($extension->getName(), $extensionData);

        $this->documentManager->flush();

        $structure = $this->documentToStructure($document);

        $event = new ContentNodeEvent($node, $structure);
        $this->eventDispatcher->dispatch(ContentEvents::NODE_POST_SAVE, $event);

        return $structure;
    }
860583
protected function loadFormData()
    {
        parent::loadFormData();

        if ($this->createData && ($this->request->isPost() && (! isset($this->formData[$this->saveButtonId])))) {
            if ((! $this->_saveButton) || (! $this->_saveButton->isChecked())) {
                if (isset($this->formData['grs_ssn']) && $this->formData['grs_ssn'])  {
                    $filter = array(
                        'grs_ssn' => $this->formData['grs_ssn'],
                        'gr2o_id_organization' => true, // Make sure all organizations are checked in RespModel
                        );

                    if ($this->formData['gr2o_id_organization']) {
                        $orgId = $this->formData['gr2o_id_organization'];
                    } else {
                        $orgId = $this->model->get('gr2o_id_organization', 'default');
                    }
                    $order = array(
                        $this->db->quoteInto(
                                "CASE WHEN gr2o_id_organization = ? THEN 1 ELSE 2 END",
                                $orgId
                                ) => SORT_ASC
                        );

                    $data = $this->model->loadFirst($filter, $order);

                    // Fallback for when just a respondent row was saved but no resp2org exists
                    if (! $data) {
                        $data = $this->db->fetchRow(
                                "SELECT * FROM gems__respondents WHERE grs_ssn = ?",
                                $this->formData['grs_ssn']
                                );

                        if ($data) {
                            $data['gr2o_id_organization'] = false;
                        }
                    }

                    if ($data) {
                        // \MUtil_Echo::track($this->formData);
                        // \MUtil_Echo::track($data);
                        // Do not use this value
                        unset($data['grs_ssn']);

                        if ($data['gr2o_id_organization'] == $orgId) {
                            // gr2o_patient_nr
                            // gr2o_id_organization

                            $this->addMessage($this->_('Known respondent.'));

                            //*
                            foreach ($data as $name => $value) {
                                if ((substr($name, 0, 4) == 'grs_') || (substr($name, 0, 5) == 'gr2o_')) {
                                    if (array_key_exists($name, $this->formData)) {
                                        $this->formData[$name] = $value;
                                    }
                                    $cname = $this->model->getKeyCopyName($name);
                                    if (array_key_exists($cname, $this->formData)) {
                                        $this->formData[$cname] = $value;
                                    }
                                }
                            } // */
                        } else {
                            if ($data['gr2o_id_organization']) {
                                $org = $this->loader->getOrganization($data['gr2o_id_organization']);
                                $this->addMessage(sprintf(
                                        $this->_('Respondent data retrieved from %s.'),
                                        $org->getName()
                                        ));
                            } else {
                                $this->addMessage($this->_('Respondent data found.'));
                            }

                            foreach ($data as $name => $value) {
                                if ((substr($name, 0, 4) == 'grs_') && array_key_exists($name, $this->formData)) {
                                    $this->formData[$name] = $value;
                                }
                                $this->formData['gr2o_id_user'] = $data['grs_id_user'];
                            }
                        }

                    }
                }
            }
        }
    }
655049
protected function parseData()
    {
        if (strtoupper($this->getRequestMethod()) == 'GET') {
            $this->rawData = ($this->getQueryString()) ? rawurldecode($this->getQueryString()) : null;
        } else {
            $input = fopen('php://input', 'r');
            while ($data = fread($input, 1024)) {
                $this->rawData .= $data;
            }
        }

        // If the content-type is JSON
        if ($this->getQueryString() && stripos($this->getQueryString(), 'json') !== false) {
            $this->parsedData = json_decode($this->rawData, true);
        // Else, if the content-type is XML
        } elseif ($this->getContentType() && stripos($this->getContentType(), 'xml') !== false) {
            $matches = [];
            preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $this->rawData, $matches);

            foreach ($matches[0] as $match) {
                $strip = str_replace(
                    ['<![CDATA[', ']]>', '<', '>'],
                    ['', '', '&lt;', '&gt;'],
                    $match
                );
                $this->rawData = str_replace($match, $strip, $this->rawData);
            }

            $this->parsedData = json_decode(json_encode((array) simplexml_load_string($this->rawData)), true);
        // Else, default to a regular URL-encoded string
        } else {
            switch (strtoupper($this->getRequestMethod())) {
                case 'GET':
                    $this->parsedData = $this->get;
                    break;

                case 'POST':
                    $this->parsedData = $this->post;
                    break;
                default:
                    if ($this->getContentType() && strtolower($this->getContentType()) == 'application/x-www-form-urlencoded') {
                        parse_str($this->rawData, $this->parsedData);
                    }
            }
        }
        switch (strtoupper($this->getRequestMethod())) {
            case 'PUT':
                $this->put = $this->parsedData;
                break;

            case 'PATCH':
                $this->patch = $this->parsedData;
                break;

            case 'DELETE':
                $this->delete = $this->parsedData;
                break;
        }
    }