internal AllorsPredicateAssociationInExtentSql(AllorsExtentFilteredSql extent, IAssociationType association, Extent inExtent)
 {
     extent.CheckAssociation(association);
     PredicateAssertions.AssertAssociationContainedIn(association, inExtent);
     this.association = association;
     this.inExtent = (AllorsExtentSql) inExtent;
 }
Esempio n. 2
0
        public void SetCompositeRoles(IRelationType relationType, Allors.Extent roles)
        {
            if (roles == null || roles.Count == 0)
            {
                this.RemoveCompositeRoles(relationType);
            }
            else
            {
                this.AssertNotDeleted();

                var newStrategies = new HashSet <Strategy>();
                foreach (IObject role in roles)
                {
                    if (role != null)
                    {
                        this.MemorySession.MemoryDatabase.CompositeRolesChecks(this, relationType.RoleType, role);

                        var roleStrategy = this.MemorySession.GetStrategy(role.Strategy.ObjectId);
                        newStrategies.Add(roleStrategy);
                    }
                }

                if (relationType.AssociationType.IsMany)
                {
                    this.SetCompositeRolesMany2Many(relationType.RoleType, newStrategies);
                }
                else
                {
                    this.SetCompositesRoleOne2Many(relationType.RoleType, newStrategies);
                }
            }
        }
Esempio n. 3
0
 public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
 {
     this.CheckUnarity();
     this.extent.FlushCache();
     this.filter = new RoleContainedInExtent(this.extent, role, containingExtent);
     return(this);
 }
Esempio n. 4
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.CheckUnarity();
     this.predicate = new AssociationContainedInExtent(this.extent, association, containingExtent);
     this.extent.Invalidate();
     return(this);
 }
Esempio n. 5
0
        public virtual Allors.Extent Except(Allors.Extent firstOperand, Allors.Extent secondOperand)
        {
            var firstExtent  = firstOperand as Extent ?? ((ExtentSwitch)firstOperand).Extent;
            var secondExtent = secondOperand as Extent ?? ((ExtentSwitch)secondOperand).Extent;

            return(new ExtentOperation(this, firstExtent, secondExtent, ExtentOperationType.Except));
        }
Esempio n. 6
0
        internal RoleOneContainedInExtent(ExtentFiltered extent, IRoleType roleType, Allors.Extent containingExtent)
        {
            extent.CheckForRoleType(roleType);
            PredicateAssertions.ValidateRoleContainedIn(roleType, containingExtent);

            this.roleType = roleType;
            this.containingExtent = containingExtent;
        }
        internal RoleOneContainedInExtent(ExtentFiltered extent, IRoleType roleType, Allors.Extent containingExtent)
        {
            extent.CheckForRoleType(roleType);
            PredicateAssertions.ValidateRoleContainedIn(roleType, containingExtent);

            this.roleType         = roleType;
            this.containingExtent = containingExtent;
        }
Esempio n. 8
0
 internal void CopyToConnected(Allors.Extent connectedExtent)
 {
     connectedExtent.AddSort(this.roleType, this.direction);
     if (this.subSorter != null)
     {
         this.subSorter.CopyToConnected(connectedExtent);
     }
 }
        public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
        {
            if (role.IsMany)
            {
                this.predicates.Add(new RoleManyContainedInExtent(this.extent, role, containingExtent));
            }
            else
            {
                this.predicates.Add(new RoleOneContainedInExtent(this.extent, role, containingExtent));
            }

            this.extent.Invalidate();
            return(this);
        }
Esempio n. 10
0
        public string Write(Extent extent, CultureInfo cultureInfo, IAccessControlListFactory aclFactory)
        {
            var actualRecordSeparator = this.RecordSeparator ?? Environment.NewLine;
            var actualFieldSeparator = this.FieldSeparator ?? cultureInfo.TextInfo.ListSeparator;

            var stringBuilder = new StringBuilder();
            for (var i = 0; i < this.Columns.Count; i++)
            {
                var column = this.Columns[i];
                stringBuilder.Append("\"");
                stringBuilder.Append(column.Header);
                stringBuilder.Append("\"");

                if (i < this.Columns.Count - 1)
                {
                    stringBuilder.Append(actualFieldSeparator);
                }
            }

            stringBuilder.Append(Environment.NewLine);

            for (var objectCounter = 0; objectCounter < extent.Count; objectCounter++)
            {
                var obj = extent[objectCounter];

                for (var columnCounter = 0; columnCounter < this.Columns.Count; columnCounter++)
                {
                    var column = this.Columns[columnCounter];
                    column.Write(this, cultureInfo, stringBuilder, obj, aclFactory);

                    if (columnCounter < this.Columns.Count - 1)
                    {
                        stringBuilder.Append(actualFieldSeparator);
                    }
                }

                if (objectCounter < extent.Count - 1)
                {
                    stringBuilder.Append(actualRecordSeparator);
                }
            }

            return stringBuilder.ToString();
        }
Esempio n. 11
0
        private void AssertC3(Extent extent, bool assert0, bool assert1, bool assert2, bool assert3)
        {
            if (assert0)
            {
                Assert.IsTrue(extent.Contains(this.c3A), "C3_1");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c3A), "C3_1");
            }

            if (assert1)
            {
                Assert.IsTrue(extent.Contains(this.c3B), "C3_2");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c3B), "C3_2");
            }

            if (assert2)
            {
                Assert.IsTrue(extent.Contains(this.c3C), "C3_3");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c3C), "C3_3");
            }

            if (assert3)
            {
                Assert.IsTrue(extent.Contains(this.c3D), "C3_4");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c3D), "C3_4");
            }
        }
Esempio n. 12
0
        private void AssertC2(Extent extent, bool assert0, bool assert1, bool assert2, bool assert3)
        {
            if (assert0)
            {
                Assert.IsTrue(extent.Contains(this.c2A), "C2_1");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c2A), "C2_1");
            }

            if (assert1)
            {
                Assert.IsTrue(extent.Contains(this.c2B), "C2_2");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c2B), "C2_2");
            }

            if (assert2)
            {
                Assert.IsTrue(extent.Contains(this.c2C), "C2_3");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c2C), "C2_3");
            }

            if (assert3)
            {
                Assert.IsTrue(extent.Contains(this.c2D), "C2_4");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c2D), "C2_4");
            }
        }
Esempio n. 13
0
        private void AssertC1(Extent extent, bool assert0, bool assert1, bool assert2, bool assert3)
        {
            if (assert0)
            {
                Assert.IsTrue(extent.Contains(this.c1A), "C1_1");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c1A), "C1_1");
            }

            if (assert1)
            {
                Assert.IsTrue(extent.Contains(this.c1B), "C1_2");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c1B), "C1_2");
            }

            if (assert2)
            {
                Assert.IsTrue(extent.Contains(this.c1C), "C1_3");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c1C), "C1_3");
            }

            if (assert3)
            {
                Assert.IsTrue(extent.Contains(this.c1D), "C1_4");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c1D), "C1_4");
            }
        }
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.Extent.FlushCache();
     this.Filters.Add(new AssociationContainedInExtent(this.Extent, association, containingExtent));
     return(this);
 }
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Extent{T}"/> class.
 /// </summary>
 /// <param name="extent">
 /// The extent.
 /// </param>
 private Extent(Extent extent) => this.BaseExtent = extent;
 public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
 {
     this.Extent.FlushCache();
     this.Filters.Add(new RoleContainedInExtent(this.Extent, role, containingExtent));
     return(this);
 }
Esempio n. 17
0
 private void Map(Index model, Extent<Organisation> organisations)
 {
     model.Organisations = organisations.Select(x => new Index_Organisation
     {
         Id = x.Id.ToString(),
         Name = x.Name,
         Owner = x.ExistOwner ? x.Owner.UserName : null,
     }).ToArray();
 }
Esempio n. 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExtentDebugView"/> class.
 /// </summary>
 /// <param name="extent">
 /// The extent.
 /// </param>
 public ExtentDebugView(Extent extent)
 {
     this.extent = extent;
 }
Esempio n. 19
0
 public string Write(Extent extent, Domain.Locale locale, IAccessControlListFactory aclFactory)
 {
     return this.Write(extent, new CultureInfo(locale.Name), aclFactory);
 }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Extent{T}"/> class.
 /// </summary>
 /// <param name="extent">
 /// The extent.
 /// </param>
 private Extent(Extent extent)
 {
     this.extent = extent;
 }
Esempio n. 21
0
        private void AssertC4(Extent extent, bool assert0, bool assert1, bool assert2, bool assert3)
        {
            if (assert0)
            {
                Assert.IsTrue(extent.Contains(this.c4A), "C4_1");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c4A), "C4_1");
            }

            if (assert1)
            {
                Assert.IsTrue(extent.Contains(this.c4B), "C4_2");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c4B), "C4_2");
            }

            if (assert2)
            {
                Assert.IsTrue(extent.Contains(this.c4C), "C4_3");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c4C), "C4_3");
            }

            if (assert3)
            {
                Assert.IsTrue(extent.Contains(this.c4D), "C4_4");
            }
            else
            {
                Assert.IsFalse(extent.Contains(this.c4D), "C4_4");
            }
        }
Esempio n. 22
0
 public virtual Allors.Extent Except(Allors.Extent firstOperand, Allors.Extent secondOperand)
 {
     return(new ExtentOperation(((Extent)firstOperand).ContainedInExtent, ((Extent)secondOperand).ContainedInExtent, ExtentOperations.Except));
 }
Esempio n. 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExtentDebugView"/> class.
 /// </summary>
 /// <param name="extent">
 /// The extent.
 /// </param>
 public ExtentDebugView(Extent extent)
 {
     this.extent = extent;
 }
Esempio n. 24
0
        private void GetFilter(IFilter model, out Extent<Organisation> filterOrganisations, out string filterName)
        {
            filterName = model.FilterName;

            filterOrganisations = new Organisations(this.AllorsSession).Extent();
            var filter = filterOrganisations.Filter;
            if (!string.IsNullOrWhiteSpace(filterName))
            {
                filter.AddLike(Organisations.Meta.Name, "%" + filterName + "%");
            }
        }
Esempio n. 25
0
 public ICompositePredicate AddContainedIn(IRoleType role, Extent containingExtent)
 {
     this.CheckUnarity();
     this.extent.FlushCache();
     this.filter = new AllorsPredicateRoleInExtentSql(this.extent, role, containingExtent);
     return this;
 }
Esempio n. 26
0
        public void SetCompositeRoles(IRoleType roleType, Extent roles)
        {
            if (roles == null || roles.Count == 0)
            {
                this.RemoveCompositeRoles(roleType);
                return;
            }

            this.AssertNotDeleted();

            var roleObjectIds = new List<ObjectId>();
            foreach (IObject role in roles)
            {
                if (role != null)
                {
                    RoleAssertions.CompositeRolesChecks(this, roleType, role);
                    roleObjectIds.Add(role.Id);
                }
            }

            switch (roleType.RelationType.Multiplicity)
            {
                case Multiplicity.OneToMany:
                    this.session.SetCompositeRoleOneToMany(this.objectId, roleType, roleObjectIds.ToArray());
                    return;
                case Multiplicity.ManyToMany:
                    this.session.SetCompositeRoleManyToMany(this.objectId, roleType, roleObjectIds.ToArray());
                    return;
                default:
                    throw new Exception("Unsupported multiplicity " + roleType.RelationType.Multiplicity);
            }
        }
Esempio n. 27
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Extent containingExtent)
 {
     this.CheckUnarity();
     this.extent.FlushCache();
     this.filter = new AllorsPredicateAssociationInExtentSql(this.extent, association, containingExtent);
     return this;
 }