Create Game opportunity and utilization activity while checkin record is created.
341075
public function save() {
    $return = parent::save();

    // Create Game opportunity.
    $campaignMembers = $this->getActiveCampaignMembers();

    foreach (array_keys($campaignMembers) as $campaignMemberId) {
      $isAllowedToCreateAnEntry = FALSE;

      $memberCampaign = MemberCampaign::load($campaignMemberId);
      /** @var \Drupal\node\NodeInterface $campaign */
      $campaign = $memberCampaign->getCampaign();
      foreach ($campaign->get('field_ways_to_earn_entries')->getValue() as $item) {
        if ($item['value'] == MemberGame::TYPE_CHECKIN) {
          $isAllowedToCreateAnEntry = TRUE;
          break;
        }
      }

      if ($isAllowedToCreateAnEntry) {
        $game = MemberGame::create([
          'member' => $campaignMemberId,
          'chance_type' => MemberGame::TYPE_CHECKIN,
        ]);

        $game->save();
      }
    }

    return $return;
  }
1307325
def _post_create(self, auto_refresh=False):

		'''
		
		'''

		# set PCDM triple as Collection
		self.add_triple(self.rdf.prefixes.rdf.type, self.rdf.prefixes.pcdm.File)
		self.update(auto_refresh=auto_refresh)
1256667
def post(method, hmc, uri, uri_parms, body, logon_required,
             wait_for_completion):
        """"""
        assert wait_for_completion is True  # synchronous operation
        try:
            console = hmc.consoles.lookup_by_oid(None)
        except KeyError:
            raise InvalidResourceError(method, uri)
        check_required_fields(method, uri, body, ['name'])
        properties = copy.deepcopy(body)
        if 'type' in properties:
            raise BadRequestError(
                method, uri, reason=6,
                message="Type specified when creating a user role: {!r}".
                format(properties['type']))
        properties['type'] = 'user-defined'
        new_user_role = console.user_roles.add(properties)
        return {'object-uri': new_user_role.uri}
170783
public synchronized void preparing() {
      if (trace) {
         log.tracef("[%s] Current status is %s, setting status to: PREPARING", globalTransaction.globalId(),
                    transactionState);
      }
      transactionState.add(State.PREPARING);
   }
1060781
async def setup(self):
        """"""
        try:
            engine = await self.db
            created = False
            if not await engine.has_table(self.table_name):
                # create table
                logger.info("Creating SQL table [{}]".format(self.table_name))
                items = self._get_table()
                await engine.execute(CreateTable(items))
                # create indeces
                conn = await engine.connect()
                await conn.execute(
                    "CREATE INDEX `lb_last_updated` ON `{}` (`source_id` DESC,`updated` DESC);".format(self.table_name))
                await conn.execute(
                    "CREATE INDEX `lb_post` ON `{}` (`target_id` DESC,`post_id` DESC);".format(self.table_name))
                await conn.close()
                created = True
            # create control table if not already created.
            if self.control_table_name and not await engine.has_table(self.control_table_name):
                # create table
                logger.info("Creating SQL control table [{}]".format(self.control_table_name))
                items = self._get_control_table()
                await engine.execute(CreateTable(items))
                created = True
            return created
        except Exception as exc:
            logger.error("[DB] Error when setting up SQL table: {}".format(exc))
        return False
765442
void performPostCreationTasks()
    {
        StatusAction statusAction = new StatusAction();
        try
        {
            ResponseEvents events = CoherentManagerConnection.sendEventGeneratingAction(statusAction, 1000);
            for (ResponseEvent event : events.getEvents())
            {
                if (event instanceof StatusEvent)
                {
                    // do nothing. Creating the events will register the
                    // channels, which is after all what we are trying to do.
                }
            }

        }
        catch (IllegalArgumentException | IllegalStateException | IOException | TimeoutException e)
        {
            logger.error(e, e);
        }

    }
812737
private static StateUpdater createCheck(Cursor cursor, SelectorModel model, AtomicReference<StateUpdater> start)
    {
        return (extrp, current) ->
        {
            if (model.isEnabled() && cursor.getClick() == 0)
            {
                return start.get();
            }
            return current;
        };
    }
681464
@Override
  public void recordActivityStart(ExecutionEntity executionEntity) {
    if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
      if (executionEntity.getActivityId() != null && executionEntity.getCurrentFlowElement() != null) {
        
        HistoricActivityInstanceEntity historicActivityInstanceEntity = null;
        
        // Historic activity instance could have been created (but only in cache, never persisted)
        // for example when submitting form properties
        HistoricActivityInstanceEntity historicActivityInstanceEntityFromCache = 
            getHistoricActivityInstanceFromCache(executionEntity.getId(), executionEntity.getActivityId(), true);
        if (historicActivityInstanceEntityFromCache != null) {
          historicActivityInstanceEntity = historicActivityInstanceEntityFromCache;
        } else {
          historicActivityInstanceEntity = createHistoricActivityInstanceEntity(executionEntity);
        }
        
        // Fire event
        ActivitiEventDispatcher activitiEventDispatcher = getEventDispatcher();
        if (activitiEventDispatcher != null && activitiEventDispatcher.isEnabled()) {
          activitiEventDispatcher.dispatchEvent(
              ActivitiEventBuilder.createEntityEvent(ActivitiEventType.HISTORIC_ACTIVITY_INSTANCE_CREATED, historicActivityInstanceEntity));
        }
        
      }
    }
  }
407365
def _create(self, cache_file):
        """"""
        conn = sqlite3.connect(cache_file)
        cur = conn.cursor()
        cur.execute("PRAGMA foreign_keys = ON")
        cur.execute('''
            CREATE TABLE jobs(
                hash TEXT NOT NULL UNIQUE PRIMARY KEY, description TEXT NOT NULL,
                last_run REAL, next_run REAL, last_run_result INTEGER)''')

        cur.execute('''
            CREATE TABLE history(
                hash TEXT, description TEXT, time REAL, result INTEGER,
                FOREIGN KEY(hash) REFERENCES jobs(hash))''')

        conn.commit()
        conn.close()
779619
def create(self):
        
        pb = self._get_ansible_playbook(self.playbooks.create)
        pb.execute()
1062263
public void triggerSessionCreated(JingleSession jingleSession) {
        jingleSessions.add(jingleSession);
        jingleSession.addListener(this);
        for (CreatedJingleSessionListener createdJingleSessionListener : creationListeners) {
            try {
                createdJingleSessionListener.sessionCreated(jingleSession);
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, "exception", e);
            }
        }
    }
948918
private function createSavegame()
    {
        // the current process will become the savegame
        $this->savegame = \posix_getpid();

        $pid = \pcntl_fork();
        if ($pid < 0) {
            throw new \RuntimeException('Unable to create savegame fork');
        } elseif ($pid > 0) {
            // we're the savegame now... let's wait and see what happens
            \pcntl_waitpid($pid, $status);

            // worker exited cleanly, let's bail
            if (!\pcntl_wexitstatus($status)) {
                \posix_kill(\posix_getpid(), SIGKILL);
            }

            // worker didn't exit cleanly, we'll need to have another go
            $this->createSavegame();
        }
    }
1154419
def after_create(record)
      Resque.enqueue(::Riaction::ProfileCreator, record.class.base_class.to_s, record.id) unless record.class.riactionless?
    end
478427
def run(activity_uri = nil)
      records.each do |rec|
        next if rec.nil?
        begin
          process_record(rec, activity_uri)
        rescue => e
          Krikri::Logger.log :error, "Error harvesting record:\n" \
                                     "#{rec.content}\n\twith message:\n"\
                                     "#{e.message}"
          next
        end
      end
      true
    end
339963
private void createReport() {
        CampaignReportManager.getInstance().startReport(campaignStartTimeStamp, currentCampaign.getName());
        for (CampaignRun run : currentCampaign.getRuns()) {
            CampaignResult result = new CampaignResult(run.getTestbed());
            result.setStatus(Status.NOT_EXECUTED);
            CampaignReportManager.getInstance().putEntry(result);
        }

        CampaignReportManager.getInstance().refresh();
    }
1284400
def create(ctx, data):
    """"""
    swag = create_swag_from_ctx(ctx)
    data = json.loads(data.read())

    for account in data:
        swag.create(account, dry_run=ctx.dry_run)
1044215
def _post_create(self, auto_refresh=False):

		'''
		
		'''

		# set PCDM triple as Collection
		self.add_triple(self.rdf.prefixes.rdf.type, self.rdf.prefixes.pcdm.Collection)
		self.update(auto_refresh=auto_refresh)

		# create /members child resource
		members_child = PCDMMembersContainer(
			self.repo,
			'%s/members' % self.uri_as_string(),
			membershipResource=self.uri,
			hasMemberRelation=self.rdf.prefixes.pcdm.hasMember,
			insertedContentRelation=self.rdf.prefixes.ore.proxyFor)
		members_child.create(specify_uri=True)

		# create /related child resource
		related_child = PCDMRelatedContainer(
			self.repo,
			'%s/related' % self.uri_as_string(),
			membershipResource=self.uri,
			hasMemberRelation=self.rdf.prefixes.ore.aggregates,
			insertedContentRelation=self.rdf.prefixes.ore.proxyFor)
		related_child.create(specify_uri=True)