Override create to add secondary ID to Subject in History, and create Data.ID, if it is null
777651
public Result<FutureDAO.Data> create(AuthzTrans trans,	FutureDAO.Data data, String id) {
		// If ID is not set (typical), create one.
		if(data.id==null) {
			StringBuilder sb = new StringBuilder(trans.user());
			sb.append(data.target);
			sb.append(System.currentTimeMillis());
			data.id = UUID.nameUUIDFromBytes(sb.toString().getBytes());
		}
		Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data);
		if(rs.notOK()) {
			return Result.err(rs);
		}
		wasModified(trans, CRUD.create, data, null, id);
		return Result.ok(data);	
	}
1211589
def create(cls, id=None, **kwargs):
        
        what = cls(**kwargs)
        if id:
            setattr(what, cls.primaryKey, id)
        what.save()
        return what
1034510
def initialize(self, id, timestamp=None, user=None, page=None,
                   comment=None, type=None, action=None, text=None,
                   params=None, deleted=None):

        self.id = int(id)
        

        self.timestamp = none_or(timestamp, Timestamp)
        """
        log item timestamp : :class:`mwtypes.Timestamp`
        """

        self.user = none_or(user, User)
        """
        Contributing user metadata : :class:`mwtypes.User`
        """

        self.page = none_or(page, self.Page)
        """
        Related page : :class:`mwtypes.log_item.Page`
        """

        self.comment = none_or(comment, str)
        """
        Comment left with log item : `str`
        """

        self.type = none_or(type, str)
        """
        Type of log item : `str`
        """

        self.action = none_or(action, str)
        """
        Action of log item : `str`
        """

        self.text = none_or(text, str)
        """
        Content of text : `str`
        """

        self.params = none_or(params, str)
        """
        Content of params : `str`
        """

        self.deleted = none_or(deleted, self.Deleted)
        """
        The deleted/suppressed status of the log item.
        """
78186
def add_data(self, request, pk=None):
        """"""
        # add data to entity
        resp = super().add_data(request, pk)

        # add data to collections in which entity is
        entity = self.get_object()
        for collection in entity.collections.all():
            collection.data.add(*request.data['ids'])

        return resp
1125558
protected void insertOrUpdate(HistoryEvent historyEvent) {

    final DbEntityManager dbEntityManager = getDbEntityManager();

    if(isInitialEvent(historyEvent)) {
      dbEntityManager.insert(historyEvent);
    } else {
      if(dbEntityManager.getCachedEntity(historyEvent.getClass(), historyEvent.getId()) == null) {
        if (historyEvent instanceof HistoricScopeInstanceEvent) {
          // if this is a scope, get start time from existing event in DB
          HistoricScopeInstanceEvent existingEvent = (HistoricScopeInstanceEvent) dbEntityManager.selectById(historyEvent.getClass(), historyEvent.getId());
          if(existingEvent != null) {
            HistoricScopeInstanceEvent historicScopeInstanceEvent = (HistoricScopeInstanceEvent) historyEvent;
            historicScopeInstanceEvent.setStartTime(existingEvent.getStartTime());
          }
        }
        if(historyEvent.getId() == null) {
//          dbSqlSession.insert(historyEvent);
        } else {
          dbEntityManager.merge(historyEvent);
        }
      }
    }
  }
50822
function checkOrGenerateId (data) {
        data = data || {};
        if (!data._id) {
          data._id = apos.utils.generateId();
        }
        return data;
      }
22218
def load(self, id=None):
        """"""
        if id is not None:
            # We are asked to change our ID to something else
            self.reset()
            self._setID(id)
        if not self._new and self._validID():
            self._loadDB()
        self._updated = time.time()
676181
public int addItem(int appId, ItemCreate create, boolean silent) {
		return getResourceFactory().getApiResource("/item/app/" + appId + "/")
				.queryParam("silent", silent ? "1" : "0")
				.entity(create, MediaType.APPLICATION_JSON_TYPE)
				.post(ItemCreateResponse.class).getId();
	}
319464
def _create_id(self):
    """"""
    cursor = self._db.cursor()
    cursor.execute('INSERT INTO Ids DEFAULT VALUES')
    return cursor.lastrowid
899685
def id(self, opts_id):
        """"""
        old_id = self._id
        self._id = opts_id
        if old_id is not None:
            cleanup_custom_options(old_id)
        if opts_id is not None and opts_id != old_id:
            if opts_id not in Store._weakrefs:
                Store._weakrefs[opts_id] = []
            ref = weakref.ref(self, partial(cleanup_custom_options, opts_id))
            Store._weakrefs[opts_id].append(ref)
254848
def update(id, name)
      params = { :id => id, :name => name }
      requires params
      DataSift.request(:POST, 'historics/update', @config, params)
    end
466456
def add_data(self, id, key, value):
        
        self[str(id)]['data'].setdefault(key, [])
        self[str(id)]['data'][key].append(value)
1154419
def after_create(record)
      Resque.enqueue(::Riaction::ProfileCreator, record.class.base_class.to_s, record.id) unless record.class.riactionless?
    end
1260482
def serialize_history_on_post_create(history_instance, using, **kwargs):
    
    try:
        wrapped_instance = site_offline_models.get_wrapped_instance(history_instance)
    except ModelNotRegistered:
        pass
    else:
        wrapped_instance.to_outgoing_transaction(using, created=True)
576496
public void addCohort(Cohort cohort, String studyId) {
        // Sanity check
        if (cohort == null || StringUtils.isEmpty(cohort.getId())) {
            logger.error("Cohort (or its ID) is null or empty.");
            return;
        }

        VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId);
        if (variantStudyMetadata == null) {
            logger.error("Study not found. Check your study ID: '{}'", studyId);
            return;
        }
        if (variantStudyMetadata.getCohorts() == null) {
            variantStudyMetadata.setCohorts(new ArrayList<>());
        }
        for (Cohort coho: variantStudyMetadata.getCohorts()) {
            if (coho.getId() != null && coho.getId().equals(cohort.getId())) {
                logger.error("Cohort with id '{}' already exists in study '{}'", cohort.getId(),
                        studyId);
                return;
            }
        }
        variantStudyMetadata.getCohorts().add(cohort);
    }
235050
def create_payload(self):
        """"""
        payload = super(OverrideValue, self).create_payload()
        if hasattr(self, 'smart_class_parameter'):
            del payload['smart_class_parameter_id']
        if hasattr(self, 'smart_variable'):
            del payload['smart_variable_id']
        return payload
1268828
@Override
  public void recordIdentityLinkCreated(IdentityLinkEntity identityLink) {
    // It makes no sense storing historic counterpart for an identity-link
    // that is related
    // to a process-definition only as this is never kept in history
    if (isHistoryLevelAtLeast(HistoryLevel.AUDIT) && (identityLink.getProcessInstanceId() != null || identityLink.getTaskId() != null)) {
      HistoricIdentityLinkEntity historicIdentityLinkEntity = getHistoricIdentityLinkEntityManager().create();
      historicIdentityLinkEntity.setId(identityLink.getId());
      historicIdentityLinkEntity.setGroupId(identityLink.getGroupId());
      historicIdentityLinkEntity.setProcessInstanceId(identityLink.getProcessInstanceId());
      historicIdentityLinkEntity.setTaskId(identityLink.getTaskId());
      historicIdentityLinkEntity.setType(identityLink.getType());
      historicIdentityLinkEntity.setUserId(identityLink.getUserId());
      getHistoricIdentityLinkEntityManager().insert(historicIdentityLinkEntity, false);
    }
  }