Serialize a single record and persistent identifier.

        :param pid: Persistent identifier instance.
        :param record: Record instance.
        :param links_factory: Factory function for record links.
766886
def serialize(self, pid, record, links_factory=None):
        
        return simpledc.tostring(
            self.transform_record(pid, record, links_factory))
847804
@Override
	public void serializeRecord(T record) throws IOException {
		if (CHECKED) {
			if (dataBuffer.hasRemaining()) {
				throw new IllegalStateException("Pending serialization of previous record.");
			}
		}

		serializationBuffer.clear();
		lengthBuffer.clear();

		// write data and length
		record.write(serializationBuffer);

		int len = serializationBuffer.length();
		lengthBuffer.putInt(0, len);

		dataBuffer = serializationBuffer.wrapAsByteBuffer();
	}
1118996
def _link(self, *args, **kwargs):
        
        if self._record.redirect_url:
            return links.resolve(self._record.redirect_url,
                                 self.search_path, kwargs.get('absolute'))

        return self._permalink(*args, **kwargs)
963368
def oaiid_minter(record_uuid, data):
    
    pid_value = data.get('_oai', {}).get('id')
    if pid_value is None:
        fetcher_name = \
            current_app.config.get('OAISERVER_CONTROL_NUMBER_FETCHER', 'recid')
        cn_pid = current_pidstore.fetchers[fetcher_name](record_uuid, data)
        pid_value = current_app.config.get('OAISERVER_ID_PREFIX', '') + str(
            cn_pid.pid_value
        )
    provider = OAIIDProvider.create(
        object_type='rec', object_uuid=record_uuid,
        pid_value=str(pid_value)
    )
    data.setdefault('_oai', {})
    data['_oai']['id'] = provider.pid.pid_value
    return provider.pid
357864
def _gen_records(self, record, zone_id, creating=False):
        '''
        
        '''
        return _Route53Record.new(self, record, zone_id, creating)
28593
def pid(self):
        
        return hashlib.md5(':'.join([self.__class__.__name__,
                                     self._uri]).encode('utf-8')).hexdigest()
515382
def _serialize_record(self, record):
        """"""
        f = self._empty_to_dot
        row = [record.CHROM, record.POS]
        row.append(f(";".join(record.ID)))
        row.append(f(record.REF))
        if not record.ALT:
            row.append(".")
        else:
            row.append(",".join([f(a.serialize()) for a in record.ALT]))
        row.append(f(record.QUAL))
        row.append(f(";".join(record.FILTER)))
        row.append(f(self._serialize_info(record)))
        if record.FORMAT:
            row.append(":".join(record.FORMAT))
        row += [
            self._serialize_call(record.FORMAT, record.call_for_sample[s])
            for s in self.header.samples.names
        ]
        print(*row, sep="\t", file=self.stream)
668688
def setCurrentRecord( self, record ):
        
        mode = self.currentMode()
        if ( mode == XOrbBrowserWidget.Mode.Detail ):
            self.detailWidget().setCurrentRecord(record)
        
        elif ( mode == XOrbBrowserWidget.Mode.Thumbnail ):
            thumbs = self.thumbnailWidget()
            for row in range(thumbs.count()):
                item = thumbs.item(row)
                if ( isinstance(item, RecordListWidgetItem) and \
                     item.record() == item ):
                    thumbs.setCurrentItem(item)
                    break
326673
def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
        
        ids = []

        if identifier:
            ids.append(identifier)
        elif not identifier and rtype and name:
            records = self._list_records(rtype, name, content)
            if records:
                ids = [record["id"] for record in records]

        if ids:
            LOGGER.debug("delete_records: %s", ids)
            with localzone.manage(self.filename, self.origin, autosave=True) as zone:
                for hashid in ids:
                    zone.remove_record(hashid)  # pylint: disable=no-member
                    LOGGER.debug("delete_record: %s", hashid)

        return True
1129160
def store_objectlink(link_type)   # :nodoc:
    record      = 0x1027     # Record identifier.
    length      = 0x0006     # Number of bytes to follow.
    # link_type              # Object text link type.
    link_index1 = 0x0000     # Link index 1.
    link_index2 = 0x0000     # Link index 2.

    store_simple(record, length, link_type, link_index1, link_index2)
  end
244451
def record_file_factory(pid, record, filename):
    
    try:
        if not (hasattr(record, 'files') and record.files):
            return None
    except MissingModelError:
        return None

    try:
        return record.files[filename]
    except KeyError:
        return None
1351676
def set_id(self,pid):
        
        if self.type == 'KAF':
            return self.node.set('pid',pid)
        elif self.type == 'NAF':
            return self.node.set('id',pid)
1204833
def _create_request_record(self, identifier, rtype, name, content, ttl, priority):  # pylint: disable=too-many-arguments
        """"""
        record = collections.OrderedDict()

        # Mandatory content

        # Just for update - not for creation
        if identifier is not None:
            record['id'] = identifier

        record['type'] = rtype

        # Just for creation - not for update
        if name is not None:
            record['name'] = self._relative_name(name)

        # Optional content
        if content is not None:
            record['content'] = content
        if ttl is not None:
            record['ttl'] = ttl
        if priority is not None:
            record['prio'] = priority
        return record
36872
def update_record(self, identifier, rtype=None, name=None, content=None, **kwargs):
        
        if not rtype and kwargs.get('type'):
            warnings.warn('Parameter "type" is deprecated, use "rtype" instead.',
                          DeprecationWarning)
            rtype = kwargs.get('type')

        return self._update_record(identifier, rtype=rtype, name=name, content=content)
319496
private static OIdentifiable linkToStream(final StringBuilder buffer, final ORecordSchemaAware<?> iParentRecord, Object iLinked) {
    if (iLinked == null)
      // NULL REFERENCE
      return null;

    OIdentifiable resultRid = null;
    ORID rid;

    final ODatabaseRecord database = ODatabaseRecordThreadLocal.INSTANCE.get();

    if (iLinked instanceof ORID) {
      // JUST THE REFERENCE
      rid = (ORID) iLinked;

      if (rid.isValid() && rid.isNew()) {
        // SAVE AT THE FLY AND STORE THE NEW RID
        final ORecord<?> record = rid.getRecord();

        if (database.getTransaction().isActive()) {
          // USE THE DEFAULT CLUSTER
          database.save((ORecordInternal<?>) record);

        } else
          database.save((ORecordInternal<?>) record);

        if (record != null)
          rid = record.getIdentity();
        resultRid = rid;
      }
    } else {
      if (iLinked instanceof String)
        iLinked = new ORecordId((String) iLinked);
      else if (!(iLinked instanceof ORecordInternal<?>)) {
        // NOT RECORD: TRY TO EXTRACT THE DOCUMENT IF ANY
        final String boundDocumentField = OObjectSerializerHelperManager.getInstance().getDocumentBoundField(iLinked.getClass());
        if (boundDocumentField != null)
          iLinked = OObjectSerializerHelperManager.getInstance().getFieldValue(iLinked, boundDocumentField);
      }

      if (!(iLinked instanceof OIdentifiable))
        throw new IllegalArgumentException("Invalid object received. Expected a OIdentifiable but received type="
            + iLinked.getClass().getName() + " and value=" + iLinked);

      // RECORD
      ORecordInternal<?> iLinkedRecord = ((OIdentifiable) iLinked).getRecord();
      rid = iLinkedRecord.getIdentity();

      if (rid.isNew() || iLinkedRecord.isDirty()) {
        if (iLinkedRecord instanceof ODocument) {
          final OClass schemaClass = ((ODocument) iLinkedRecord).getSchemaClass();
          database.save(iLinkedRecord, schemaClass != null ? database.getClusterNameById(schemaClass.getDefaultClusterId()) : null);
        } else
          // STORE THE TRAVERSED OBJECT TO KNOW THE RECORD ID. CALL THIS VERSION TO AVOID CLEAR OF STACK IN THREAD-LOCAL
          database.save(iLinkedRecord);

        final ODatabaseComplex<?> dbOwner = database.getDatabaseOwner();
        dbOwner.registerUserObjectAfterLinkSave(iLinkedRecord);

        resultRid = iLinkedRecord;
      }

      if (iParentRecord != null && database instanceof ODatabaseRecord) {
        final ODatabaseRecord db = database;
        if (!db.isRetainRecords())
          // REPLACE CURRENT RECORD WITH ITS ID: THIS SAVES A LOT OF MEMORY
          resultRid = iLinkedRecord.getIdentity();
      }
    }

    if (rid.isValid())
      rid.toString(buffer);

    return resultRid;
  }
1082797
def construct_infrastructure_factory(self, *args, **kwargs):
        
        factory_class = self.infrastructure_factory_class
        assert issubclass(factory_class, InfrastructureFactory)
        return factory_class(
            record_manager_class=self.record_manager_class,
            integer_sequenced_record_class=self.stored_event_record_class,
            sequenced_item_class=self.sequenced_item_class,
            contiguous_record_ids=self.contiguous_record_ids,
            application_name=self.name,
            pipeline_id=self.pipeline_id,
            snapshot_record_class=self.snapshot_record_class,
            *args, **kwargs
        )
1332078
def _update_record(self, identifier, rtype=None, name=None, content=None):
        """"""
        record = {}

        if not identifier:
            records = self._list_records(rtype, name, content)
            identifiers = [r["id"] for r in records]
        else:
            identifiers = [identifier]

        if name:
            record["name"] = self._relative_name(name)
        if content:
            record["content"] = content
        if self._get_lexicon_option('ttl'):
            record["ttl"] = self._get_lexicon_option('ttl')
        if self._get_lexicon_option('priority'):
            record["prio"] = self._get_lexicon_option('priority')

        LOGGER.debug("update_records: %s", identifiers)

        for record_id in identifiers:
            self._put(
                "/v1/domains/{0}/records/{1}".format(
                    self.domain, identifier
                ),
                record,
            )
            LOGGER.debug("update_record: %s", record_id)

        LOGGER.debug("update_record: %s", True)
        return True