public BiographyResponse Execute(IdSpace id, int numberOfResults = 10, int start = 0, string license = null) { UriQuery query = GetQuery(numberOfResults, start, license); query.Add("id", id); return Execute<BiographyResponse>(query.ToString()); }
public Task<ReviewsResponse> ExecuteAsync(IdSpace id, int numberOfResults = 10, int start = 0) { UriQuery query = GetQuery(numberOfResults, start); query.Add("id", id); return ExecuteAsync<ReviewsResponse>(query.ToString()); }
public Task<NewsResponse> ExecuteAsync(IdSpace id, int numberOfResults = 10, int start = 0, bool highRelevance = false) { UriQuery query = GetQuery(numberOfResults, start, highRelevance); query.Add("id", id); return ExecuteAsync<NewsResponse>(query.ToString()); }
public void Add(string name, object property, IdSpace visibility) { Fx.Assert(!string.IsNullOrEmpty(name), "The name should be validated before calling this collection."); Fx.Assert(property != null, "The property should be validated before caling this collection."); var executionProperty = new ExecutionProperty(name, property, visibility); this.properties.Add(name, executionProperty); if (this.lastPropertyName == name) { this.lastProperty = property; } if (property is ExclusiveHandle) { this.exclusiveHandleCount++; UpdateChildExclusiveHandleCounts(1); } if (property is IExecutionProperty) { AddIExecutionProperty(executionProperty, false); } }
public object GetProperty(string name, IdSpace currentIdSpace) { Fx.Assert(!string.IsNullOrEmpty(name), "The name should be validated by the caller."); if (lastPropertyName == name && (this.lastPropertyVisibility == null || this.lastPropertyVisibility == currentIdSpace)) { return(lastProperty); } var currentManager = this; while (currentManager != null) { if (currentManager.properties.TryGetValue(name, out var property)) { if (!property.IsRemoved && (!property.HasRestrictedVisibility || property.Visibility == currentIdSpace)) { this.lastPropertyName = name; this.lastProperty = property.Property; this.lastPropertyVisibility = property.Visibility; return(this.lastProperty); } } currentManager = GetParent(currentManager); } return(null); }
public void OnDeserialized(ActivityInstance owner, ActivityInstance parent, IdSpace visibility, ActivityExecutor executor) { this.owningInstance = owner; if (parent != null) { if (parent.PropertyManager != null) { this.threadProperties = parent.PropertyManager.threadProperties; } } else { this.rootPropertyManager = executor.RootPropertyManager; } foreach (var property in this.properties.Values) { if (property.Property is IExecutionProperty) { AddIExecutionProperty(property, true); } if (property.HasRestrictedVisibility) { property.Visibility = visibility; } } }
public VideoResponse Execute(IdSpace id, int numberOfResults = 10, int start = 0) { UriQuery query = GetQuery(numberOfResults, start); query.Add("id", id); return Execute<VideoResponse>(query.ToString()); }
public Task<ImageResponse> ExecuteAsync(IdSpace id, int numberOfResults = 10, int start = 0, string license = null) { UriQuery query = GetQuery(numberOfResults, start, license); query.Add("id", id); return ExecuteAsync<ImageResponse>(query.ToString()); }
private bool CanApplyUpdateWhileRunning(Activity activity, bool isInNewDefinition) { Activity currentActivity = activity; IdSpace rootIdSpace = activity.MemberOf; do { DynamicUpdateMapEntry entry = null; if (isInNewDefinition) { this.map.TryGetUpdateEntryByNewId(currentActivity.InternalId, out entry); } else if (currentActivity.MemberOf == rootIdSpace) { this.map.TryGetUpdateEntry(currentActivity.InternalId, out entry); } if (entry != null && (entry.NewActivityId < 1 || entry.IsRuntimeUpdateBlocked || entry.IsUpdateBlockedByUpdateAuthor)) { return(false); } currentActivity = currentActivity.Parent; }while (currentActivity != null && currentActivity.MemberOf == rootIdSpace); return(true); }
public BiographyResponse Execute(IdSpace id, int numberOfResults = 10, int start = 0, string license = null) { UriQuery query = GetQuery(numberOfResults, start, license); query.Add("id", id); return(Execute <BiographyResponse>(query.ToString())); }
public Task <VideoResponse> ExecuteAsync(IdSpace id, int numberOfResults = 10, int start = 0) { UriQuery query = GetQuery(numberOfResults, start); query.Add("id", id); return(ExecuteAsync <VideoResponse>(query.ToString())); }
public SongResponse Execute(IdSpace id, int numberOfResults = 10, int start = 0) { UriQuery query = GetQuery(numberOfResults, start); query.Add("id", id); return(Execute <SongResponse>(query.ToString())); }
public Task <ImageResponse> ExecuteAsync(IdSpace id, int numberOfResults = 10, int start = 0, string license = null) { UriQuery query = GetQuery(numberOfResults, start, license); query.Add("id", id); return(ExecuteAsync <ImageResponse>(query.ToString())); }
public Task <BlogResponse> ExecuteAsync(IdSpace id, int numberOfResults = 10, int start = 0, bool highRelevance = false) { UriQuery query = GetQuery(numberOfResults, start, highRelevance); query.Add("id", id); return(ExecuteAsync <BlogResponse>(query.ToString())); }
public ExecutionProperty(string name, object property, IdSpace visibility) { this.Name = name; this.Property = property; if (visibility != null) { this.Visibility = visibility; this.HasRestrictedVisibility = true; } }
public IEnumerable <KeyValuePair <string, object> > GetFlattenedProperties(IdSpace currentIdSpace) { var currentManager = this; var flattenedProperties = new Dictionary <string, object>(); while (currentManager != null) { AddProperties(currentManager.Properties, flattenedProperties, currentIdSpace); currentManager = GetParent(currentManager); } return(flattenedProperties); }
// return -1 if no subroot is found since the previous index // idspace.Owner will always be non-null. static int GetIndexOfNextSubtreeRoot(IdSpace idspace, int previousIndex) { for (int i = previousIndex + 1; i <= idspace.MemberCount; i++) { if (object.ReferenceEquals(idspace[i].Parent, idspace.Owner)) { return(i); } } return(-1); }
private static bool CompareChildEquality(Activity currentChild, IdSpace currentIdSpace, Activity originalChild, IdSpace originalIdSpace) { if (currentChild == null && originalChild == null) { return(true); } else if ((currentChild == null && originalChild != null) || (currentChild != null && originalChild == null)) { return(false); } return((currentChild.MemberOf != currentIdSpace || originalChild.MemberOf == originalIdSpace) && (currentChild.MemberOf == currentIdSpace || originalChild.MemberOf != originalIdSpace)); }
static bool CompareVariableEquality(Variable currentVariable, Variable originalVariable) { Fx.Assert(currentVariable != null && originalVariable != null, "Both currentVariable and originalVariable must be non-null."); if (!SignatureEquals(currentVariable, originalVariable)) { return(false); } Fx.Assert(currentVariable.IsPublic == originalVariable.IsPublic, "Mismatched variables"); IdSpace currentIdSpace = currentVariable.IsPublic ? currentVariable.Owner.MemberOf : currentVariable.Owner.ParentOf; IdSpace originalIdSpace = originalVariable.IsPublic ? originalVariable.Owner.MemberOf : originalVariable.Owner.ParentOf; return(CompareChildEquality(currentVariable.Default, currentIdSpace, originalVariable.Default, originalIdSpace)); }
public PrivateIdSpaceMatcher(DynamicUpdateMapBuilder.NestedIdSpaceFinalizer nestedFinalizer, IdSpace originalPrivateIdSpace, IdSpace updatedPrivateIdSpace) { this.privateMap = new DynamicUpdateMap() { IsForImplementation = true, NewDefinitionMemberCount = updatedPrivateIdSpace.MemberCount }; this.nestedFinalizer = nestedFinalizer; this.argumentChangeDetected = false; this.originalPrivateIdSpace = originalPrivateIdSpace; this.updatedPrivateIdSpace = updatedPrivateIdSpace; this.matchedActivities = new Queue <Tuple <Activity, Activity> >(); }
static bool CompareDelegateEquality(ActivityDelegate currentDelegate, ActivityDelegate originalDelegate) { Fx.Assert(currentDelegate != null && originalDelegate != null, "Both currentDelegate and originalDelegate must be non-null."); if (!ListEquals(currentDelegate.RuntimeDelegateArguments, originalDelegate.RuntimeDelegateArguments)) { return(false); } bool isImplementation = currentDelegate.ParentCollectionType == ActivityCollectionType.Implementation; Fx.Assert(originalDelegate.ParentCollectionType == currentDelegate.ParentCollectionType, "Mismatched delegates"); IdSpace currentIdSpace = isImplementation ? currentDelegate.Owner.ParentOf : currentDelegate.Owner.MemberOf; IdSpace originalIdSpace = isImplementation ? originalDelegate.Owner.ParentOf : originalDelegate.Owner.MemberOf; return(CompareChildEquality(currentDelegate.Handler, currentIdSpace, originalDelegate.Handler, originalIdSpace)); }
internal IDictionary <string, object> GetVariables(ICollection <string> variables) { Dictionary <string, object> trackedData = null; System.Activities.ActivityInstance currentInstance = this.Activity.Instance; if (currentInstance != null) { System.Activities.Activity activity = currentInstance.Activity; System.Activities.Activity activity2 = currentInstance.Activity; bool flag = variables.Contains("*"); int num = flag ? ((activity.RuntimeVariables.Count + variables.Count) - 1) : variables.Count; IdSpace memberOf = activity.MemberOf; while (currentInstance != null) { bool wildcard = flag && (activity2 == activity); for (int i = 0; i < activity.RuntimeVariables.Count; i++) { Variable variable = activity.RuntimeVariables[i]; if (this.TrackData(variable.Name, variable.Id, currentInstance, variables, wildcard, ref trackedData) && (trackedData.Count == num)) { return(new ReadOnlyDictionary <string, object>(trackedData, false)); } } bool flag3 = false; while (!flag3) { currentInstance = currentInstance.Parent; if (currentInstance != null) { activity = currentInstance.Activity; flag3 = activity.MemberOf.Equals(memberOf); } else { flag3 = true; } } } } if (trackedData == null) { return(ActivityUtilities.EmptyParameters); } return(new ReadOnlyDictionary <string, object>(trackedData, false)); }
public void Add(string name, object property, IdSpace visibility) { ExecutionProperty property2 = new ExecutionProperty(name, property, visibility); this.properties.Add(name, property2); if (this.lastPropertyName == name) { this.lastProperty = property; } if (property is ExclusiveHandle) { this.exclusiveHandleCount++; this.UpdateChildExclusiveHandleCounts(1); } if (property is IExecutionProperty) { this.AddIExecutionProperty(property2, false); } }
public object GetProperty(string name, IdSpace currentIdSpace) { if ((this.lastPropertyName == name) && ((this.lastPropertyVisibility == null) || (this.lastPropertyVisibility == currentIdSpace))) { return(this.lastProperty); } for (ExecutionPropertyManager manager = this; manager != null; manager = GetParent(manager)) { ExecutionProperty property; if ((manager.properties.TryGetValue(name, out property) && !property.IsRemoved) && (!property.HasRestrictedVisibility || (property.Visibility == currentIdSpace))) { this.lastPropertyName = name; this.lastProperty = property.Property; this.lastPropertyVisibility = property.Visibility; return(this.lastProperty); } } return(null); }
static bool IsReferenceToImportedChild(Activity parent, Activity child) { if (child != null && child.MemberOf != parent.MemberOf) { IdSpace idSpace = parent.MemberOf.Parent; while (idSpace != null) { if (idSpace == child.MemberOf) { return(true); } else { idSpace = idSpace.Parent; } } } return(false); }
// We verify that the count of all IdSpaces is as expected. // We could choose to be looser, and only check the IdSpaces that have children active; // but realistically, if all provided implementation maps don't match, something is probably wrong. // Conversely, we could check the correctness of every environment map, but it doesn't seem worth // doing that much work. If we find a mismatch on the environment of an executing activity, we'll // throw at that point. void ThrowIfInvalid(IdSpace updatedIdSpace) { if (this.IsNoChanges) { // 0 means this is NoChanges map, since every workflow has at least one member return; } if (this.NewDefinitionMemberCount != updatedIdSpace.MemberCount) { throw FxTrace.Exception.AsError(new InstanceUpdateException(SR.InvalidUpdateMap( SR.WrongMemberCount(updatedIdSpace.Owner, updatedIdSpace.MemberCount, this.NewDefinitionMemberCount)))); } foreach (DynamicUpdateMapEntry entry in this.Entries) { if (entry.ImplementationUpdateMap != null) { Activity implementationOwner = updatedIdSpace[entry.NewActivityId]; if (implementationOwner == null) { string expectedId = entry.NewActivityId.ToString(CultureInfo.InvariantCulture); if (updatedIdSpace.Owner != null) { expectedId = updatedIdSpace.Owner.Id + "." + expectedId; } throw FxTrace.Exception.AsError(new InstanceUpdateException(SR.InvalidUpdateMap( SR.ActivityNotFound(expectedId)))); } if (implementationOwner.ParentOf == null) { throw FxTrace.Exception.AsError(new InstanceUpdateException(SR.InvalidUpdateMap( SR.ActivityHasNoImplementation(implementationOwner)))); } entry.ImplementationUpdateMap.ThrowIfInvalid(implementationOwner.ParentOf); } } }
public void UnregisterProperties(ActivityInstance completedInstance, IdSpace currentIdSpace, bool ignoreExceptions) { if (IsOwner(completedInstance)) { RegistrationContext registrationContext = new RegistrationContext(this, currentIdSpace); foreach (ExecutionProperty property in _properties.Values) { // We do a soft removal because we're about to throw away this dictionary // and we don't want to mess up our enumerator property.IsRemoved = true; IPropertyRegistrationCallback registrationCallback = property.Property as IPropertyRegistrationCallback; if (registrationCallback != null) { try { registrationCallback.Unregister(registrationContext); } catch (Exception e) { if (Fx.IsFatal(e) || !ignoreExceptions) { throw; } } } } Fx.Assert(completedInstance == null || completedInstance.GetRawChildren() == null || completedInstance.GetRawChildren().Count == 0, "There must not be any children at this point otherwise our exclusive handle count would be incorrect."); // We still need to clear this list in case any non-serializable // properties were being used in a no persist zone _properties.Clear(); } }
public static bool HasPrivateMemberOtherThanArgumentsChanged(DynamicUpdateMapBuilder.NestedIdSpaceFinalizer nestedFinalizer, Activity currentElement, Activity originalElement, bool isMemberOfUpdatedIdSpace, out DynamicUpdateMap argumentChangesMap) { Fx.Assert(currentElement != null && originalElement != null, "Both activities must be non-null."); argumentChangesMap = null; IdSpace currentPrivateIdSpace = currentElement.ParentOf; IdSpace originalPrivateIdSpace = originalElement.ParentOf; // for the implementation of an activity in the IdSpace being updated--but not anywhere deeper // in the tree--we allow adding, removing or rearranging named private variables. // We don't support matching unnamed private variables, and we don't support declaring new // default variable expressions. (That would would offset the private IdSpace, which will be caught by the subsquent checks.) if ((!isMemberOfUpdatedIdSpace || IsAnyNameless(currentElement.ImplementationVariables) || IsAnyNameless(originalElement.ImplementationVariables)) && !ListEquals(currentElement.ImplementationVariables, originalElement.ImplementationVariables, CompareVariableEquality)) { return(true); } if (currentPrivateIdSpace == null && originalPrivateIdSpace == null) { return(false); } else if ((currentPrivateIdSpace != null && originalPrivateIdSpace == null) || (currentPrivateIdSpace == null && originalPrivateIdSpace != null)) { return(true); } if (!ListEquals <ActivityDelegate>(currentElement.ImplementationDelegates, originalElement.ImplementationDelegates, CompareDelegateEquality)) { return(true); } // compare structural equality of members in the private IdSpaces PrivateIdSpaceMatcher privateIdSpaceMatcher = new PrivateIdSpaceMatcher(nestedFinalizer, originalPrivateIdSpace, currentPrivateIdSpace); return(!privateIdSpaceMatcher.Match(out argumentChangesMap)); }
// targetDefinition argument is optional. private IList <InstanceListNeedingUpdate> GetInstanceListsNeedingUpdate(DynamicUpdateMap updateMap, Activity targetDefinition, List <ActivityInstance> secondaryRootInstances, ref Collection <ActivityBlockingUpdate> updateErrors) { IList <InstanceListNeedingUpdate> instanceListsToUpdate = new List <InstanceListNeedingUpdate>(); if (this.rawDeserializedLists == null) { // This instance doesn't have any active instances (it is complete). return(instanceListsToUpdate); } IdSpace rootIdSpace = null; if (targetDefinition != null) { rootIdSpace = targetDefinition.MemberOf; } for (int i = 0; i < this.rawDeserializedLists.Length; i++) { InstanceList list = this.rawDeserializedLists[i]; QualifiedId oldQualifiedId = new QualifiedId(list.ActivityId); if (updateMap.IsImplementationAsRoot) { int[] oldIdArray = oldQualifiedId.AsIDArray(); if (oldIdArray.Length == 1 && oldIdArray[0] != 1) { throw FxTrace.Exception.AsError(new InstanceUpdateException(SR.InvalidImplementationAsWorkflowRootForRuntimeState)); } } string error; InstanceListNeedingUpdate update; DynamicUpdateMap.UpdatedActivity updatedActivity = updateMap.GetUpdatedActivity(oldQualifiedId, rootIdSpace); if (CanCompensationOrConfirmationHandlerReferenceAddedSymbols(list, updateMap, rootIdSpace, secondaryRootInstances, ref updateErrors)) { update = null; } else if (updatedActivity.MapEntry == null) { if (updatedActivity.IdChanged) { // this newQualifiedId is the new id for those InstanceLists whose IDs shifted by their parents' ID change update = new InstanceListNeedingUpdate { InstanceList = list, NewId = updatedActivity.NewId }; } else { // nothing changed, no map, no mapEntry update = new InstanceListNeedingUpdate { InstanceList = list, NewId = null, }; } } else if (updatedActivity.MapEntry.IsParentRemovedOrBlocked) { update = null; } else if (IsRemovalOrRTUpdateBlockedOrBlockedByUser(updatedActivity, oldQualifiedId, out error)) { string instanceId = null; for (int j = 0; j < list.Count; j++) { ActivityInstance activityInstance = list[j] as ActivityInstance; if (activityInstance != null) { instanceId = activityInstance.Id; break; } } AddBlockingActivity(ref updateErrors, updatedActivity, oldQualifiedId, error, instanceId); update = null; } else if (IsInvalidEnvironmentUpdate(list, updatedActivity, ref updateErrors)) { update = null; } else { // no validation error for this InstanceList // add it to the list of InstanceLists to be updated update = new InstanceListNeedingUpdate { InstanceList = list, NewId = updatedActivity.NewId, UpdateMap = updatedActivity.Map, MapEntry = updatedActivity.MapEntry, NewActivity = updatedActivity.NewActivity }; } if (update != null) { update.OriginalId = list.ActivityId; instanceListsToUpdate.Add(update); } } return(instanceListsToUpdate); }
private static bool CanCompensationOrConfirmationHandlerReferenceAddedSymbols(InstanceList instanceList, DynamicUpdateMap rootUpdateMap, IdSpace rootIdSpace, List <ActivityInstance> secondaryRootInstances, ref Collection <ActivityBlockingUpdate> updateErrors) { for (int j = 0; j < instanceList.Count; j++) { ActivityInstance activityInstance = instanceList[j] as ActivityInstance; if (activityInstance == null || !IsNonDefaultSecondaryRoot(activityInstance, secondaryRootInstances)) { continue; } // here, find out if the given non-default secondary root references an environment to which a symbol is to be added via DU. // we start from a secondary root instead of starting from the enviroment with the already completed owner that was added symbols. // It is becuase for the case of adding symbols to noSymbols activities, the environment doesn't even exist from which we can start looking for referencing secondary root. int[] secondaryRootOriginalQID = new QualifiedId(instanceList.ActivityId).AsIDArray(); Fx.Assert(secondaryRootOriginalQID != null && secondaryRootOriginalQID.Length > 1, "CompensationParticipant is always an implementation child of a CompensableActivity, therefore it's IdSpace must be at least one level deep."); int[] parentOfSecondaryRootOriginalQID = new int[secondaryRootOriginalQID.Length - 1]; Array.Copy(secondaryRootOriginalQID, parentOfSecondaryRootOriginalQID, secondaryRootOriginalQID.Length - 1); List <int> currentQIDBuilder = new List <int>(); for (int i = 0; i < parentOfSecondaryRootOriginalQID.Length; i++) { // // for each iteration of this for-loop, // we are finding out if at every IdSpace level the map has any map entry whose activity has the CompensableActivity as an implementation decendant. // The map may not exist for every IdSpace between the root and the CompensableActivity. // If the matching map and the entry is found, then we find out if that matching entry's activity is a public decendant of any NoSymbols activity DU is to add variables or arguments to. // // This walk on the definition activity tree determines the hypothetical execution-time chain of instances and environments. // The ultimate goal is to prevent adding variables or arguments to a NoSymbols activity which has already completed, // but its decendant CompensableActivity's compensation or confirmation handlers in the future may need to reference the added variables or arguments. currentQIDBuilder.Add(parentOfSecondaryRootOriginalQID[i]); DynamicUpdateMap.UpdatedActivity updatedActivity = rootUpdateMap.GetUpdatedActivity(new QualifiedId(currentQIDBuilder.ToArray()), rootIdSpace); if (updatedActivity.MapEntry != null) { // the activity of this entry either has the CompensableActivity as an implementation decendant, or is the CompensableActivity itself. // walk the same-IdSpace-parent chain of the entry, // look for an entry whose EnvironmentUpdateMap.IsAdditionToNoSymbols is true. DynamicUpdateMapEntry entry = updatedActivity.MapEntry; do { if (!entry.IsRemoval && entry.HasEnvironmentUpdates && entry.EnvironmentUpdateMap.IsAdditionToNoSymbols) { int[] noSymbolAddActivityIDArray = currentQIDBuilder.ToArray(); noSymbolAddActivityIDArray[noSymbolAddActivityIDArray.Length - 1] = entry.OldActivityId; QualifiedId noSymbolAddActivityQID = new QualifiedId(noSymbolAddActivityIDArray); DynamicUpdateMap.UpdatedActivity noSymbolAddUpdatedActivity = rootUpdateMap.GetUpdatedActivity(noSymbolAddActivityQID, rootIdSpace); AddBlockingActivity(ref updateErrors, noSymbolAddUpdatedActivity, noSymbolAddActivityQID, SR.VariableOrArgumentAdditionToReferencedEnvironmentNoDUSupported, null); return(true); } entry = entry.Parent; } while (entry != null); } } } return(false); }
public FamiliarityResponse Execute(IdSpace id) { UriQuery query = GetQuery().Add("id", id); return Execute<FamiliarityResponse>(query.ToString()); }
public UrlsResponse Execute(IdSpace id) { UriQuery query = GetQuery().Add("id", id); return Execute<UrlsResponse>(query.ToString()); }
public void UnregisterProperties(ActivityInstance completedInstance, IdSpace currentIdSpace) { UnregisterProperties(completedInstance, currentIdSpace, false); }
public Task<TermsResponse> ExecuteAsync(IdSpace id, TermsSort sortBy = TermsSort.Frequency) { UriQuery query = GetQuery(sortBy).Add("id", id); return ExecuteAsync<TermsResponse>(query.ToString()); }
private void AddProperties(IDictionary <string, ExecutionProperty> properties, IDictionary <string, object> flattenedProperties, IdSpace currentIdSpace) { foreach (var item in properties) { if (!item.Value.IsRemoved && !flattenedProperties.ContainsKey(item.Key) && (!item.Value.HasRestrictedVisibility || item.Value.Visibility == currentIdSpace)) { flattenedProperties.Add(item.Key, item.Value.Property); } } }
public OBO_Header(List <KeyValuePair <string, string> > data = null) { if (data != null) { foreach (var datum in data) { switch (datum.Key.ToLower()) { case "format-version": FormatVersion = datum.Value; break; case "data-version": DataVersion = datum.Value; break; case "version": Version = datum.Value; break; case "date": Date = datum.Value; break; case "saved-by": SavedBy = datum.Value; break; case "auto-generated-by": AutoGeneratedBy = datum.Value; break; case "import": Import.Add(datum.Value); break; case "subsetdef": SubsetDef.Add(datum.Value); break; case "synonymtypedef": SynonymTypeDef.Add(datum.Value); break; case "default-namespace": DefaultNamespace = datum.Value; break; case "idspace": IdSpace.Add(datum.Value); break; case "default-relationship-id-prefix": DefaultRelationshipIdPrefix.Add(datum.Value); break; case "id-mapping": IdMapping.Add(datum.Value); break; case "remark": Remark.Add(datum.Value); break; default: Other.Add(datum); break; } } } }
public Task<HotttnesssResponse> ExecuteAsync(IdSpace id, HotttnesssType type = HotttnesssType.Overall) { UriQuery query = GetQuery(type).Add("id", id); return ExecuteAsync<HotttnesssResponse>(query.ToString()); }
internal IDictionary <string, object> GetVariables(ICollection <string> variables) { Dictionary <string, object> trackedVariables = null; // delay allocated through TrackData ActivityInstance currentInstance = this.Activity.Instance; if (currentInstance != null) { Activity currentElement = currentInstance.Activity; Activity startActivity = currentInstance.Activity; bool containsWildcard = variables.Contains("*"); //count defines how many items we can get in this lookup. It represents the maximum number of items that can be extracted, //if * is specified, any other names specified are expected to be variables defined in scope, not in the activity itself. //if a variable name in the activity is specified, the lookup continues through the variables in scope. int count = containsWildcard ? currentElement.RuntimeVariables.Count + variables.Count - 1 : variables.Count; IdSpace activityIdSpace = currentElement.MemberOf; while (currentInstance != null) { //* only extracts variables of the current Activity and not variables in scope. bool useWildCard = containsWildcard && startActivity == currentElement; // we only track public Variables, not ImplementationVariables for (int i = 0; i < currentElement.RuntimeVariables.Count; i++) { Variable variable = currentElement.RuntimeVariables[i]; if (TrackData(variable.Name, variable.Id, currentInstance, variables, useWildCard, ref trackedVariables)) { if (trackedVariables.Count == count) { return(new ReadOnlyDictionary <string, object>(trackedVariables)); } } } bool foundNext = false; while (!foundNext) { currentInstance = currentInstance.Parent; if (currentInstance != null) { currentElement = currentInstance.Activity; foundNext = currentElement.MemberOf.Equals(activityIdSpace); } else { // We set foundNext to true to get out of our loop. foundNext = true; } } } } if (trackedVariables == null) { return(ActivityUtilities.EmptyParameters); } else { Fx.Assert(trackedVariables.Count > 0, "we should only allocate the dictionary if we're putting data in it"); return(new ReadOnlyDictionary <string, object>(trackedVariables)); } }
public Task <HotttnesssResponse> ExecuteAsync(IdSpace id, HotttnesssType type = HotttnesssType.Overall) { UriQuery query = GetQuery(type).Add("id", id); return(ExecuteAsync <HotttnesssResponse>(query.ToString())); }
public Task<FamiliarityResponse> ExecuteAsync(IdSpace id) { UriQuery query = GetQuery().Add("id", id); return ExecuteAsync<FamiliarityResponse>(query.ToString()); }
public Task<ProfileResponse> ExecuteAsync(IdSpace id, ArtistBucket? bucket = null) { UriQuery query = GetQuery(bucket).Add("id", id); return ExecuteAsync<ProfileResponse>(query.ToString()); }