public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputId, IBaseOutput adaptee, IBaseInput target) { ITimeSpaceAdaptedOutput adaptedOutput = adaptedOutputId as ITimeSpaceAdaptedOutput; if (adaptedOutput == null) throw new ArgumentException("Adapted output id does no come from this factory","adaptedOutputId"); return (adaptedOutput); }
public OutputSpace(IIdentifiable identity, IValueDefinition valueDefinition, ISpatialDefinition spatialDefinition, IBaseLinkableComponent component, IValueSetConverter valueSetConverter) : base(identity, valueDefinition, spatialDefinition, component) { _valueSetConverter = valueSetConverter; if (_valueSetConverter != null) _valueSetConverter.ExchangeItem = this; }
public InputSpaceTime(IIdentifiable identity, IValueDefinition valueDefinition, ISpatialDefinition spatialDefinition, IBaseLinkableComponent component, IValueSetConverterTime valueSetConverterTime) : base(identity, valueDefinition, spatialDefinition, component) { _valueSetConverterTime = valueSetConverterTime; if (_valueSetConverterTime != null) _valueSetConverterTime.ExchangeItem = this; }
public BaseExchangeItem(IIdentifiable identity, IBaseLinkableComponent component, IValueDefinition iValueDefinition, IValueSetConverter iValueSetConverter) : base(identity, component, iValueDefinition) { // _componentId = _component != null ? _component.Id : string.Empty; _valueSetConverter = iValueSetConverter; if (_valueSetConverter != null) _valueSetConverter.ExchangeItem = this; }
public void SaveIdentifiable(SaveOrUpdateEvent @event, IIdentifiable identifiable) { var other = @event.Session.Get(@event.Entity.GetType(), identifiable.Id); if (other == null) Default.OnSaveOrUpdate(@event); else { @event.ResultId = identifiable.Id; } }
public Element(IIdentifiable identity, double[] x, double[] y, double[] z, double[] m, int[][] faces) { Identity = identity; X = x; Y = y; Z = z; M = m; Faces = faces; }
public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputId, IBaseOutput adaptee, IBaseInput target) { IBaseAdaptedOutput adaptedOutput = new ElementMapperAdaptedOutput(adaptedOutputId, (ITimeSpaceOutput)adaptee, target.ElementSet()); // Connect adaptor and adaptee if (!adaptee.AdaptedOutputs.Contains(adaptedOutput)) { adaptee.AddAdaptedOutput(adaptedOutput); } return adaptedOutput; }
public override IIdentifiable Clone(IIdentifiable source) { if (!(source is IProxyIdentifiable)) { source = MakeProxy(source); } var clone = base.Clone(source); if (!(clone is IProxyIdentifiable)) { clone = MakeProxy(clone); } return clone; }
public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputIdentifier, IBaseOutput adaptee, IBaseInput target) { IBaseAdaptedOutput adaptor = adaptedOutputIdentifier as IBaseAdaptedOutput; if (adaptor == null) { throw new ArgumentException("Unknown adaptedOutput type - it does not originate from this factory"); } // Connect the adaptor and the adaptee if (!adaptee.AdaptedOutputs.Contains(adaptor)) { adaptee.AddAdaptedOutput(adaptor); } return adaptor; }
/// <summary> /// Only constructor /// </summary> /// <param name="identity">Derived class identity</param> /// <param name="derivedComponentType">Derived class Type</param> /// <param name="engineType">Runtime engine Type</param> /// <param name="useNativeDllArgument">Runtime engine requires location details of native engine DLL</param> public LinkableComponentV1Base(IIdentifiable identity, ExternalType derivedComponentType, ExternalType engineType, bool useNativeDllArgument) : base(identity, derivedComponentType, engineType, useNativeDllArgument) { // Null URI's cause problems so initialise to something wrong var uri = new Uri(@"http://sourceforge.net/projects/fluidearth/"); var omiUri = new ArgumentUri(GetArgumentIdentity(Args.V1Omi), uri); // There is a design error should not have to add valueChanged in two ways here! omiUri.ValueChanged += new EventHandler<ArgumentBase.ValueChangedEventArgs>(omiUri_ValueChanged); Arguments.Add(omiUri); var argValue = Argument(GetArgumentIdentity(Args.V1Omi)).Value as ArgumentValueUri; argValue.ValueChanged += new EventHandler<ArgumentValueBase<Uri>.ValueChangedEventArgs>(OnArgOmiUriValueChanged); }
/// <summary> /// Constructor for native coded IEngine /// </summary> /// <param name="identity">Identity for the component</param> /// <param name="derivedComponentType">Type of derived class encapsulated as an ExternalType</param> /// <param name="engineType">Type of IEngine derived class encapsulated as an ExternalType</param> /// <param name="useNativeDllArgument">True if engineType is actually a .NEt wrapper for /// a native implementation of IEngine, i.e. uses C interface to talk to engine which /// might be in some non .NET language e.g. C++/FORTRAN/Python etc</param> public BaseComponentTimeWithEngine(IIdentifiable identity, ExternalType derivedComponentType, ExternalType engineType, bool useNativeDllArgument) : base(identity, derivedComponentType, engineType, useNativeDllArgument) { _timeExtent = new TimeSet(); _timeExtent.SetTimeHorizon(new Time()); var argTime = new ArgumentTime(GetArgumentIdentity(ArgsWithEngineTime.TimeHorizon), new Time(_timeExtent.TimeHorizon)); argTime.ValueChanged += new EventHandler<Argument<ArgumentValueTime>.ValueChangedEventArgs>(OnArgumentChangedTimeHorizon); Arguments.Add(argTime); // Base class sets typeof(RemotingServerEngineTime) not typeof(RemotingServerEngine) // Dont have a RemotingServerEngine as RemotingServerEngineTime only has one additional time method // which we can jsut ensure not to call! //((ArgumentParametersRemoting)Argument(GetArgumentIdentity(ArgsWithEngine.Remoting))).ParametersRemoting // = new ParametersRemoting(typeof(RemotingServerEngineTime); }
public IdentifiableItemBase(IIdentifiable itemInstance, IComposition composition) { Contract.Requires(itemInstance != null, "itemInstance != null"); Contract.Requires(composition != null, "composition != null"); _composition = composition; _guid = Guid.NewGuid().ToString(); _cachedInstanceId = itemInstance.Id; _cachedInstanceDescribes = new Describes(itemInstance); _cachedCaptionEdited = false; _cachedDescriptionEdited = false; _itemInstance = itemInstance; _xConstructor = Constructor(itemInstance); _xConnectivity = Connectivity(itemInstance); if (itemInstance is IBaseLinkableComponentProposed) _platforms = ((IBaseLinkableComponentProposed)itemInstance).SupportedPlatforms; else if (itemInstance is IBaseExchangeItemProposed) _platforms = ((IBaseExchangeItemProposed)itemInstance).SupportedPlatforms; else _platforms = composition.Platforms; if (itemInstance is IBaseLinkableComponent) _interface = IdentifiableItemType.IBaseLinkableComponent; else if (itemInstance is IBaseAdaptedOutput) _interface = IdentifiableItemType.IBaseAdaptedOutput; else if (itemInstance is IBaseOutput) _interface = IdentifiableItemType.IBaseOutput; else if (itemInstance is IBaseInput) _interface = IdentifiableItemType.IBaseInput; else if (itemInstance is IAdaptedOutputFactory) _interface = IdentifiableItemType.IAdaptedOutputFactory; else _interface = IdentifiableItemType.Unknown; }
public BaseComponentWithEngine(IIdentifiable identity, ExternalType derivedComponentType, ExternalType engineType, bool useNativeDllArgument) : base(identity, true, null, null, null, null) { _derivedComponentType = derivedComponentType; _engineType = engineType; _useNativeDll = useNativeDllArgument; SetArgCaption(); ArgumentsAddRange(new IArgument[] { _argCaption, new ArgumentParametersDiagnosticsEngine(GetArgumentIdentity(ArgsWithEngine.Diagnostics), new ParametersDiagnosticsNative()), new ArgumentParametersRemoting(GetArgumentIdentity(ArgsWithEngine.Remoting), new ParametersRemoting()), }); if (_useNativeDll) Arguments.Add(new ArgumentNativeDll(GetArgumentIdentity(ArgsWithEngine.NativeDll), new ParametersNativeDll())); }
/// <inheritdoc /> public void IncludeRelationshipChain(IReadOnlyCollection <RelationshipAttribute> inclusionChain, IIdentifiable rootResource) { ArgumentGuard.NotNull(inclusionChain, nameof(inclusionChain)); ArgumentGuard.NotNull(rootResource, nameof(rootResource)); // We don't have to build a resource object for the root resource because // this one is already encoded in the documents primary data, so we process the chain // starting from the first related resource. RelationshipAttribute relationship = inclusionChain.First(); IList <RelationshipAttribute> chainRemainder = ShiftChain(inclusionChain); object related = relationship.GetValue(rootResource); ProcessChain(related, chainRemainder); }
public static object GetResourceTypedId(IIdentifiable resource) { PropertyInfo property = resource.GetType().GetProperty(nameof(Identifiable.Id)); return(property.GetValue(resource)); }
/// <summary> /// Builds the values of the relationships object on a resource object. /// The server serializer only populates the "data" member when the relationship is included, /// and adds links unless these are turned off. This means that if a relationship is not included /// and links are turned off, the entry would be completely empty, ie { }, which is not conform /// JSON:API spec. In that case we return null which will omit the entry from the output. /// </summary> protected override RelationshipEntry GetRelationshipData(RelationshipAttribute relationship, IIdentifiable resource) { if (relationship == null) { throw new ArgumentNullException(nameof(relationship)); } if (resource == null) { throw new ArgumentNullException(nameof(resource)); } RelationshipEntry relationshipEntry = null; List <IReadOnlyCollection <RelationshipAttribute> > relationshipChains = null; if (Equals(relationship, _requestRelationship) || ShouldInclude(relationship, out relationshipChains)) { relationshipEntry = base.GetRelationshipData(relationship, resource); if (relationshipChains != null && relationshipEntry.HasResource) { foreach (var chain in relationshipChains) { // traverses (recursively) and extracts all (nested) related resources for the current inclusion chain. _includedBuilder.IncludeRelationshipChain(chain, resource); } } } if (!IsRelationshipInSparseFieldSet(relationship)) { return(null); } var links = _linkBuilder.GetRelationshipLinks(relationship, resource); if (links != null) { // if relationshipLinks should be built for this entry, populate the "links" field. relationshipEntry ??= new RelationshipEntry(); relationshipEntry.Links = links; } // if neither "links" nor "data" was populated, return null, which will omit this entry from the output. // (see the NullValueHandling settings on <see cref="ResourceObject"/>) return(relationshipEntry); }
/// <summary> /// This method is called each time an <paramref name="entity"/> is constructed /// from the serialized content, which is used to do additional processing /// depending on the type of deserializers. /// </summary> /// <remarks> /// See the implementation of this method in <see cref="ResponseDeserializer"/> /// and <see cref="RequestDeserializer"/> for examples. /// </remarks> /// <param name="entity">The entity that was constructed from the document's body</param> /// <param name="field">The metadata for the exposed field</param> /// <param name="data">Relationship data for <paramref name="entity"/>. Is null when <paramref name="field"/> is not a <see cref="RelationshipAttribute"/></param> protected abstract void AfterProcessField(IIdentifiable entity, IResourceField field, RelationshipEntry data = null);
public bool Equals(IIdentifiable<IWavRecorder> other) { return EqualsTemplate.Equals(this, other); }
protected Negotiator CreateSuccessfulPostResponse(IIdentifiable model, HttpStatusCode statusCode = HttpStatusCode.Created) { return(CreateSuccessfulPostResponse(model.Identifier, model, statusCode)); }
private FeedbackItem CreateFeedbackInstanceFromFormInput(IIdentifiable currentEntry) { var feedbackItem = new FeedbackItem(FeedbackType.Comment) {Author = tbName.Text}; if(tbEmail != null) { feedbackItem.Email = tbEmail.Text; } feedbackItem.SourceUrl = tbUrl.Text.EnsureUrl(); feedbackItem.Body = tbComment.Text; feedbackItem.Title = tbTitle.Text; feedbackItem.EntryId = currentEntry.Id; feedbackItem.IpAddress = HttpHelper.GetUserIpAddress(SubtextContext.HttpContext); feedbackItem.IsBlogAuthor = SecurityHelper.IsAdmin; return feedbackItem; }
public OutputSpaceTimeComponent1(IIdentifiable identity, IBaseLinkableComponent component, IValueDefinition iValueDefinition, ISpatialDefinition iSpatialDefinition, string engineVariable, Vector3d<double> missingValue, int elementCount) : base(identity, iValueDefinition, iSpatialDefinition, component, new ValueSetConverterTimeEngineDoubleVector3dStandard1(engineVariable, missingValue, elementCount)) { }
public static ElementType GetToElementType(IIdentifiable identifiable) { return(FindSMethod(identifiable).ToElementsShapeType); }
public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputId, IBaseOutput adaptee, IBaseInput target) { return(CreateAdaptedOutputMethod(adaptedOutputId, adaptee, target)); }
public static ElementMapperMethod GetMethod(IIdentifiable identifiable) { return(FindSMethod(identifiable).ElementMapperMethod); }
public static void ParseCachedComponent( IBaseLinkableComponent component, XElement xCachedComponent, IDocumentAccessor accessor, out IIdentifiable identity, out IEnumerable<IArgument> arguments, out IEnumerable<IBaseInput> inputs, out IEnumerable<IBaseOutput> outputs) { ValidElement(xCachedComponent, "Cache"); identity = Persistence.Identity.Parse( xCachedComponent.Element(Persistence.Identity.XName), accessor); arguments = Persistence.Arguments.Parse(xCachedComponent, accessor); inputs = xCachedComponent .Elements("IBaseInput") .Select(e => Persistence.Parse<IBaseInput>("IBaseInput", e, accessor)); outputs = xCachedComponent .Elements("IBaseOutput") .Select(e => Persistence.Parse<IBaseOutput>("IBaseOutput", e, accessor)); }
public override int GetElementIndex(IIdentifiable elementId) { return Elements.FindIndex(i => i.Identity.Id == elementId.Id); }
/// <summary> /// Processes an <see cref="IIdentifiable"/> instance that is a member of an object. /// </summary> /// <param name="identifiable">The identifiable instance to process.</param> /// <param name="member">The member node referencing the identifiable instance.</param> protected abstract void ProcessIdentifiableMembers([NotNull] IIdentifiable identifiable, IMemberNode member);
private IIdentifiable MakeProxy(IIdentifiable source) { var proxy = IdentifiableProxyBuilder.CreateProxy(source.GetType(), Repository); Copy(source, proxy); return proxy; }
public string BaseDirectory(IIdentifiable idf) => Path.Combine(Environment.CurrentDirectory, idf.Id.ToString());
public static async Task <IEnumerable <TItem> > For <TItem>(this IRepository <TItem> repo, IIdentifiable relation) where TItem : IIdentifiable, IRelatable { // All() --> Badness! var items = await repo.All().ConfigureAwait(false); return(items.Where(item => item.RelationId == relation.Id)); }
public int GetElementIndex(IIdentifiable elementId) { throw new NotImplementedException(); }
/// <inheritdoc /> public RelationshipLinks GetRelationshipLinks(RelationshipAttribute relationship, IIdentifiable parent) { if (relationship == null) { throw new ArgumentNullException(nameof(relationship)); } if (parent == null) { throw new ArgumentNullException(nameof(parent)); } var parentResourceContext = _provider.GetResourceContext(parent.GetType()); var childNavigation = relationship.PublicName; RelationshipLinks links = null; if (ShouldAddRelationshipLink(parentResourceContext, relationship, LinkTypes.Related)) { links = new RelationshipLinks { Related = GetRelatedRelationshipLink(parentResourceContext.PublicName, parent.StringId, childNavigation) }; } if (ShouldAddRelationshipLink(parentResourceContext, relationship, LinkTypes.Self)) { links ??= new RelationshipLinks(); links.Self = GetSelfRelationshipLink(parentResourceContext.PublicName, parent.StringId, childNavigation); } return(links); }
private void AddRelationships(DocumentData data, ContextEntity contextEntity, IIdentifiable entity) { data.Relationships = new Dictionary <string, RelationshipData>(); var linkBuilder = new LinkBuilder(_jsonApiContext); contextEntity.Relationships.ForEach(r => { var relationshipData = new RelationshipData { Links = new Links { Self = linkBuilder.GetSelfRelationLink(contextEntity.EntityName, entity.StringId, r.PublicRelationshipName), Related = linkBuilder.GetRelatedRelationLink(contextEntity.EntityName, entity.StringId, r.PublicRelationshipName) } }; if (RelationshipIsIncluded(r.PublicRelationshipName)) { var navigationEntity = _jsonApiContext.ContextGraph .GetRelationship(entity, r.InternalRelationshipName); if (navigationEntity == null) { relationshipData.SingleData = null; } else if (navigationEntity is IEnumerable) { relationshipData.ManyData = GetRelationships((IEnumerable <object>)navigationEntity); } else { relationshipData.SingleData = GetRelationship(navigationEntity); } } data.Relationships.Add(r.PublicRelationshipName, relationshipData); }); }
/// <summary> /// Copy entity identifier used for correlation with MergeChanges from another entity /// </summary> /// <param name="other">Other trackable object</param> public void SetEntityIdentifier(IIdentifiable other) { EntityIdentifier = other.EntityIdentifier; }
/// <summary> /// This method is called each time a <paramref name="resource"/> is constructed /// from the serialized content, which is used to do additional processing /// depending on the type of deserializer. /// </summary> /// <remarks> /// See the implementation of this method in <see cref="ResponseDeserializer"/> /// and <see cref="RequestDeserializer"/> for examples. /// </remarks> /// <param name="resource">The resource that was constructed from the document's body.</param> /// <param name="field">The metadata for the exposed field.</param> /// <param name="data">Relationship data for <paramref name="resource"/>. Is null when <paramref name="field"/> is not a <see cref="RelationshipAttribute"/>.</param> protected abstract void AfterProcessField(IIdentifiable resource, ResourceFieldAttribute field, RelationshipEntry data = null);
bool IEquatable <IIdentifiable> .Equals(IIdentifiable other) { return(IsEquatable(other)); }
// Public Methods (9) /// <summary> /// /// </summary> /// <see cref="IEquatable{T}.Equals(T)" /> public bool Equals(IIdentifiable other) { return(other != null?this.Equals(other.Id) : false); }
/// <inheritdoc /> public async void ShowAnimation(IIdentifiable animatingObj, byte animation, IIdentifiable targetObj, Direction direction) { await this.InvokeAsync(animatingObj.Id, animation, targetObj?.Id, direction); }
public bool Equals(IIdentifiable <IWavPlayer> other) { return(EqualsTemplate.Equals(this, other)); }
public bool Equals(IIdentifiable<IVoIPTransport> other) { return EqualsTemplate.Equals(this, other); }
/// <summary> /// We only need an empty relationship object entry here. It will be populated in the ProcessRelationships method. /// </summary> protected override RelationshipEntry GetRelationshipData(RelationshipAttribute relationship, IIdentifiable resource) { ArgumentGuard.NotNull(relationship, nameof(relationship)); ArgumentGuard.NotNull(resource, nameof(resource)); return(new RelationshipEntry { Links = _linkBuilder.GetRelationshipLinks(relationship, resource) }); }
private static void BindPostCategories(RepeaterItemEventArgs e, IIdentifiable entry) { var postCategories = (PostCategoryList)e.Item.FindControl("Categories"); if(postCategories != null) { postCategories.LinkCategories = Links.GetLinkCategoriesByPostId(entry.Id); postCategories.DataBind(); } }
public ResourceObject GetData(ContextEntity contextEntity, IIdentifiable entity) { return(GetData(contextEntity, entity, null)); }
public string SettingsDirectory(IIdentifiable idf) => Path.Combine(BaseDirectory(idf), "Config");
/// <summary> /// Processes an <see cref="IIdentifiable"/> instance that is an item of a collection. /// </summary> /// <param name="identifiable">The identifiable instance to process.</param> /// <param name="collection">The object node representing the collection referencing the identifiable instance.</param> /// <param name="index">The index at which the identifiable instance is referenced.</param> protected abstract void ProcessIdentifiableItems([NotNull] IIdentifiable identifiable, IObjectNode collection, NodeIndex index);
public void CopyProperties(IIdentifiable other) { this.Id = other.Id; }
public string SavesDirectory(IIdentifiable idf) => Path.Combine(BaseDirectory(idf), "Saves");
protected LinkableComponentOpenMIV1Wrapper(IIdentifiable identity, ExternalType derivedComponentType, ExternalType engineType, bool useNativeDllArgument) : base(identity, derivedComponentType, engineType, useNativeDllArgument) { }
private static string identifierOf(object thing) { IIdentifiable identifiable = thing as IIdentifiable; return((identifiable == null) ? thing.GetType().Name : identifiable.Identifier); }
public override int GetElementIndex(IIdentifiable elementId) { return Ids .Select((v, n) => new {Id = v.Id, Index = n}) .First(t => t.Id == elementId.Id).Index; }
public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputId, IBaseOutput adaptee, IBaseInput target) { // TODO: Some usefull criteria here if (true) { // If a MultiInputAdaptor already exists for the target, get that one, otherwise create a new. MultiInputAdaptor multiInputAdaptor; if (!ExistingMultiInputAdaptors.TryGetValue(target, out multiInputAdaptor)) { multiInputAdaptor = new MultiInputAdaptor("SomeId") { SpatialDefinition = ((ITimeSpaceInput)target).SpatialDefinition }; multiInputAdaptor.AddConsumer(target); ExistingMultiInputAdaptors.Add(target, multiInputAdaptor); } if (adaptedOutputId == _identityAdaptor) { // Identity adaptor IBaseAdaptedOutput adaptedOutput = multiInputAdaptor.CreateChildAdaptor(adaptee); return (adaptedOutput); } else { // ElementMapping adaptor IBaseAdaptedOutput adaptedOutput = _spatialAdaptorFactory.CreateAdaptedOutput(adaptedOutputId, adaptee, target); if (adaptedOutput != null) { multiInputAdaptor.Adaptees.Add((ITimeSpaceOutputAdder) adaptedOutput); return (adaptedOutput); } } } return (null); }
public void LogUpdate(IIdentifiable entity) { }
private List <DocumentData> AppendIncludedObject(List <DocumentData> includedObject, ContextEntity contextEntity, IIdentifiable entity) { var includedEntities = GetIncludedEntities(contextEntity, entity); if (includedEntities.Count > 0) { if (includedObject == null) { includedObject = new List <DocumentData>(); } includedObject.AddRange(includedEntities); } return(includedObject); }
public LinkableComponentTimeWithEngine(IIdentifiable identity, ExternalType derivedComponentType, ExternalType engineType, bool useNativeDllArgument) : base(identity, derivedComponentType, engineType, useNativeDllArgument) { }
protected DataGridRowModelBase(IIdentifiable record) { Id = record.Id; }
public ValidationBase(IIdentifiable identity) : base(identity) { }
public BaseComponentWithEngine(IIdentifiable identity, ExternalType derivedComponentType, ExternalType engineType) : this(identity, derivedComponentType, engineType, false) { }
public void LogDelete(IIdentifiable entity) { }
protected Resource(string name, IIdentifiable<string> attachedObject) { Name = name; Object = attachedObject; }
public void LogInsert(IIdentifiable entity) { }