Пример #1
0
        protected override void Execute(CodeActivityContext context)
        {
            DynamicValue data = context.GetValue(this.Data);

            //set transition
            DynamicValue transition = new DynamicValue();

            data.TryGetValue("transition", out transition);
            context.SetValue(GlobalTransition, transition.ToString());
            data.Remove("transition");

            //write parameters
            DynamicValue variables = context.GetValue(GlobalVariables);

            foreach (string i in data.Keys)
            {
                DynamicValue value = new DynamicValue();
                data.TryGetValue(i, out value);
                if (variables.ContainsKey(i))
                {
                    variables.Remove(i);
                }
                variables.Add(i, value);
            }
            context.SetValue(GlobalVariables, variables);
        }
Пример #2
0
        public string ToString(Context context)
        {
            Value toStringValue;

            if (TryInvokeMethod(context, "ToString", null, out toStringValue))
            {
                return(toStringValue.String);
            }

            switch (Type)
            {
            case (ValueType.Nil):
                return("nil");

            case (ValueType.Array):
                var sb    = new System.Text.StringBuilder("[");
                var first = true;
                foreach (var e in ArrayDirect)
                {
                    if (!first)
                    {
                        sb.Append(", ");
                    }
                    else
                    {
                        first = false;
                    }
                    sb.Append(e.ToString(context));
                }
                sb.Append(']');
                return(sb.ToString());
            }
            return(DynamicValue != null ? DynamicValue.ToString() : "nil");
        }
Пример #3
0
        protected override void Execute(CodeActivityContext context)
        {
            DynamicValue taskdata = context.GetValue(this.Data);

            DynamicValue MessageId = new DynamicValue();
            taskdata.TryGetValue("MessageId", out MessageId);

            IMessageStore messageStore = strICT.InFlow.Db.StoreHandler.getMessageStore(context.GetValue(cfgSQLConnectionString));
            M_Message message = messageStore.getMessageBymsgId(Convert.ToInt32(MessageId.ToString()));

            //store message-type in GlobalTransition
            context.SetValue(GlobalTransition, message.Sender_SubjectName + "|" + message.Message_Type);


            DynamicValue data = DynamicValue.Parse(message.Data);
            DynamicValue variables = context.GetValue(GlobalVariables);

            //write message data to GlobalVariables
            foreach (string i in data.Keys)
            {
                DynamicValue value = new DynamicValue();
                data.TryGetValue(i, out value);
                if (variables.ContainsKey(i))
                {
                    variables.Remove(i);
                }
                variables.Add(i, value);
            }
            context.SetValue(GlobalVariables, variables);

            //mark message in message-store as received
            messageStore.markMessageAsReceived(message.Id);      
        }
        private static string DynamicLiteralValueTranslateItem(ActivityTranslator translator, ModelItem item)
        {
            object       value      = item.Properties[IMConstants.ValuePropertyName].Value.GetCurrentValue();
            DynamicValue validValue = GetValidValue(item, new DynamicValue(value));

            if (null != validValue.Value)
            {
                return(validValue.ToString());
            }
            return(value.ToString());
        }
Пример #5
0
        public override string ToString()
        {
            switch (Type)
            {
            case (ValueType.Nil):
                return("nil");

            case (ValueType.Array):
                return(String.Format("[{0}]", String.Join(", ", ArrayDirect)));
            }
            return(DynamicValue != null ? DynamicValue.ToString() : "nil");
        }
        private static string LiteralValueTranslateItem(ActivityTranslator translator, ModelItem item)
        {
            var temp = item.GetCurrentValue() as sae.Literal <DynamicValue>;

            if (null != temp)
            {
                DynamicValue id         = temp.Value;
                DynamicValue validValue = GetValidValue(item, id);
                if (null != validValue.Value)
                {
                    return(validValue.ToString());
                }
            }
            return(translator.Translate(item.Properties[IMConstants.ValuePropertyName].Value));
        }
Пример #7
0
        protected override void Execute(CodeActivityContext context)
        {
            System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(context.GetValue(cfgWFMUsername), context.GetValue(cfgWFMPassword));

            DynamicValue variables = context.GetValue(globalVariables);
            DynamicValue dvReadableParameters = new DynamicValue();
            foreach (string i in SbpmActivityHelper.convertCSVtoListofString(context.GetValue(readableParameters)))
            {
                if (variables.ContainsKey(i))
                {
                    DynamicValue value = new DynamicValue();
                    variables.TryGetValue(i, out value);
                    dvReadableParameters.Add(i, value);
                }
            }
          
            DynamicValue dvEditableParameters = new DynamicValue();
            foreach (string i in SbpmActivityHelper.convertCSVtoListofString(context.GetValue(editableParameters)))
            {
                if (variables.ContainsKey(i))
                {
                    DynamicValue value = new DynamicValue();
                    variables.TryGetValue(i, out value);
                    dvEditableParameters.Add(i, value);
                }
                else
                {
                    DynamicValue val = new DynamicValue();
                    val.Add("Type", "string");
                    val.Add("Value", "");
                    dvEditableParameters.Add(i, val);
                }
            }

            T_Task newTask = new T_Task("S", context.GetValue(globalWFId), context.GetValue(Name),false, false, context.GetValue(isEndState), dvReadableParameters.ToString(), dvEditableParameters.ToString(), context.GetValue(toSubject), context.GetValue(OrderId));//, 0, "");

            WorkflowManagementClient client = new WorkflowManagementClient(new Uri(context.GetValue(cfgManagementScopeAddress)), credentials);

            client.PublishNotification(newTask.toWorkflowNotification());

        }
Пример #8
0
        protected override void Execute(CodeActivityContext context)
        {
                DynamicValue data = context.GetValue(this.Data);
                DynamicValue transition = new DynamicValue();
                data.TryGetValue("recipient", out transition);
                context.SetValue(Recipient, transition.ToString());
                data.Remove("recipient");

                DynamicValue variables = context.GetValue(GlobalVariables);
                foreach (string i in data.Keys)
                {
                    DynamicValue value = new DynamicValue();
                    data.TryGetValue(i, out value);
                    if (variables.ContainsKey(i))
                    {
                        variables.Remove(i);
                    }
                    variables.Add(i, value);
                }

                context.SetValue(GlobalVariables, variables);
        }
Пример #9
0
        protected override void Execute(CodeActivityContext context)
        {
            System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(context.GetValue(cfgWFMUsername), context.GetValue(cfgWFMPassword));

            DynamicValue variables            = context.GetValue(globalVariables);
            DynamicValue dvReadableParameters = new DynamicValue();

            foreach (string i in SbpmActivityHelper.convertCSVtoListofString(context.GetValue(readableParameters)))
            {
                if (variables.ContainsKey(i))
                {
                    DynamicValue value = new DynamicValue();
                    variables.TryGetValue(i, out value);
                    dvReadableParameters.Add(i, value);
                }
            }

            DynamicValue dvEditableParameters = new DynamicValue();

            foreach (string i in SbpmActivityHelper.convertCSVtoListofString(context.GetValue(editableParameters)))
            {
                if (variables.ContainsKey(i))
                {
                    DynamicValue value = new DynamicValue();
                    variables.TryGetValue(i, out value);
                    dvEditableParameters.Add(i, value);
                }
                else
                {
                    DynamicValue val = new DynamicValue();
                    val.Add("Type", "string");
                    val.Add("Value", "");
                    dvEditableParameters.Add(i, val);
                }
            }

            T_Task newTask = new T_Task("S", context.GetValue(globalWFId), context.GetValue(Name), false, false, context.GetValue(isEndState), dvReadableParameters.ToString(), dvEditableParameters.ToString(), context.GetValue(toSubject), context.GetValue(OrderId));//, 0, "");

            WorkflowManagementClient client = new WorkflowManagementClient(new Uri(context.GetValue(cfgManagementScopeAddress)), credentials);

            client.PublishNotification(newTask.toWorkflowNotification());
        }
Пример #10
0
        protected override void Execute(CodeActivityContext context)
        {
            System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(context.GetValue(cfgWFMUsername), context.GetValue(cfgWFMPassword));

            DynamicValue variables = context.GetValue(globalVariables);

            //set message data
            DynamicValue data = new DynamicValue();

            foreach (string i in SbpmActivityHelper.convertCSVtoListofString(context.GetValue(parameters)))
            {
                if (variables.ContainsKey(i))
                {
                    DynamicValue value = new DynamicValue();
                    variables.TryGetValue(i, out value);
                    data.Add(i, value);
                }
            }

            List <string>    recipients = new List <string>(context.GetValue(recipient).Split(','));
            List <M_Message> messages   = new List <M_Message>();


            if (recipients.Count == 1)
            {
                List <string> usernames        = new List <string>();
                IUserStore    userStore        = StoreHandler.getUserStore(context.GetValue(cfgSQLConnectionString));
                string[]      recipientArray   = recipients[0].Split('|');
                string        recipientSubject = recipientArray[0];

                IProcessStore      processStore    = StoreHandler.getProcessStore(context.GetValue(cfgSQLConnectionString));
                P_ProcessSubject   senderSubject   = processStore.getProcessSubjectForWFId(context.GetValue(globalWFId));
                P_WorkflowInstance senderinstance  = processStore.getWorkflowInstance(context.GetValue(globalWFId));
                P_ProcessSubject   recipientSubjet = processStore.getProcessSubject(senderSubject.Process_Id, recipientSubject);

                if (recipientSubjet.MultiSubject && recipientArray.Length == 1)//If multisubject
                {
                    P_WorkflowInstance recipientInstance = processStore.getWorkflowInstance(recipientSubjet.Id, senderinstance.ProcessInstance_Id, null);
                    //Check if Recipientinstance already Exists
                    if (recipientInstance != null)
                    {
                        //recipients are only existing processsubjectinstances
                        usernames = processStore.getWorkflowInstanceOwnersForMultisubjects(recipientInstance.ProcessSubject_Id, recipientInstance.ProcessInstance_Id);
                    }
                    else
                    {
                        //recipients are all users who represent the processsubject
                        // usernames = subjectStore.getUsernamesForSubjectName(recipientArray[0]);
                        usernames = userStore.getUsernamesForRole(recipientSubjet.U_Role_Id);
                    }

                    foreach (string user in usernames)
                    {
                        M_Message m = new M_Message(context.GetValue(globalWFId), recipientSubject, user, context.GetValue(type), data.ToString());
                        messages.Add(m);
                    }
                }
                else
                { //simple Subject
                    string recipientUsername = "";

                    if (recipientArray.Length > 1)
                    {
                        recipientUsername = recipientArray[1];
                    }

                    M_Message m = new M_Message(context.GetValue(globalWFId), recipientSubject, recipientUsername, context.GetValue(type), data.ToString());
                    messages.Add(m);
                }
            }
            else //multisubject
            {
                foreach (string rec in recipients)
                {
                    string[] recipientArray    = rec.Split('|');
                    string   recipientSubject  = recipientArray[0];
                    string   recipientUsername = "";

                    if (recipientArray.Length > 1)
                    {
                        recipientUsername = recipientArray[1];
                    }
                    M_Message m = new M_Message(context.GetValue(globalWFId), recipientSubject, recipientUsername, context.GetValue(type), data.ToString());
                    messages.Add(m);
                }
            }

            WorkflowManagementClient client = new WorkflowManagementClient(new Uri(context.GetValue(cfgProcessScopeAddress)), credentials);

            messages.ForEach(m => client.PublishNotification(m.toWorkflowNotification()));
        }
Пример #11
0
        protected override void Execute(CodeActivityContext context)
        {
            DynamicValue taskdata = context.GetValue(this.Data);

            DynamicValue MessageId = new DynamicValue();

            taskdata.TryGetValue("MessageId", out MessageId);

            IMessageStore messageStore = strICT.InFlow.Db.StoreHandler.getMessageStore(context.GetValue(cfgSQLConnectionString));
            M_Message     message      = messageStore.getMessageBymsgId(Convert.ToInt32(MessageId.ToString()));

            //store message-type in GlobalTransition
            context.SetValue(GlobalTransition, message.Sender_SubjectName + "|" + message.Message_Type);


            DynamicValue data      = DynamicValue.Parse(message.Data);
            DynamicValue variables = context.GetValue(GlobalVariables);

            //write message data to GlobalVariables
            foreach (string i in data.Keys)
            {
                DynamicValue value = new DynamicValue();
                data.TryGetValue(i, out value);
                if (variables.ContainsKey(i))
                {
                    variables.Remove(i);
                }
                variables.Add(i, value);
            }
            context.SetValue(GlobalVariables, variables);

            //mark message in message-store as received
            messageStore.markMessageAsReceived(message.Id);
        }
Пример #12
0
        SerializedProperty GetValueProperty(DynamicValue.ValueTypes type, bool isArray)
        {
            string propertyName = type.ToString();
            SerializedProperty valueProperty = null;

            if (type != DynamicValue.ValueTypes.Null)
                valueProperty = _dummySerialized.FindProperty(isArray ? propertyName + "Array" : propertyName);

            return valueProperty;
        }
Пример #13
0
        protected override void Execute(CodeActivityContext context)
        {
            System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(context.GetValue(cfgWFMUsername), context.GetValue(cfgWFMPassword));

            DynamicValue variables = context.GetValue(globalVariables);

            //set message data
            DynamicValue data = new DynamicValue();
            foreach (string i in SbpmActivityHelper.convertCSVtoListofString(context.GetValue(parameters)))
            {
                if (variables.ContainsKey(i))
                {
                    DynamicValue value = new DynamicValue();
                    variables.TryGetValue(i, out value);
                    data.Add(i, value);
                }
            }

            List<string> recipients = new List<string>(context.GetValue(recipient).Split(','));
            List<M_Message> messages = new List<M_Message>();

            
            if (recipients.Count == 1)
            {
                List<string> usernames = new List<string>();
                IUserStore userStore = StoreHandler.getUserStore(context.GetValue(cfgSQLConnectionString));
                string[] recipientArray = recipients[0].Split('|');
                string recipientSubject = recipientArray[0];

                IProcessStore processStore = StoreHandler.getProcessStore(context.GetValue(cfgSQLConnectionString));
                P_ProcessSubject senderSubject = processStore.getProcessSubjectForWFId(context.GetValue(globalWFId));
                P_WorkflowInstance senderinstance = processStore.getWorkflowInstance(context.GetValue(globalWFId));
                P_ProcessSubject recipientSubjet = processStore.getProcessSubject(senderSubject.Process_Id, recipientSubject);

                if (recipientSubjet.MultiSubject && recipientArray.Length == 1)//If multisubject
                {
                    P_WorkflowInstance recipientInstance = processStore.getWorkflowInstance(recipientSubjet.Id, senderinstance.ProcessInstance_Id, null);
                    //Check if Recipientinstance already Exists
                    if (recipientInstance != null)
                    {
                        //recipients are only existing processsubjectinstances
                        usernames = processStore.getWorkflowInstanceOwnersForMultisubjects(recipientInstance.ProcessSubject_Id, recipientInstance.ProcessInstance_Id);
                    }
                    else
                    {   
                        //recipients are all users who represent the processsubject
                       // usernames = subjectStore.getUsernamesForSubjectName(recipientArray[0]);
                        usernames = userStore.getUsernamesForRole(recipientSubjet.U_Role_Id);
                    }

                    foreach (string user in usernames)
                    {
                        M_Message m = new M_Message(context.GetValue(globalWFId), recipientSubject, user, context.GetValue(type), data.ToString());
                        messages.Add(m);
                    }
                }
                else
                { //simple Subject
                    
                    string recipientUsername = "";

                    if (recipientArray.Length > 1)
                    {
                        recipientUsername = recipientArray[1];
                    }

                    M_Message m = new M_Message(context.GetValue(globalWFId), recipientSubject, recipientUsername, context.GetValue(type), data.ToString());
                    messages.Add(m);
                }
            }
            else //multisubject
            {
                foreach (string rec in recipients)
                {
                    string[] recipientArray = rec.Split('|');
                    string recipientSubject = recipientArray[0];
                    string recipientUsername = "";

                    if (recipientArray.Length > 1)
                    {
                        recipientUsername = recipientArray[1];
                    }
                    M_Message m = new M_Message(context.GetValue(globalWFId), recipientSubject, recipientUsername, context.GetValue(type), data.ToString());
                    messages.Add(m);
                }
            }

            WorkflowManagementClient client = new WorkflowManagementClient(new Uri(context.GetValue(cfgProcessScopeAddress)), credentials);
            messages.ForEach(m => client.PublishNotification(m.toWorkflowNotification()));
        }