[#ftl]
[#function createQueryString data prefix removePrefix excludes=[]]
	[#assign queryString=""]
	
	[#if properties??]
		[#list properties as key, value]
			[#assign keyAllowed=false]
			[#assign newKey=key]
			[#if prefix??]
				[#if prefix?length>0]
					[#if key?starts_with(prefix)]
						[#if removePrefix]
							[#assign newKey=key[prefix?length..]]
						[/#if]
						[#assign keyAllowed=true]
					[/#if]
				[/#if]
			[#else]
				[#assign keyAllowed=true]
			[/#if]
			[#if !keyAllowed]
				[#continue]
			[/#if]
			[#if keyAllowed && !excludes?seq_contains(key)]
				[#if value?is_boolean || value?is_number]
					[#assign qsAppend=newKey+"="+value?c]
				[#elseif value?is_string]
					[#if value?starts_with("$") && value?ends_with("}") && value?index_of("{")>0 ]
						[#assign propertyPrefix=value[1..value?index_of("{")-1]]
						[#assign propertyName=value[value?index_of("{")+1..value?length-2]]
						[#assign finalValue="{{" + propertyPrefix + ":" + propertyName + "}}"]
					[#else]
						[#assign finalValue=value]
					[/#if]
					[#assign qsAppend=newKey+"="+finalValue]
				[#else]
					[#assign qsAppend=""]
				[/#if]
				[#if qsAppend?length>0]
					[#if queryString?length>0]
						[#assign queryString=queryString+"&amp;"]
					[/#if]
					[#assign queryString=queryString+qsAppend]
				[/#if]
			[/#if]
		[/#list]	
		[#if queryString?length>0]
			[#assign queryString="?" + queryString]
		[/#if]
	[/#if]
	[#return queryString]           
[/#function]

[#function convertConfigValue value]
	[#assign result=value]
	
	[#if value?is_string]
		[#if value?starts_with("$") && value?ends_with("}") && value?index_of("{")>0 ]
			[#assign propertyPrefix=value[1..value?index_of("{")-1]]
			[#assign propertyName=value[value?index_of("{")+1..value?length-2]]
			[#assign result="{{" + propertyPrefix + ":" + propertyName + "}}"]
		[/#if]
	[/#if]
	
	[#return result]
[/#function]

[#function createBeanProperties data prefix removePrefix excludes=[]]

    [#assign beanProperties=""]

    [#if properties??]
        [#list properties as key, value]
            [#assign keyAllowed=false]
            [#assign newKey=key]
            [#if prefix??]
                [#if prefix?length>0]
                    [#if key?starts_with(prefix)]
                        [#if removePrefix]
                            [#assign newKey=key[prefix?length..]]
                        [/#if]
                        [#assign keyAllowed=true]
                    [/#if]
	            [#else]
	                [#assign keyAllowed=true]
                [/#if]
            [#else]
                [#assign keyAllowed=true]
            [/#if]
            [#if !keyAllowed]
                [#continue]
            [/#if]
            [#if keyAllowed && !excludes?seq_contains(key)]
                [#if value?is_boolean || value?is_number]
                    [#assign newValue=value?c]
                [#elseif value?is_string]
                    [#assign newValue=value]
                [#else]
                    [#assign newValue=""]
                [/#if]
                [#if newValue?length>0]
                    [#assign beanProperties]
[=beanProperties]
<property name="[=newKey]" value="[=newValue]"/>
                    [/#assign]
                [/#if]
            [/#if]
        [/#list]
    [/#if]

    [#return beanProperties]
[/#function]

[#function createCamelBeanProperties data prefix removePrefix excludes=[]]

    [#assign beanProperties=""]

    [#if properties??]
        [#list properties as key, value]
            [#assign keyAllowed=false]
            [#assign newKey=key]
            [#if prefix??]
                [#if prefix?length>0]
                    [#if key?starts_with(prefix)]
                        [#if removePrefix]
                            [#assign newKey=key[prefix?length..]]
                        [/#if]
                        [#assign keyAllowed=true]
                    [/#if]
	            [#else]
	                [#assign keyAllowed=true]
                [/#if]
            [#else]
                [#assign keyAllowed=true]
            [/#if]
            [#if !keyAllowed]
                [#continue]
            [/#if]
            [#if keyAllowed && !excludes?seq_contains(key)]
                [#if value?is_boolean || value?is_number]
                    [#assign newValue=value?c]
                [#elseif value?is_string]
                    [#if value?starts_with("$") && value?ends_with("}") && value?index_of("{")>0 ]
                        [#assign propertyPrefix=value[1..value?index_of("{")-1]]
                        [#assign propertyName=value[value?index_of("{")+1..value?length-2]]
                        [#assign newValue="{{" + propertyPrefix + ":" + propertyName + "}}"]
                    [#else]
                        [#assign newValue=value]
                    [/#if]
                [#else]
                    [#assign newValue=""]
                [/#if]
                [#if newValue?length>0]
                    [#assign beanProperties]
[=beanProperties]
<property name="[=newKey]" value="[=newValue]"/>
                    [/#assign]
                [/#if]
            [/#if]
        [/#list]
    [/#if]

    [#return beanProperties]
[/#function]

[#function createPropertiesFileData data prefix removePrefix prepend="" excludes=[]]

    [#assign resultProperties=""]

    [#if properties??]
        [#list properties as key, value]
            [#assign keyAllowed=false]
            [#assign newKey=prepend+key]
            [#if prefix??]
                [#if prefix?length>0]
                    [#if key?starts_with(prefix)]
                        [#if removePrefix]
                            [#assign newKey=prepend+key[prefix?length..]]
                        [/#if]
                        [#assign keyAllowed=true]
                    [/#if]
                [/#if]
            [#else]
                [#assign keyAllowed=true]
            [/#if]
            [#if !keyAllowed]
                [#continue]
            [/#if]
            [#if keyAllowed && !excludes?seq_contains(key)]
                [#if value?is_boolean || value?is_number]
                    [#assign newValue=value?c]
                [#elseif value?is_string]
                    [#if value?starts_with("$") && value?ends_with("}") && value?index_of("{")>0 ]
                        [#assign propertyPrefix=value[1..value?index_of("{")-1]]
                        [#assign propertyName=value[value?index_of("{")+1..value?length-2]]
                        [#assign newValue="{{" + propertyPrefix + ":" + propertyName + "}}"]
                    [#else]
                        [#assign newValue=value]
                    [/#if]
                [#else]
                    [#assign newValue=""]
                [/#if]
                [#if newValue?length>0]
                    [#assign resultProperties]
[=resultProperties]
[=newKey]=[=newValue][/#assign]
                [/#if]
            [/#if]
        [/#list]
    [/#if]

    [#return resultProperties]
[/#function]
