示例#1
0
        private Process CreatePublicProcessContainer(ProjectItem projectItem)
        {
            StepDataHolder data = MapToStepDataHolder(StepType.Process, projectItem,
                                                      ((Activity)projectItem).Template);

            data.Accessibility = "Public";

            data.Save();

            return(Process.Parse(data.UID));
        }
示例#2
0
        private Step CreateProcessStep(Process process, ProjectItem projectItem, int position)
        {
            StepDataHolder data = MapToStepDataHolder(GetStepType(projectItem),
                                                      projectItem, ((Activity)projectItem).Template);

            data.BaseStepId   = process.Id;
            data.ParentStepId = projectItem.Parent.Id;

            data.StepPosition = position;

            data.Save();

            return(Step.Parse(data.UID));
        }
示例#3
0
        private StepDataHolder MapToStepDataHolder(StepType stepType,
                                                   ProjectItem projectItem,
                                                   ActivityModel formerModel)
        {
            var data = new StepDataHolder();

            data.Accessibility = "Private";
            data.DrivenMode    = "Manual";

            data.EstimatedDuration = ConvertEstimatedDuration(formerModel);

            data.ExecutionContext = ConvertExecutionContext(projectItem);

            data.ExtensionData = ConvertExtensionData(formerModel);

            data.IsOptional = !formerModel.IsMandatory;

            data.Notes = projectItem.Notes;

            data.OldProjectObjectId = projectItem.Id;

            if (formerModel.DueOnControllerId > 0 && EmpiriaString.IsInteger(formerModel.DueOnTerm))
            {
                StepRelation relation = CreateDependencyAsStepRelation(projectItem, formerModel);

                var dueOn = Activity.Parse(formerModel.DueOnControllerId);
                data.DataModels = $"{formerModel.DueOnTerm} {formerModel.DueOnTermUnit} {formerModel.DueOnCondition} " +
                                  $"{dueOn.Name} ({dueOn.Template.ActivityType}) [{formerModel.DueOnControllerId}]";
            }

            if (formerModel.IsPeriodic)
            {
                data.PeriodicityRule = formerModel.PeriodicRule.ToJson();
            }

            data.ProcedureEntityId = formerModel.EntityId;
            data.ProcedureId       = formerModel.ProcedureId;

            data.StepKind = formerModel.ActivityType;

            data.StepName     = projectItem.Name.Trim();
            data.StepPosition = 0;
            data.StepType     = stepType;

            data.Tags   = projectItem.Tag;
            data.Themes = projectItem.Theme;

            return(data);
        }
        static internal void WriteStepData(StepDataHolder o)
        {
            var op = DataOperation.Parse("writeSTPStep", o.Id, o.UID, o.StepType.Id,
                                         o.StepKind, o.StepName, o.Notes, o.Themes, o.Tags, o.Keywords,
                                         o.ExtensionData.ToString(), o.ForeignLanguageData.ToString(),
                                         o.Constraints, o.ExecutionContext,
                                         o.DataModels, o.DefinedMacro, o.MicroWorkflowModel, o.Accessibility,
                                         o.DrivenMode, o.FlowControl, o.WorkItemType, o.StepRole, o.ProcessStage,
                                         o.IsOptional, o.LoopControl, o.PeriodicityRule.ToString(), o.EstimatedDuration.ToString(),
                                         o.DerivedFromStepId, o.NewVersionOfStepId, o.ReferenceOfStepId, o.ParentStepId,
                                         o.StepPosition, o.BaseStepId, o.OwnerId, o.ProcedureEntityId, o.ProcedureId,
                                         (char)o.Status, o.OldProjectObjectId);

            DataWriter.Execute(op);
        }