Exemple #1
0
        internal virtual void ChangeProperty(int propertyKeyId, Value value)
        {
            if (_addedProperties != null && _addedProperties.containsKey(propertyKeyId))
            {
                _addedProperties.put(propertyKeyId, value);
                return;
            }

            if (_changedProperties == null)
            {
                _changedProperties = CollectionsFactory.newValuesMap();
            }
            _changedProperties.put(propertyKeyId, value);

            if (_removedProperties != null)
            {
                _removedProperties.remove(propertyKeyId);
            }
        }
Exemple #2
0
            internal virtual void RemoveSchemaRule(long id)
            {
                if (ConstraintRuleById.containsKey(id))
                {
                    ConstraintRule rule = ConstraintRuleById.remove(id);
                    ConstraintsConflict.remove(rule.ConstraintDescriptor);
                }
                else if (IndexDescriptorById.containsKey(id))
                {
                    CapableIndexDescriptor index  = IndexDescriptorById.remove(id);
                    SchemaDescriptor       schema = index.Schema();
                    IndexDescriptorsConflict.Remove(schema);
                    IndexDescriptorsByName.Remove(index.Name, index);

                    foreach (int entityTokenId in Schema.EntityTokenIds)
                    {
                        ISet <CapableIndexDescriptor> forLabel = IndexDescriptorsByLabel.get(entityTokenId);

                        /* Previously, a bug made it possible to create fulltext indexes with repeated labels or relationship types
                         * which would cause us to try and remove the same entity token twice which could cause a NPE if the 'forLabel'
                         * set would be empty after the first removal such that the set would be completely removed from 'indexDescriptorsByLabel'.
                         * Fixed as of 3.5.10 */
                        if (forLabel != null)
                        {
                            forLabel.remove(index);
                            if (forLabel.Count == 0)
                            {
                                IndexDescriptorsByLabel.remove(entityTokenId);
                            }
                        }
                    }

                    foreach (int propertyId in index.Schema().PropertyIds)
                    {
                        IList <CapableIndexDescriptor> forProperty = IndexByProperty.get(propertyId);
                        forProperty.Remove(index);
                        if (forProperty.Count == 0)
                        {
                            IndexByProperty.remove(propertyId);
                        }
                    }
                }
            }
Exemple #3
0
 public override bool IsPropertyChangedOrRemoved(int propertyKey)
 {
     return((_removedProperties != null && _removedProperties.contains(propertyKey)) || (_changedProperties != null && _changedProperties.containsKey(propertyKey)));
 }
Exemple #4
0
 internal virtual bool HasConstraintRule(long?constraintRuleId)
 {
     return(constraintRuleId != null && ConstraintRuleById.containsKey(constraintRuleId));
 }