Ejemplo n.º 1
0
        public StartEventConverter GetStartEventConverter(CallActivity callActivity)
        {
            var converterId = ConversionTemplates.ProcessConverterId(callActivity.CalledElement, callActivity.Id);

            if (processConverters.TryGetValue(converterId, out var processConverter))
            {
                return(processConverter.GetStartEventConverter());
            }
            //TODO throw exception
            return(null);
        }
Ejemplo n.º 2
0
        SolidityStatement CreateActiveStatesMapping()
        {
            var mappingStatement = new SolidityMappingStatement(
                "string",
                "bool",
                ConversionTemplates.ActiveStatesMappingName(Id),
                InstanceIdentifiers.Select(i => new Property {
                DataType = PropertyDataType.Uint
            }).ToList());

            return(new SolidityStatement(mappingStatement.ToString()));
        }
Ejemplo n.º 3
0
        SolidityFunction CreateGetStateFunction()
        {
            var functionName     = ConversionTemplates.ActiveStatesFunctionName(Id);
            var getStateFunction = new SolidityFunction(functionName, SolidityVisibility.Public, "bool", true);

            getStateFunction.AddToBody(new SolidityStatement($"return " +
                                                             $"{ConversionTemplates.ActiveStateAssignment(ConverterConfig.STATE_PARAMETER_NAME, Id, InstanceIdentifiers, true)}"));
            //Add the potential process identifiers
            getStateFunction.AddParameters(GetIdentifiersAsParameters());
            getStateFunction.AddParameter(new SolidityParameter("string", ConverterConfig.STATE_PARAMETER_NAME));
            return(getStateFunction);
        }
        public SolidityStatement ConvertProperty(Property property)
        {
            SolidityStatement propertyStatement = new SolidityStatement();
            string            propertyType      = Helpers.PropertyTypeToString(property, contractConverter);
            var propertyName = Helpers.ToLowerCamelCase(property.Name);

            if (property.PropertyType == PropertyType.Single || property.PropertyType == PropertyType.Collection)
            {
                propertyStatement.Add($"{propertyType} {propertyName}");
            }
            else if (property.PropertyType == PropertyType.Dictionary)
            {
                var keyType = Helpers.PrimitivePropertyTypeToString(property.KeyDataType);
                propertyStatement.Add(ConversionTemplates.MappingTypeVariableDefinition(propertyName, keyType, propertyType));
                //Also an an array to store the key values (used when iteration through the mapping is required)
                propertyStatement.Add($"{keyType}[] {ConversionTemplates.MappingKeysArrayName(propertyName)}");
            }
            return(propertyStatement);
            //TODO: exception propertytype not defined
        }
Ejemplo n.º 5
0
        public SolidityStatement GetChangeActiveStateStatement(bool active)
        {
            var activeStateAssignment = ConversionTemplates.ActiveStateAssignment(GetElementCallName(), processConverter.Id, processConverter.InstanceIdentifiers);

            return(new SolidityStatement($"{activeStateAssignment} = {active.ToString().ToLower()}"));
        }