Beispiel #1
0
 /// <summary>
 /// Registers the element pending delete.
 /// </summary>
 /// <param name="elem">The elem.</param>
 internal void RegisterElementPendingDelete(CandleElement elem)
 {
     if (!_pendingsElementsDeleted.Contains(elem.Id))
     {
         _pendingsElementsDeleted.Add(elem.Id);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Création d'un nouveau contrat
        /// </summary>
        /// <param name="port">The port.</param>
        /// <param name="layer">The layer.</param>
        /// <returns></returns>
        private static ServiceContract CreateContract(CandleElement port, InterfaceLayer layer)
        {
            string name = StrategyManager.GetInstance(port.Store).NamingStrategy.CreateElementName(layer, port.RootName);

            // Vérification de l'existence
            foreach (ServiceContract sc in layer.ServiceContracts)
            {
                if (sc.Name == name)
                {
                    return(sc);
                }
            }

            // Sinon création avec copie des opérations
            ServiceContract contract = new ServiceContract(layer.Store);

            layer.ServiceContracts.Add(contract);
            contract.RootName = port.RootName;
            UnplacedModelHelper.RegisterNewModel(layer.Store, contract);

            TypeWithOperations copiedContract = null;

            if (port != null)
            {
                if (port is ServiceContract || port is ExternalServiceContract)
                {
                    copiedContract = port as TypeWithOperations;
                    contract.Name  = name;
                }
                else
                {
                    ClassImplementation clazz = port as ClassImplementation;
                    contract.Name = StrategyManager.GetInstance(clazz.Store).NamingStrategy.CreateElementName(layer, clazz.Name);
                    if (clazz.Contract != null)
                    {
                        copiedContract = clazz.Contract;
                    }
                    contract.Comment = clazz.Comment;
                }
            }

            if (copiedContract != null)
            {
                TypeWithOperations.CopyOperations(copiedContract, contract);
            }

            return(contract);
        }
Beispiel #3
0
        /// <summary>
        /// Création d'une nouvelle classe
        /// </summary>
        /// <param name="elem">The elem.</param>
        /// <param name="layer">The layer.</param>
        /// <returns></returns>
        private static ClassImplementation CreateClass(CandleElement elem, Layer layer)
        {
            string name = StrategyManager.GetInstance(elem.Store).NamingStrategy.CreateElementName(layer, elem.RootName);

            // On regarde d'abord si il n'existe pas une classe du même nom
            foreach (ClassImplementation cl in layer.Classes)
            {
                if (cl.Name == name)
                {
                    return(cl);
                }
            }

            // Sinon création d'une nouvelle
            ClassImplementation clazz = new ClassImplementation(layer.Store);

            clazz.RootName = elem.RootName;
            clazz.Name     = name;
            clazz.Comment  = elem.Comment;
            layer.Classes.Add(clazz);

            UnplacedModelHelper.RegisterNewModel(layer.Store, clazz);
            return(clazz);
        }
Beispiel #4
0
        /// <summary>
        /// Création d'un scenario
        /// </summary>
        /// <param name="elem">The elem.</param>
        /// <param name="layer">The layer.</param>
        /// <returns></returns>
        private static Scenario CreateScenario(CandleElement elem, UIWorkflowLayer layer)
        {
            string name = StrategyManager.GetInstance(elem.Store).NamingStrategy.CreateElementName(layer, elem.RootName);

            // On regarde d'abord si il n'existe pas une classe du même nom
            foreach (Scenario cl in layer.Scenarios)
            {
                if (cl.Name == name)
                {
                    return(cl);
                }
            }

            // Sinon création d'une nouvelle
            Scenario scenario = new Scenario(layer.Store);

            scenario.RootName = elem.RootName;
            scenario.Name     = name;
            scenario.Comment  = elem.Comment;
            layer.Scenarios.Add(scenario);

            UnplacedModelHelper.RegisterNewModel(layer.Store, scenario);
            return(scenario);
        }