示例#1
0
        public override BaseElement Clone()
        {
            IOSpecification clone = new IOSpecification();

            clone.SetValues(this);
            return(clone);
        }
示例#2
0
        public void SetValues(Activity otherActivity)
        {
            base.SetValues(otherActivity);
            failedJobRetryTimeCycleValue = otherActivity.FailedJobRetryTimeCycleValue;
            defaultFlow     = otherActivity.DefaultFlow;
            forCompensation = otherActivity.ForCompensation;
            if (otherActivity.LoopCharacteristics != null)
            {
                loopCharacteristics = (MultiInstanceLoopCharacteristics)otherActivity.LoopCharacteristics.Clone();
            }
            if (otherActivity.IoSpecification != null)
            {
                ioSpecification = (IOSpecification)otherActivity.IoSpecification.Clone();
            }

            dataInputAssociations = new List <DataAssociation>();
            if (otherActivity.DataInputAssociations != null && otherActivity.DataInputAssociations.Count > 0)
            {
                foreach (DataAssociation association in otherActivity.DataInputAssociations)
                {
                    dataInputAssociations.Add((DataAssociation)association.Clone());
                }
            }

            dataOutputAssociations = new List <DataAssociation>();
            if (otherActivity.DataOutputAssociations != null && otherActivity.DataOutputAssociations.Count > 0)
            {
                foreach (DataAssociation association in otherActivity.DataOutputAssociations)
                {
                    dataOutputAssociations.Add((DataAssociation)association.Clone());
                }
            }

            boundaryEvents.Clear();
            foreach (BoundaryEvent _event in otherActivity.BoundaryEvents)
            {
                boundaryEvents.Add(_event);
            }
        }
示例#3
0
        public void SetValues(IOSpecification otherSpec)
        {
            dataInputs = new List <DataSpec>();
            if (otherSpec.DataInputs != null && otherSpec.DataInputs.Count > 0)
            {
                foreach (DataSpec dataSpec in otherSpec.DataInputs)
                {
                    dataInputs.Add((DataSpec)dataSpec.Clone());
                }
            }

            dataOutputs = new List <DataSpec>();
            if (otherSpec.DataOutputs != null && otherSpec.DataOutputs.Count > 0)
            {
                foreach (DataSpec dataSpec in otherSpec.DataOutputs)
                {
                    dataOutputs.Add((DataSpec)dataSpec.Clone());
                }
            }

            dataInputRefs  = new List <string>(otherSpec.DataInputRefs);
            dataOutputRefs = new List <string>(otherSpec.DataOutputRefs);
        }
示例#4
0
        public void SetValues(Process otherElement)
        {
            base.SetValues(otherElement);

            //    setBpmnModel(bpmnModel);
            name          = otherElement.Name;
            executable    = otherElement.IsExecutable;
            documentation = otherElement.Documentation;
            if (otherElement.IoSpecification != null)
            {
                ioSpecification = (IOSpecification)otherElement.IoSpecification.Clone();
            }

            executionListeners = new List <ActivitiListener>();
            if (otherElement.GetExecutionListeners() != null && otherElement.GetExecutionListeners().Count > 0)
            {
                foreach (ActivitiListener listener in otherElement.GetExecutionListeners())
                {
                    executionListeners.Add((ActivitiListener)listener.Clone());
                }
            }

            candidateStarterUsers = new List <string>();
            if (otherElement.CandidateStarterUsers != null && otherElement.CandidateStarterUsers.Count > 0)
            {
                candidateStarterUsers.AddRange(otherElement.CandidateStarterUsers);
            }

            candidateStarterGroups = new List <string>();
            if (otherElement.CandidateStarterGroups != null && otherElement.CandidateStarterGroups.Count > 0)
            {
                candidateStarterGroups.AddRange(otherElement.CandidateStarterGroups);
            }

            eventListeners = new List <EventListener>();
            if (otherElement.EventListeners != null && otherElement.EventListeners.Count > 0)
            {
                foreach (EventListener listener in otherElement.EventListeners)
                {
                    eventListeners.Add((EventListener)listener.Clone());
                }
            }

            /*
             * This is required because data objects in Designer have no DI info and are added as properties, not flow elements
             *
             * Determine the differences between the 2 elements' data object
             */
            foreach (ValuedDataObject thisObject in DataObjects)
            {
                bool exists = false;
                foreach (ValuedDataObject otherObject in otherElement.DataObjects)
                {
                    if (thisObject.Id == otherObject.Id)
                    {
                        exists = true;
                    }
                }
                if (!exists)
                {
                    // missing object
                    RemoveFlowElement(thisObject.Id);
                }
            }

            dataObjects = new List <ValuedDataObject>();
            if (otherElement.DataObjects != null && otherElement.DataObjects.Count > 0)
            {
                foreach (ValuedDataObject dataObject in otherElement.DataObjects)
                {
                    ValuedDataObject clone = (ValuedDataObject)dataObject.Clone();
                    dataObjects.Add(clone);
                    // add it to the list of FlowElements
                    // if it is already there, remove it first so order is same as
                    // data object list
                    RemoveFlowElement(clone.Id);
                    AddFlowElement(clone);
                }
            }
        }