Exemple #1
0
        static void Test()
        {
            SchemaMaster master = new SchemaMaster();

            master.TypeName                     = AssemblyUtil.GetTypeString(typeof(SequentialWorkflowInstanceFactory));
            master.InstanceFactory              = new SequentialWorkflowInstanceFactory();
            master.Description.Id               = Guid.NewGuid();
            master.Description.Name             = "Agreement";
            master.Description.Creator          = "Mediachase";
            master.Description.Icon             = string.Empty;
            master.Description.Comment          = string.Empty;
            master.Description.UI.CreateControl = string.Empty;
            master.Description.UI.EditControl   = string.Empty;
            master.Description.UI.ViewControl   = string.Empty;

            ActivityMaster create = new ActivityMaster();

            create.TypeName = AssemblyUtil.GetTypeString(typeof(CreateAssignmentAndWaitResultActivityInstanceFactory));
            CreateAssignmentAndWaitResultActivityInstanceFactory ifact = new CreateAssignmentAndWaitResultActivityInstanceFactory();

            ifact.AssignmentProperties = new PropertyValueCollection();
            ifact.AssignmentProperties.Add(new PropertyValue("Subject", "Test Subject"));
            ifact.AssignmentProperties.Add(new PropertyValue("UserId", 12));

            create.InstanceFactory = ifact;

            create.Description.Name             = "AgreeWith";
            create.Description.Icon             = string.Empty;
            create.Description.Comment          = string.Empty;
            create.Description.UI.CreateControl = string.Empty;
            create.Description.UI.EditControl   = string.Empty;
            create.Description.UI.ViewControl   = string.Empty;


            ActivityMaster block = new ActivityMaster();

            block.TypeName                     = AssemblyUtil.GetTypeString(typeof(BlockActivityInstanceFactory));
            block.InstanceFactory              = new BlockActivityInstanceFactory();
            block.Description.Name             = "AgreementBlock";
            block.Description.Icon             = string.Empty;
            block.Description.Comment          = string.Empty;
            block.Description.UI.CreateControl = string.Empty;
            block.Description.UI.EditControl   = string.Empty;
            block.Description.UI.ViewControl   = string.Empty;

            master.Description.Activities.Add(create);
            master.Description.Activities.Add(block);

            master.Description.SupportedIbnObjectTypes.Add(16);

            string xml = McXmlSerializer.GetString <SchemaMaster>(master, typeof(SequentialWorkflowInstanceFactory),
                                                                  typeof(CreateAssignmentAndWaitResultActivityInstanceFactory),
                                                                  typeof(BlockActivityInstanceFactory));
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkflowDescription"/> class.
        /// </summary>
        public WorkflowDescription(string name, SchemaMaster schemaMaster, object transientWorkflow)
        {
            if (name == null)
                throw new ArgumentNullException("name");
            if (schemaMaster == null)
                throw new ArgumentNullException("schemaMaster");
            if (transientWorkflow == null)
                throw new ArgumentNullException("transientWorkflow");

            this.Name = name;
            this.SchemaMaster = schemaMaster;
            this.TransientWorkflow = transientWorkflow;
            this.PlanFinishTimeType = TimeType.NotSet;
        }
Exemple #3
0
 /// <summary>
 /// Gets the activity primitive.
 /// </summary>
 /// <param name="activity">The activity.</param>
 /// <param name="pageInstanse">The page instanse.</param>
 /// <returns></returns>
 public static Control GetActivityPrimitive(Activity activity, SchemaMaster shemaMaster, Page pageInstanse)
 {
     //ToDo: get additional info from activity
     ActivityMaster am = WorkflowActivityWrapper.GetActivityMaster(shemaMaster, activity, activity.Name);
     if (am != null)
         return pageInstanse.LoadControl(am.Description.UI.ViewControl);
     else
         return null;
     //if (activity is CompositeActivity && ((CompositeActivity)activity).Activities.Count > 0)
     //{
     //    return pageInstanse.LoadControl("~/Apps/BusinessProcess/Primitives/CompositeActivity.ascx");
     //}
     //else
     //{
     //    return pageInstanse.LoadControl("~/Apps/BusinessProcess/Primitives/SimpleActivity.ascx");
     //}
 }
Exemple #4
0
        private static SchemaMasterCollection LoadDefaultMasterts()
        {
            SchemaMasterCollection retVal = new SchemaMasterCollection();

            //string path = HostingEnvironment.MapPath("~/Apps/BusinessProcess/Config/Schemas");

            //if (Directory.Exists(path))
            //{
            //    foreach (string filePath in Directory.GetFiles(path, "*.xml"))
            //    {
            //        SchemaMaster master = McXmlSerializer.GetObjectFromFile<SchemaMaster>(filePath,
            //            typeof(SequentialWorkflowInstanceFactory),
            //            typeof(CreateAssignmentAndWaitResultActivityInstanceFactory),
            //            typeof(BlockActivityInstanceFactory));

            //        retVal.Add(master);
            //    }
            //}

            // O.R. [2009-07-28]: Use subdirectories to find schemas
            string rootPath = HostingEnvironment.MapPath("~/Apps/BusinessProcess");

            if (Directory.Exists(rootPath))
            {
                foreach (string filePath in Directory.GetFiles(rootPath, "*.xml", SearchOption.AllDirectories))
                {
                    if (filePath.ToLowerInvariant().Contains("\\config\\schemas\\"))
                    {
                        SchemaMaster master = McXmlSerializer.GetObjectFromFile <SchemaMaster>(filePath,
                                                                                               typeof(SequentialWorkflowInstanceFactory),
                                                                                               typeof(CreateAssignmentAndWaitResultActivityInstanceFactory),
                                                                                               typeof(BlockActivityInstanceFactory));

                        retVal.Add(master);
                    }
                }
            }

            return(retVal);
        }
Exemple #5
0
        static void Test()
        {
            SchemaMaster master = new SchemaMaster();

            master.TypeName = AssemblyUtil.GetTypeString(typeof(SequentialWorkflowInstanceFactory));
            master.InstanceFactory = new SequentialWorkflowInstanceFactory();
            master.Description.Id = Guid.NewGuid();
            master.Description.Name = "Agreement";
            master.Description.Creator = "Mediachase";
            master.Description.Icon = string.Empty;
            master.Description.Comment = string.Empty;
            master.Description.UI.CreateControl = string.Empty;
            master.Description.UI.EditControl = string.Empty;
            master.Description.UI.ViewControl = string.Empty;

            ActivityMaster create = new ActivityMaster();
            create.TypeName = AssemblyUtil.GetTypeString(typeof(CreateAssignmentAndWaitResultActivityInstanceFactory));
            CreateAssignmentAndWaitResultActivityInstanceFactory ifact = new CreateAssignmentAndWaitResultActivityInstanceFactory();
            ifact.AssignmentProperties = new PropertyValueCollection();
            ifact.AssignmentProperties.Add(new PropertyValue("Subject", "Test Subject"));
            ifact.AssignmentProperties.Add(new PropertyValue("UserId", 12));

            create.InstanceFactory = ifact;

            create.Description.Name = "AgreeWith";
            create.Description.Icon = string.Empty;
            create.Description.Comment = string.Empty;
            create.Description.UI.CreateControl = string.Empty;
            create.Description.UI.EditControl = string.Empty;
            create.Description.UI.ViewControl = string.Empty;

            ActivityMaster block = new ActivityMaster();
            block.TypeName = AssemblyUtil.GetTypeString(typeof(BlockActivityInstanceFactory));
            block.InstanceFactory = new BlockActivityInstanceFactory();
            block.Description.Name = "AgreementBlock";
            block.Description.Icon = string.Empty;
            block.Description.Comment = string.Empty;
            block.Description.UI.CreateControl = string.Empty;
            block.Description.UI.EditControl = string.Empty;
            block.Description.UI.ViewControl = string.Empty;

            master.Description.Activities.Add(create);
            master.Description.Activities.Add(block);

            master.Description.SupportedIbnObjectTypes.Add(16);

            string xml = McXmlSerializer.GetString<SchemaMaster>(master, typeof(SequentialWorkflowInstanceFactory),
                        typeof(CreateAssignmentAndWaitResultActivityInstanceFactory),
                        typeof(BlockActivityInstanceFactory));
        }
        /// <summary>
        /// Gets the activity master.
        /// </summary>
        /// <param name="schemaMaster">The schema master.</param>
        /// <param name="activityRoot">The activity root.</param>
        /// <param name="activityQualifiedName">Name of the activity qualified.</param>
        /// <returns></returns>
        public static ActivityMaster GetActivityMaster(SchemaMaster schemaMaster, object activityRoot, string activityQualifiedName)
        {
            Activity root = activityRoot as Activity;
            if (root == null)
                return null;

            Activity element = root.GetActivityByName(activityQualifiedName);
            if (element == null)
                return null;

            ActivityMaster activityMaster = schemaMaster.GetActivityMaster(element.GetType());

            if (activityMaster == null)
                return null;

            return activityMaster;
        }
        private void DisableUnsupportedObjectTypes(SchemaMaster currentShemaMaster)
        {
            // enable all
            DocumentCheckBox.Enabled = true;
            TaskCheckBox.Enabled = true;
            TodoCheckBox.Enabled = true;
            IncidentCheckBox.Enabled = true;

            if (currentShemaMaster != null)
            {
                List<int> supportedIbnObjectTypes = currentShemaMaster.Description.SupportedIbnObjectTypes;
                if (supportedIbnObjectTypes.Count > 0) // not all supported
                {
                    if (!supportedIbnObjectTypes.Contains((int)ObjectTypes.Document))
                    {
                        DocumentCheckBox.Enabled = false;
                    }
                    if (!supportedIbnObjectTypes.Contains((int)ObjectTypes.Task))
                    {
                        TaskCheckBox.Enabled = false;
                    }
                    if (!supportedIbnObjectTypes.Contains((int)ObjectTypes.ToDo))
                    {
                        TodoCheckBox.Enabled = false;
                    }
                    if (!supportedIbnObjectTypes.Contains((int)ObjectTypes.Issue))
                    {
                        IncidentCheckBox.Enabled = false;
                    }
                }
            }
        }