示例#1
0
        //public void Load(Guid metadataId, string name, string value)
        //{
        //    Load(metadataId, null, name, value);
        //}

        //public void Load(Guid metadataId, INode node, string name, string value)
        //{
        //    Load(metadataId, node, null, name, value);
        //}

        public IMetadataSet Load(ServerObjects.Metadata serviceMetadata, INode node)
        {
            IMetadataSet metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(serviceMetadata, node, Parent);

            Metadata.Add(metadataSet);

            IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager;

            if (metadataSetManager != null)
            {
                metadataSetManager.Container = this;
            }

            return(metadataSet);
        }
示例#2
0
        public static MetadataSetFactory GetInstance(IMapManager mapManager)
        {
            lock (padlock)
            {
                if (instances == null)
                {
                    instances = new Dictionary <IMapManager, MetadataSetFactory>();
                }

                if (!instances.ContainsKey(mapManager))
                {
                    instances[mapManager] = new MetadataSetFactory(mapManager);
                }

                return(instances[mapManager]);
            }
        }
示例#3
0
        public static MetadataSetFactory GetInstance(IMapManager mapManager)
        {
            lock (padlock)
            {
                if (instances == null)
                {
                    instances = new Dictionary<IMapManager, MetadataSetFactory>();
                }

                if (!instances.ContainsKey(mapManager))
                {
                    instances[mapManager] = new MetadataSetFactory(mapManager);
                }

                return instances[mapManager];
            }
        }
示例#4
0
        public IMetadataSet Load(ServerObjects.Metadata serviceMetadata, IRelationship relationship)
        {
            IMetadataSet metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(serviceMetadata, Parent, relationship);

            if (!ContainedMetadata.Contains(metadataSet.Id))
            {
                Metadata.Add(metadataSet);
                ContainedMetadata.Add(metadataSet.Id);
            }

            IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager;

            if (metadataSetManager != null)
            {
                metadataSetManager.Container = this;
            }

            return(metadataSet);
        }
示例#5
0
        public IMetadataSet Add(IRelationship relationship, ConnectionType connectionType, string name, string value, ref TransactionChain chain)
        {
            IMetadataSet metadataSet = null;

            if (connectionType != null && relationship != null)
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name && metadata.Relationship.Id == relationship.Id && metadata.ConnectionType.Id == connectionType.Id)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }
            else if (connectionType == null && relationship != null)
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name && metadata.Relationship.Id == relationship.Id)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }
            else
            {
                foreach (IMetadataSet metadata in Metadata)
                {
                    if (metadata.Name == name)
                    {
                        metadataSet = metadata;
                        break;
                    }
                }
            }

            if (metadataSet != null)
            {
                //TransactionFramework.UpdateMetadataTransactionLink updateMetadataTransaction = UpdateMetadataTransaction(metadataSet, Parent, name, value);
                metadataSet.Update(null, value, null, null, null, ref chain);
            }
            else
            {
                AddMetadataTransactionLink addMetadataTransaction = AddMetadataTransaction(metadataSet, Parent, relationship, connectionType, name, value);

                metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(addMetadataTransaction, addMetadataTransaction.DomainId, addMetadataTransaction.RootMapId.Value, name, value, Parent, relationship, connectionType);

                chain.AddTransaction(addMetadataTransaction);

                Metadata.Add(metadataSet);

                IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager;

                if (metadataSetManager != null)
                {
                    metadataSetManager.Container = this;
                }
            }

            return(metadataSet);
        }