public void AddFactorCreatedByMember() { var dom = new Factor { Timestamp = 32462346, DescriptorType = (byte)DescriptorType.Id.BelongsTo }; var cre = new CreateFabFactor { CreatedByMemberId = 452346234, UsesPrimaryArtifactId = 3462346, UsesRelatedArtifactId = 6532754 }; TestAddEdge( x => vTasks.AddFactorCreatedByMember(x, dom, cre, GetAddVertexAlias <Factor>()), cre.CreatedByMemberId, DbName.Edge.FactorCreatedByMemberName, DbName.Edge.MemberCreatesFactorName, new[] { DbName.Edge.MemberCreatesFactor.Timestamp, DbName.Edge.MemberCreatesFactor.DescriptorType, DbName.Edge.MemberCreatesFactor.PrimaryArtifactId, DbName.Edge.MemberCreatesFactor.RelatedArtifactId }, new object[] { dom.Timestamp, dom.DescriptorType, cre.UsesPrimaryArtifactId, cre.UsesRelatedArtifactId } ); }
public void AddFactorUsesRelatedArtifact() { var dom = new Factor { Timestamp = 94394393349, DescriptorType = (byte)DescriptorType.Id.IsCreatedBy }; var cre = new CreateFabFactor { UsesRelatedArtifactId = 36236234, UsesPrimaryArtifactId = 1236234623 }; TestAddEdge( x => vTasks.AddFactorUsesRelatedArtifact(x, dom, cre, GetAddVertexAlias <Factor>()), cre.UsesRelatedArtifactId, DbName.Edge.FactorUsesRelatedArtifactName, DbName.Edge.ArtifactUsedAsRelatedByFactorName, new[] { DbName.Edge.ArtifactUsedAsRelatedByFactor.Timestamp, DbName.Edge.ArtifactUsedAsRelatedByFactor.DescriptorType, DbName.Edge.ArtifactUsedAsRelatedByFactor.PrimaryArtifactId }, new object[] { dom.Timestamp, dom.DescriptorType, cre.UsesPrimaryArtifactId } ); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public FabricRequest <FabResponse <FabFactor> > Request(CreateFabFactor Data, SessionType UseSessionType = SessionType.Default) { return(new FabricRequest <FabResponse <FabFactor> >("POST", Uri, null, "Data=" + Data.ToJson() )); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private static void FromCreateFabFactorCustom(Factor pDomain, CreateFabFactor pApi) { if (pApi.Eventor != null) { FromCreateFabFactorEventor(pDomain, pApi.Eventor); } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public static Factor FromCreateFabFactor(CreateFabFactor pApi) { var dom = new Factor(); FromCreateFabFactor(dom, pApi); return(dom); }
public void FactorAfterSessionStart(long pPrimArtId, long pRelArtId, bool pError) { var cre = new CreateFabFactor(); cre.UsesPrimaryArtifactId = pPrimArtId; cre.UsesRelatedArtifactId = pRelArtId; TestUtil.CheckThrows <FabPropertyValueFault>(pError, () => CreateOperationsCustom.FactorAfterSessionStart(null, null, null, cre)); }
/*--------------------------------------------------------------------------------------------*/ public virtual void AddFactorVectorUsesAxisArtifact(ICreateOperationBuilder pCreCtx, Factor pNewDom, CreateFabFactor pNewCre, IWeaverVarAlias <Factor> pAlias) { if (pNewCre.Vector == null) { return; } var a = AddEdge <Factor, FactorVectorUsesAxisArtifact, Artifact>( pCreCtx, pAlias, pNewCre.Vector.UsesAxisArtifactId); }
/*--------------------------------------------------------------------------------------------*/ public virtual void AddFactorUsesRelatedArtifact(ICreateOperationBuilder pCreCtx, Factor pNewDom, CreateFabFactor pNewCre, IWeaverVarAlias <Factor> pAlias) { var a = AddEdge <Factor, FactorUsesRelatedArtifact, Artifact>( pCreCtx, pAlias, pNewCre.UsesRelatedArtifactId); var arbfEdge = new ArtifactUsedAsRelatedByFactor(); arbfEdge.Timestamp = pNewDom.Timestamp; arbfEdge.DescriptorType = pNewDom.DescriptorType; arbfEdge.PrimaryArtifactId = pNewCre.UsesPrimaryArtifactId; AddReverseEdge(pCreCtx, a, arbfEdge, pAlias); }
public void AddFactorVectorUsesAxisArtifactNull(bool pType) { var dom = new Factor(); var cre = new CreateFabFactor(); if (pType) { cre.Vector = new CreateFabVector(); } TestAddEdgeNull( x => vTasks.AddFactorVectorUsesAxisArtifact(x, dom, cre, GetAddVertexAlias <Factor>()) ); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ protected override void TestSetUp() { base.TestSetUp(); vCreateFactor = new CreateFabFactor(); vCreateFactor.AssertionType = (byte)FactorAssertion.Id.Opinion; vCreateFactor.IsDefining = true; vCreateFactor.Note = "My Note"; vCreateFactor.UsesPrimaryArtifactId = (long)SetupUserId.Zach; vCreateFactor.UsesRelatedArtifactId = (long)SetupClassId.Art; vCreateFactor.Descriptor = new CreateFabDescriptor(); vCreateFactor.Descriptor.Type = (byte)DescriptorType.Id.IsAnInstanceOf; vCreateFactor.Descriptor.RefinesPrimaryWithArtifactId = (long)SetupClassId.Attendance; vCreateFactor.Descriptor.RefinesRelatedWithArtifactId = (long)SetupClassId.Digital; vCreateFactor.Descriptor.RefinesTypeWithArtifactId = (long)SetupClassId.Evolution; vCreateFactor.Director = new CreateFabDirector(); vCreateFactor.Director.Type = (byte)DirectorType.Id.DefinedPath; vCreateFactor.Director.PrimaryAction = (byte)DirectorAction.Id.Learn; vCreateFactor.Director.RelatedAction = (byte)DirectorAction.Id.Read; vCreateFactor.Eventor = new CreateFabEventor(); vCreateFactor.Eventor.Type = (byte)EventorType.Id.Occur; vCreateFactor.Eventor.Year = 2000; vCreateFactor.Eventor.Month = 11; vCreateFactor.Eventor.Day = 29; vCreateFactor.Eventor.Hour = 11; vCreateFactor.Eventor.Minute = 51; vCreateFactor.Eventor.Second = 52; vCreateFactor.Identor = new CreateFabIdentor(); vCreateFactor.Identor.Type = (byte)IdentorType.Id.Key; vCreateFactor.Identor.Value = "MyIdentorVal"; vCreateFactor.Locator = new CreateFabLocator(); vCreateFactor.Locator.Type = (byte)LocatorType.Id.EarthCoord; vCreateFactor.Locator.ValueX = 1.234; vCreateFactor.Locator.ValueY = 12.3456; vCreateFactor.Locator.ValueZ = 123.4567; vCreateFactor.Vector = new CreateFabVector(); vCreateFactor.Vector.Type = (byte)VectorType.Id.FullLong; vCreateFactor.Vector.Unit = (byte)VectorUnit.Id.Metre; vCreateFactor.Vector.UnitPrefix = (byte)VectorUnitPrefix.Id.Kilo; vCreateFactor.Vector.Value = 21464; vCreateFactor.Vector.UsesAxisArtifactId = (long)SetupClassId.Excitement; }
public void AddFactorDescriptorRefinesTypeWithArtifactNull(bool pType) { var dom = new Factor(); var cre = new CreateFabFactor(); if (pType) { cre.Descriptor = new CreateFabDescriptor(); } TestAddEdgeNull( x => vTasks.AddFactorDescriptorRefinesTypeWithArtifact( x, dom, cre, GetAddVertexAlias <Factor>()) ); }
/*--------------------------------------------------------------------------------------------*/ public virtual void AddFactorCreatedByMember(ICreateOperationBuilder pCreCtx, Factor pNewDom, CreateFabFactor pNewCre, IWeaverVarAlias <Factor> pAlias) { var a = AddEdge <Factor, FactorCreatedByMember, Member>( pCreCtx, pAlias, pNewCre.CreatedByMemberId); var mcfEdge = new MemberCreatesFactor(); mcfEdge.Timestamp = pNewDom.Timestamp; mcfEdge.DescriptorType = pNewDom.DescriptorType; mcfEdge.PrimaryArtifactId = pNewCre.UsesPrimaryArtifactId; mcfEdge.RelatedArtifactId = pNewCre.UsesRelatedArtifactId; AddReverseEdge(pCreCtx, a, mcfEdge, pAlias); }
public void AddFactorVectorUsesAxisArtifact() { const long toVertId = 3465234643; var dom = new Factor(); var cre = new CreateFabFactor { Vector = new CreateFabVector { UsesAxisArtifactId = toVertId } }; TestAddEdgeSingle( x => vTasks.AddFactorVectorUsesAxisArtifact(x, dom, cre, GetAddVertexAlias <Factor>()), toVertId, DbName.Edge.FactorVectorUsesAxisArtifactName ); }
public void Factor() { var obj = new CreateFabFactor(); obj.UsesPrimaryArtifactId = (long)SetupClassId.Blue; obj.UsesRelatedArtifactId = (long)SetupClassId.Beauty; obj.AssertionType = (byte)FactorAssertion.Id.Guess; obj.Descriptor = new CreateFabDescriptor(); obj.Descriptor.Type = (byte)DescriptorType.Id.BelongsTo; BrowserResponse br = PostCreate("mod/factors", obj); FabFactor result = AssertFabResponseData <FabFactor>(br); Assert.AreEqual(obj.AssertionType, result.AssertionType, "Incorrect result."); NewVertexCount = 1; NewEdgeCount = 6; }
public void AddFactorDescriptorRefinesTypeWithArtifact() { const long toVertId = 3465234643; var dom = new Factor(); var cre = new CreateFabFactor { Descriptor = new CreateFabDescriptor { RefinesTypeWithArtifactId = toVertId } }; TestAddEdgeSingle( x => vTasks.AddFactorDescriptorRefinesTypeWithArtifact( x, dom, cre, GetAddVertexAlias <Factor>()), toVertId, DbName.Edge.FactorDescriptorRefinesTypeWithArtifactName ); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void VerifyAuthAndSetCreator() { if (vOpCtx.Auth.ActiveMemberId == null) { throw new FabPreventedFault(FabFault.Code.AuthorizationRequired, "Authorization is required to create new items."); } CreateFabArtifact art = (NewCre as CreateFabArtifact); CreateFabFactor fac = (NewCre as CreateFabFactor); if (art != null) { art.CreatedByMemberId = (long)vOpCtx.Auth.ActiveMemberId; } if (fac != null) { fac.CreatedByMemberId = (long)vOpCtx.Auth.ActiveMemberId; } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public static void FactorAfterSessionStart(CreateOperationTasks pTasks, ICreateOperationBuilder pBuild, Factor pNewDom, CreateFabFactor pNewCre) { if (pNewCre.UsesPrimaryArtifactId == pNewCre.UsesRelatedArtifactId) { throw new FabPropertyValueFault("RelatedArtifactId", pNewCre.UsesRelatedArtifactId + "", "Cannot be equal to PrimaryArtifactId"); } }
/*--------------------------------------------------------------------------------------------*/ private static void FromCreateFabFactor(Factor pDomain, CreateFabFactor pApi) { FromCreateFabVertex(pDomain, pApi); pDomain.AssertionType = pApi.AssertionType; pDomain.IsDefining = pApi.IsDefining; pDomain.Note = pApi.Note; if (pApi.Descriptor != null) { pDomain.DescriptorType = pApi.Descriptor.Type; } if (pApi.Director != null) { pDomain.DirectorType = pApi.Director.Type; } if (pApi.Director != null) { pDomain.DirectorPrimaryAction = pApi.Director.PrimaryAction; } if (pApi.Director != null) { pDomain.DirectorRelatedAction = pApi.Director.RelatedAction; } if (pApi.Eventor != null) { pDomain.EventorType = pApi.Eventor.Type; } //Custom: Set Domain.EventorDateTime using Api.Year/Month/etc. //pDomain.EventorDateTime <== pApi.Eventor.EventorDateTime (requires custom) //Custom: //pDomain.EventorDateTime <== pApi.Eventor.EventorDateTime (requires custom) //Custom: //pDomain.EventorDateTime <== pApi.Eventor.EventorDateTime (requires custom) //Custom: //pDomain.EventorDateTime <== pApi.Eventor.EventorDateTime (requires custom) //Custom: //pDomain.EventorDateTime <== pApi.Eventor.EventorDateTime (requires custom) //Custom: //pDomain.EventorDateTime <== pApi.Eventor.EventorDateTime (requires custom) if (pApi.Identor != null) { pDomain.IdentorType = pApi.Identor.Type; } if (pApi.Identor != null) { pDomain.IdentorValue = pApi.Identor.Value; } if (pApi.Locator != null) { pDomain.LocatorType = pApi.Locator.Type; } if (pApi.Locator != null) { pDomain.LocatorValueX = pApi.Locator.ValueX; } if (pApi.Locator != null) { pDomain.LocatorValueY = pApi.Locator.ValueY; } if (pApi.Locator != null) { pDomain.LocatorValueZ = pApi.Locator.ValueZ; } if (pApi.Vector != null) { pDomain.VectorType = pApi.Vector.Type; } if (pApi.Vector != null) { pDomain.VectorUnit = pApi.Vector.Unit; } if (pApi.Vector != null) { pDomain.VectorUnitPrefix = pApi.Vector.UnitPrefix; } if (pApi.Vector != null) { pDomain.VectorValue = pApi.Vector.Value; } FromCreateFabFactorCustom(pDomain, pApi); }
/*--------------------------------------------------------------------------------------------*/ public virtual void AddFactorDescriptorRefinesTypeWithArtifact(ICreateOperationBuilder pCreCtx, Factor pNewDom, CreateFabFactor pNewCre, IWeaverVarAlias <Factor> pAlias) { if (pNewCre.Descriptor == null) { return; } var a = AddEdge <Factor, FactorDescriptorRefinesTypeWithArtifact, Artifact>( pCreCtx, pAlias, pNewCre.Descriptor.RefinesTypeWithArtifactId); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public CreateFabFactorValidator(CreateFabFactor pCreateObj) : base(pCreateObj) { vCreateObj = pCreateObj; }
/*--------------------------------------------------------------------------------------------*/ public FabResponse <FabFactor> Post(CreateFabFactor Data, SessionType UseSessionType = SessionType.Default) { return(Request(Data).Send(vContext, UseSessionType)); }