public List <ProcessVariable> ParseProcessVariables(XElement allFileElement)
        {
            var xElement = allFileElement.Element(XmlnsConstant.tibcoProcessNameSpace + "processVariables");

            if (xElement == null)
            {
                return(null);
            }

            var processVariables = new List <ProcessVariable>();

            foreach (var variable in xElement.Elements())
            {
                var variableParameters = this.xsdParser.Parse(variable.Nodes());

                if (variableParameters.Count > 0)
                {
                    var processVariable = new ProcessVariable
                    {
                        Parameter =
                            new ClassParameter
                        {
                            Name = variable.Name.LocalName,
                            Type = variableParameters[0].Type
                        },
                        ObjectXNodes = variable.Nodes()
                    };
                    processVariables.Add(processVariable);
                }
            }

            return(processVariables);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private java.util.Map<String, Object> extractVariables(org.camunda.bpm.engine.cdi.annotation.StartProcess startProcessAnnotation, javax.interceptor.InvocationContext ctx) throws Exception
        private IDictionary <string, object> extractVariables(StartProcess startProcessAnnotation, InvocationContext ctx)
        {
            VariableMap variables = new VariableMapImpl();

            foreach (System.Reflection.FieldInfo field in ctx.Method.DeclaringClass.DeclaredFields)
            {
                if (!field.isAnnotationPresent(typeof(ProcessVariable)) && !field.isAnnotationPresent(typeof(ProcessVariableTyped)))
                {
                    continue;
                }
                field.Accessible = true;

                string fieldName = null;

                ProcessVariable processStartVariable = field.getAnnotation(typeof(ProcessVariable));
                if (processStartVariable != null)
                {
                    fieldName = processStartVariable.value();
                }
                else
                {
                    ProcessVariableTyped processStartVariableTyped = field.getAnnotation(typeof(ProcessVariableTyped));
                    fieldName = processStartVariableTyped.value();
                }

                if (string.ReferenceEquals(fieldName, null) || fieldName.Length == 0)
                {
                    fieldName = field.Name;
                }
                object value = field.get(ctx.Target);
                variables.put(fieldName, value);
            }

            return(variables);
        }
        // bool da bude, void
        public static Tuple <float, float> GetMinMaxRangeForUnit(ProcessVariable pv, UnitSymbol uSymb)
        {
            Tuple <float, float> range = new Tuple <float, float>(float.MinValue, float.MaxValue);



            return(range);
        }
Ejemplo n.º 4
0
        public Form1()
        {
            InitializeComponent();

            pv            = new ProcessVariable("dg535:GtDeviceName");
            pv.DataEvent += pv_DataEvent;
            pv.Connect();
        }
        public static Tuple <float, float> GetAlarmRange(ProcessVariable pv, UnitSymbol uSymb)
        {
            Tuple <float, float> range = new Tuple <float, float>(float.MinValue, float.MaxValue);

            // to do


            return(range);
        }
Ejemplo n.º 6
0
 public ProcessVariable decay()
 {
     if (pv == null)
     {
         pv = new ProcessVariable();
         pv.Variables.Add(new PoisonGas());
     }
     return(pv);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Storing the Process Varible in dictionary. Key= pv.Name, Value=pv
 /// </summary>
 /// <param name="pv"></param>
 public void AddProcessVariable(ProcessVariable pv)
 {
     Console.WriteLine("Adding process variable Name= {0}", pv.Name);
     Database.Instance.ProcessVariablesName.TryAdd(pv.Name, pv);
     if (pv.Type == VariableTypes.ANALOG)
     {
         OnAnalogAdded?.Invoke(this, (Analog)pv);
     }
 }
Ejemplo n.º 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
            public void doWith(System.Reflection.MethodInfo method)
            {
                State state = AnnotationUtils.getAnnotation(method, typeof(State));

                string processName = component.processKey();

                if (StringUtils.hasText(state.process()))
                {
                    processName = state.process();
                }

                string stateName = state.state();

                if (!StringUtils.hasText(stateName))
                {
                    stateName = state.value();
                }

                Assert.notNull(stateName, "You must provide a stateName!");

                IDictionary <int, string> vars = new Dictionary <int, string>();

                Annotation[][] paramAnnotationsArray = method.ParameterAnnotations;

                int ctr         = 0;
                int pvMapIndex  = -1;
                int procIdIndex = -1;

                foreach (Annotation[] paramAnnotations in paramAnnotationsArray)
                {
                    ctr += 1;

                    foreach (Annotation pa in paramAnnotations)
                    {
                        if (pa is ProcessVariable)
                        {
                            ProcessVariable pv     = (ProcessVariable)pa;
                            string          pvName = pv.value();
                            vars[ctr] = pvName;
                        }
                        else if (pa is ProcessVariables)
                        {
                            pvMapIndex = ctr;
                        }
                        else if (pa is ProcessId)
                        {
                            procIdIndex = ctr;
                        }
                    }
                }

                ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(vars, method, bean, stateName, beanName, pvMapIndex, procIdIndex, processName);

                outerInstance.registry.registerActivitiStateHandler(registration);
            }
Ejemplo n.º 9
0
        public void Execute(ProcessInfo process, PassState passInfo)
        {
            Dictionary <int, int> pages = new Dictionary <int, int>();

            pages.Add(1, 0);        // pages =0   hour =0
            pages.Add(6, 8);        // pages <5   hour =8
            pages.Add(21, 16);      // pages <=20 hour =16
            pages.Add(200, 24);     // pages >20  hour =24
            try
            {
                ProcessVariable doc       = process.GetVariableByName("Документ");
                ProcessVariable count     = process.GetVariableByName("Общее кол-во листов");
                ProcessVariable hours     = process.GetVariableByName("Срок исполнения задания");
                DVCard          _doc      = (DVCard)doc.Value;
                CardData        cardData  = process.Session.CardManager.GetCardData(new Guid(_doc.ID));
                RowData         row       = cardData.Sections[cardData.Type.Sections["СвойстваСтруктура"].Id].FirstRow;
                int             countPage = row.GetInt32("КоличествоЛистов").HasValue ? row.GetInt32("КоличествоЛистов").Value : 0;
                int             countApp  = row.GetInt32("ВПриложении").HasValue ? row.GetInt32("ВПриложении").Value : 0;
                count.Value = countPage + countApp;
                hours.Value = pages.Where(s => s.Key > (int)count.Value).Select(s => s.Value).Min();
                //var message=string.Format("Общее кол {0}, срок согласования {1} ч.", count.Value, hours.Value);

                //ListHours
                ProcessVariable listHours = process.GetVariableByName("ListHours");
                process.LogMessage("Кол" + listHours.Values.Count.ToString());
                process.LogMessage(listHours.GetType().Name);

                process.LogMessage("Кол listHours.VarEnumValues.Count" + listHours.VarEnumValues.Count.ToString());
                process.LogMessage("listHours.Values");
                for (int i = 0; i < listHours.Values.Count; i++)
                {
                    var value = listHours.Values[i];
                    process.LogMessage(value.GetType().Name);
                    process.LogMessage(value.Key.ToString());
                    process.LogMessage(value.Value.ToString());
                    //pages.Add((int)value.Key,(int)value.Value);
                }
                process.LogMessage("listHours.VarEnumValues");
                process.LogMessage(listHours.VarEnumValues.Keys.Count.ToString());
                //for (int i = 0; i < listHours.VarEnumValues.Count; i++)
                //{
                //	process.LogMessage(listHours.VarEnumValues[i].GetType().Name );
                //	process.LogMessage(listHours.VarEnumValues[i].NumValue.ToString());
                //	process.LogMessage(listHours.VarEnumValues[i].Value.ToString());
                //}
            }
            catch (Exception ex)
            {
                process.LogMessage("Ошибка выполнения скрипта:" + ex.Message);
            }
            return;
        }
Ejemplo n.º 10
0
        public void Test_ParseInvalidVariableNoCurlyBracket(string inputKeyword, string outputKeyword, string left, string right)
        {
            var translationTable = new Dictionary <string, string>();

            translationTable[inputKeyword] = outputKeyword;

            var input    = left + inputKeyword + right;
            var expected = input;
            var output   = ProcessVariable.ReplaceVariable(input, translationTable);

            Console.WriteLine("input   : " + input);
            Console.WriteLine("output  : " + output);
            Console.WriteLine("expected: " + expected);
            Assert.That(output, Is.EqualTo(expected));
        }
Ejemplo n.º 11
0
        public void Test_ParseVariable(string inputKeyword, string outputKeyword)
        {
            var translationTable = new Dictionary <string, string>();

            translationTable[inputKeyword] = outputKeyword;

            var input    = "{" + inputKeyword + "}";
            var expected = "{" + outputKeyword + "}";
            var output   = ProcessVariable.ReplaceVariable(input, translationTable);

            Console.WriteLine("input   : " + input);
            Console.WriteLine("output  : " + output);
            Console.WriteLine("expected: " + expected);
            Assert.That(output, Is.EqualTo(expected));
        }
Ejemplo n.º 12
0
        public void Test_ParseVariableInvalidIndex(string inputKeyword, string outputKeyword, int index, string left, string right)
        {
            var translationTable = new Dictionary <string, string>();

            translationTable[inputKeyword] = outputKeyword;

            var indexStr = left + index.ToString() + right;
            var input    = "{" + inputKeyword + indexStr + "}";
            var expected = input;
            var output   = ProcessVariable.ReplaceVariable(input, translationTable);

            Console.WriteLine("input   : " + input);
            Console.WriteLine("output  : " + output);
            Console.WriteLine("expected: " + expected);
            Assert.That(output, Is.EqualTo(expected));
        }
Ejemplo n.º 13
0
        public void Execute(ProcessInfo process, PassState passInfo, DocsVision.Platform.ObjectModel.ObjectContext objectContext)
        {
            try
            {
                #region Переменный БП
                ProcessVariable doc    = process.GetVariableByName("Документ");
                DVCard          _doc   = (DVCard)doc.Value;
                Guid            idCard = new Guid(_doc.ID);

                ProcessVariable listEmploeesApproval = process.GetVariableByName("Согласующие лица");
                var             c = listEmploeesApproval.Values.Values;
                #endregion
                Document          document        = objectContext.GetObject <Document>(idCard);
                var               cardKind        = document.SystemInfo.CardKind;
                var               result          = (((BaseCardSectionRow)document.GetSection(new Guid("{B13955FD-3202-44D1-92BD-6B0F6878385F}"))[0])["ВидДокумента"]);
                var               subKindDocument = (((BaseCardSectionRow)document.GetSection(new Guid("{B13955FD-3202-44D1-92BD-6B0F6878385F}"))[0]).GetGuid("ВидДокумента"));
                BaseUniversalItem itemCard        = objectContext.GetObject <BaseUniversalItem>(subKindDocument);
            }
            catch (Exception ex)
            {
                process.LogMessage("Ошибка выполнения скрипта:" + ex.Message);
            }
            return;
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Return Process Variable if exists;
 /// otherwise pv=null
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public bool GetProcessVariableByName(string name, out ProcessVariable pv)
 {
     return(Database.Instance.ProcessVariablesName.TryGetValue(name, out pv));
 }