예제 #1
0
        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
            }
                );
        }
예제 #2
0
        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
            }
                );
        }
예제 #3
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public FabricRequest <FabResponse <FabFactor> > Request(CreateFabFactor Data, SessionType UseSessionType = SessionType.Default)
 {
     return(new FabricRequest <FabResponse <FabFactor> >("POST", Uri,
                                                         null,
                                                         "Data=" + Data.ToJson()
                                                         ));
 }
예제 #4
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 private static void FromCreateFabFactorCustom(Factor pDomain, CreateFabFactor pApi)
 {
     if (pApi.Eventor != null)
     {
         FromCreateFabFactorEventor(pDomain, pApi.Eventor);
     }
 }
예제 #5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public static Factor FromCreateFabFactor(CreateFabFactor pApi)
        {
            var dom = new Factor();

            FromCreateFabFactor(dom, pApi);
            return(dom);
        }
예제 #6
0
        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));
        }
예제 #7
0
        /*--------------------------------------------------------------------------------------------*/
        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);
        }
예제 #8
0
        /*--------------------------------------------------------------------------------------------*/
        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);
        }
예제 #9
0
        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>())
                );
        }
예제 #10
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        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;
        }
예제 #11
0
        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>())
                );
        }
예제 #12
0
        /*--------------------------------------------------------------------------------------------*/
        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);
        }
예제 #13
0
        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
                );
        }
예제 #14
0
        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;
        }
예제 #15
0
        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
                );
        }
예제 #16
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        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;
            }
        }
예제 #17
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 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");
     }
 }
예제 #18
0
 /*--------------------------------------------------------------------------------------------*/
 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);
 }
예제 #19
0
        /*--------------------------------------------------------------------------------------------*/
        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);
        }
예제 #20
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public CreateFabFactorValidator(CreateFabFactor pCreateObj) : base(pCreateObj)
 {
     vCreateObj = pCreateObj;
 }
예제 #21
0
 /*--------------------------------------------------------------------------------------------*/
 public FabResponse <FabFactor> Post(CreateFabFactor Data, SessionType UseSessionType = SessionType.Default)
 {
     return(Request(Data).Send(vContext, UseSessionType));
 }