Create an activity
@param state
@param commit
@param rootState
@param activity
@returns {Promise<*|boolean|void>}
420667
function createActivity(_ref9, activity) {
    var state = _ref9.state,
        commit = _ref9.commit,
        rootState = _ref9.rootState;
    return makeRequest(commit, rootState.c3s.client.apis.Activities.create_activity, {
      activity: activity
    }, 'c3s/activity/SET_ACTIVITY');
  }
656868
def create_activity(self, *args, **kwargs):
        
        if self._client.match_app_version(label='wim', version='<2.0.0', default=True):
            return self._client.create_activity(self.process, *args, **kwargs)
        else:
            return self._client.create_activity(self.workflow_root, *args, **kwargs)
403424
@Override
	public void commit() throws IndoubtException {
		session.transaction.remove();
		
		if (logs.size() == 0) {
			return;
		}
		
		try {
			for (Log log : logs) {
				if (log.operation() != Operation.GET) {
					if (transaction.isActive()) {
						transaction.commit();
					}
					
					log.state(State.COMMITTED);
				}
			}

		} catch (Exception e) {
			throw new UncheckedException(e);
		}
		
		logger.fine("Transaction [" + id + "] committed");
	}
630485
public Project.Storepoints.Storepoint.Activities.Activity createProjectStorepointsStorepointActivitiesActivity()
   {
      return new Project.Storepoints.Storepoint.Activities.Activity();
   }
502985
public static Intent createUriIntent(String intentAction, String intentUri) {
        if (intentAction == null) {
            intentAction = Intent.ACTION_VIEW;
        }
        return new Intent(intentAction, Uri.parse(intentUri))
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
                        | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    }
232425
@Override
	public <D, F, P> Promise<D, F, P> when(Promise<D, F, P> promise) {
		if (promise instanceof AndroidDeferredObject) {
			return promise;
		}
		return new AndroidDeferredObject<D, F, P>(promise).promise();
	}
787764
function startActivity (activityId) {
  var timestamp = new Date().getTime()
  var body = 'activityId=' + activityId + ':timestamp=' + timestamp

  return this.request('startactivity', body, 'encoded', function (stanza) {
    // This canHandleStanzaFn waits for a stanza that confirms starting the activity.
    var event = stanza.getChild('event')
    var canHandleStanza = false

    if (event && event.attr('type') === 'connect.stateDigest?notify') {
      var digest = JSON.parse(event.getText())
      if (activityId === '-1' && digest.activityId === activityId && digest.activityStatus === 0) {
        canHandleStanza = true
      } else if (activityId !== '-1' && digest.activityId === activityId && digest.activityStatus === 2) {
        canHandleStanza = true
      }
    }
    return canHandleStanza
  })
}
998296
public void onCreate(Bundle savedInstanceState) {
        Session session = Session.getActiveSession();
        if (session == null) {
            if (savedInstanceState != null) {
                session = Session.restoreSession(activity, null, callback, savedInstanceState);
            }
            if (session == null) {
                session = new Session(activity);
            }
            Session.setActiveSession(session);
        }
        if (savedInstanceState != null) {
            pendingFacebookDialogCall = savedInstanceState.getParcelable(DIALOG_CALL_BUNDLE_SAVE_KEY);
        }
    }
1316374
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content);
        if (fragment == null) {
            fragment = MainFragment.newInstance(getIntent().getExtras());
            getSupportFragmentManager()
                    .beginTransaction()
                    .replace(android.R.id.content, fragment, "")
                    .commit();
        } else {
            getSupportFragmentManager()
                    .beginTransaction()
                    .attach(fragment)
                    .commit();
        }
    }
1311560
public void onCreate(Bundle savedInstanceState) {
		LOGGER.debug("Executing onCreate on " + fragment);
		fragment.setRetainInstance(getFragmentIf().shouldRetainInstance());

		fragmentDelegatesMap = Maps.newHashMap();
		for (AppModule appModule : AbstractApplication.get().getAppModules()) {
			FragmentDelegate fragmentDelegate = getFragmentIf().createFragmentDelegate(appModule);
			if (fragmentDelegate != null) {
				fragmentDelegatesMap.put(appModule, fragmentDelegate);
				fragmentDelegate.onCreate(savedInstanceState);
			}
		}
	}
935257
function Activities(wixApi) {

    if (!(wixApi instanceof Wix)){
        throw 'WixApi must be provided'
    }
    var wixApi = wixApi;
    this.wixApi = function() {
        return wixApi;
    };

    /**
     * Creates a new WixActivity for the given {@link ActivityType}
     * @method
     * @param {ActivityType} type the type of Activity
     * @returns {WixActivity} returns an empty Wix Activity
     */
    this.newActivity = function(type) {
        var wao = new WixActivity();
        extend(wao, new WixActivityData());
        return wao.withActivityType(type);
    };

    /**
     * Posts the Activity to Wix.  Returns a Promise for an id
     * @param {WixActivity} activity the Activity to post to Wix
     * @param {string} userSessionToken The current session token for active Wix user
     * @returns {Promise.<string, error>} A new id, or an error
     */
    this.postActivity = function(activity, userSessionToken) {
        if(!(activity instanceof WixActivity)) {
            throw 'WixActivity must be provided'
        }
        if(!activity.isValid()) {
            throw 'WixActivity is missing required fields'
        }
        if(!activity.isWritable()){
            throw 'Cannot post read only Activities'
        }

        var deferred = q.defer();
        var request = this.createRequest("POST", "/v1/activities");

        request.withPostData(JSON.stringify(activity.toJSON()));
        request.withQueryParam("userSessionToken", userSessionToken);
        request.asWixQueryParams();
        var options = request.toHttpsOptions();
        rest.postJson('https://' + options.host + options.path, activity, {
            headers : options.headers
        }).on('complete', function(data, response) {
            if(response.statusCode === 200) {
                deferred.resolve(data.activityId);
            } else {
                deferred.reject(data);
            }

        }).on('error', function(data) {
            deferred.reject(data);
        });
        return deferred.promise;
    };
    /**
     * Returns an Activity by a given ID
     * @param {string} activityId The id of the Activity to return
     * @returns {Promise.<WixActivity, error>} An Activity, or an error
     */
    this.getActivityById = function(activityId) {
        if (activityId === undefined || activityId == null || activityId.length == 0){
            throw "Activity Id must be provided"
        }
        return this.resourceRequest(this.createRequest("GET", "/v1/activities/").withPathSegment(activityId),
        function(data) {
            return new WixActivityData().init(data);
        });
    };

    /**
     * Get Activities Query Options
     * @typedef {Object} GetActivitiesOptions
     * @property {?Number} pageSize - The number of results to return per page of data. Valid options are: 25, 50 and 100. Defaults to 25
     * @property {?string} activityTypes - The activity types to filter against. Multiple activity types are separated by a comma
     * @property {?dateTime} until - The ending date for activities we want to return, as an ISO 8601 timestamp This field is only relevant when a cursor is not present
     * @property {?dateTime} from - The     beginning date for activities we want to return, as an ISO 8601 timestamp. This field is only relevant when a cursor is not present
     * @property {?string} scope - The scope of the results to return, either for the entire site or limited to the current application. Can either be site or app. By default, all activities for the site will be returned
     */

    /**
     * Navigates the Activities found on the current site
     * @param {string} cursor The current cursor
     * @param options {GetActivitiesOptions} The Activity to post
     * @returns {Promise.<WixPagingData, error>} A promise for a {@link WixPagingData} object to navigate results, or an error
     */
    this.getActivities = function(cursor, options) {
        var request = this.createRequest("GET", "/v1/activities");
        if(cursor !== undefined && cursor !== null) {
            request.withQueryParam("cursor", cursor);
        }
        if(options !== undefined && options !== null) {
            if(options.from !== undefined && options.from !== null) {
                request.withQueryParam("from", options.from);
            }
            if (options.until !== undefined && options.until !== null) {
                request.withQueryParam("until", options.until);
            }
            if (options.scope !== undefined && options.scope !== null) {
                request.withQueryParam("scope", options.scope);
            }
            if (options.activityTypes !== undefined && options.activityTypes !== null) {
                request.withQueryParam("activityTypes", options.activityTypes);
            }
            if (options.pageSize !== undefined && options.pageSize !== null) {
                request.withQueryParam("pageSize", options.pageSize);
            }
        }
        var wixApi = this;
        return this.resourceRequest(request, function(data) {
            return new WixPagingData(data, function(cursor) {
                return wixApi.getActivities(cursor, null);
            }, function(elem) {
                return new WixActivityData().init(elem);
            });
        });
    };

    /**
     * Returns a list of all activity types contained within the Wix system
     * @returns {Promise.<Array.<string>, error>} A promise for an array of strings
     */
    this.getTypes = function() {
        return this.resourceRequest(this.createRequest("GET", "/v1/activities/types"), null);
    }
}
29073
protected ActionState createTerminateSessionActionState(final Flow flow) {
        val actionState = createActionState(flow, CasWebflowConstants.STATE_ID_TERMINATE_SESSION, CasWebflowConstants.ACTION_ID_TERMINATE_SESSION);
        createTransitionForState(actionState, CasWebflowConstants.TRANSITION_ID_WARN, CasWebflowConstants.STATE_ID_CONFIRM_LOGOUT_VIEW);
        createStateDefaultTransition(actionState, CasWebflowConstants.STATE_ID_DO_LOGOUT);
        return actionState;
    }
290404
function getActivities(_ref, _ref2) {
    var state = _ref.state,
        commit = _ref.commit,
        dispatch = _ref.dispatch,
        rootState = _ref.rootState;

    var _ref3 = _slicedToArray(_ref2, 2),
        search = _ref3[0],
        limit = _ref3[1];

    search = rison.encode(search);
    return makeRequest(commit, rootState.c3s.client.apis.Activities.get_activities, {
      search_term: search || undefined,
      limit: limit || 100
    }, 'c3s/activity/SET_ACTIVITIES');
  }
1089157
protected void createRealizationAndState(
    MessageProcessor messageProcessor,
    TransactionCommon transaction)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "createRealizationAndState",
        new Object[] {
          messageProcessor,
          transaction });

                                         
    /*
     * Create associated state handler of appropriate type
     */
      _ptoPRealization = new LinkState(this,
                                          messageProcessor,
                                          getLocalisationManager());
      _protoRealization = _ptoPRealization;
    
          
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createRealizationAndState");
  }
185736
private AbstractState createState(CopycatServer.State state) {
    switch (state) {
      case INACTIVE:
        return new InactiveState(this);
      case RESERVE:
        return new ReserveState(this);
      case PASSIVE:
        return new PassiveState(this);
      case FOLLOWER:
        return new FollowerState(this);
      case CANDIDATE:
        return new CandidateState(this);
      case LEADER:
        return new LeaderState(this);
      default:
        throw new AssertionError();
    }
  }
1042865
@SuppressWarnings("unchecked")
  <T extends Operation<U>, U> U executeOperation(Commit commit) {
    // If the commit operation is a no-op command, complete the operation.
    if (commit.operation() instanceof NoOpCommand) {
      commit.close();
      return null;
    }

    // Get the function registered for the operation. If no function is registered, attempt to
    // use a global function if available.
    Function function = operations.get(commit.type());

    if (function == null) {
      // If no operation function was found for the class, try to find an operation function
      // registered with a parent class.
      for (Map.Entry<Class, Function> entry : operations.entrySet()) {
        if (entry.getKey().isAssignableFrom(commit.type())) {
          function = entry.getValue();
          break;
        }
      }

      // If a parent operation function was found, store the function for future reference.
      if (function != null) {
        operations.put(commit.type(), function);
      }
    }

    if (function == null) {
      throw new IllegalStateException("unknown state machine operation: " + commit.type());
    } else {
      // Execute the operation. If the operation return value is a Future, await the result,
      // otherwise immediately complete the execution future.
      try {
        return (U) function.apply(commit);
      } catch (Exception e) {
        LOGGER.warn("State machine operation failed: {}", e);
        throw new ApplicationException(e, "An application error occurred");
      }
    }
  }
269107
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_eula);
        initUI();
        parseExtras(savedInstanceState);
    }