You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mananjani <ma...@gmail.com> on 2013/08/04 13:58:28 UTC

How to escape {{ and }} in a property's content

Hi,

We are using hybris e-commerce platform, which has its own flexible search
query language. It uses {{ as prefix and }} as suffix for a subquery.

We want to fire such a query using camel spring dsl, but it's trying to
evaluate the content within {{ and }} as a property. Here's our
configuration...

<camel:route>
	<camel:from uri="direct:processProducts"/>
	<camel:log message="${header.fromRow} -
${property[googleProductExport.batchSize]}"></camel:log>
	<camel:setBody>
		<camel:constant>
			select {p.pk}, {p.code}, 
			( {{ select group_concat({pr.price} separator ', ') from {PriceRow AS pr}
where {pr.product}={p.pk} }} ) AS prices, 
			group_concat({cat.code} separator ', ') AS categories 
			FROM {Product AS p 
			JOIN CatalogVersion AS cv ON {cv.PK}={p.catalogVersion} 
			JOIN Catalog AS c ON {c.PK}={cv.catalog} 
			JOIN CategoryProductRelation AS r on {r.target}={p.pk} 
			JOIN Category AS cat on {cat.pk}={r.source}} 
			WHERE {p.variantType} IS NULL 
			AND {p.code} IS NOT NULL 
			AND {p.name} IS NOT NULL 
			AND {c.id} = 'clothescatalog' 
			AND {cv.version} = 'Online' 
			group by {p.pk}
			LIMIT ${in.headers.fromRow}, ${googleProductExport.batchSize}
		</camel:constant>
	</camel:setBody>
	<camel:to uri="jdbc:hybrisDataSource" />
	<camel:log message="${in.body}"></camel:log>
</camel:route>

Can someone please let me know how to escape them?

Thanks
Manan



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-escape-and-in-a-property-s-content-tp5736742.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to escape {{ and }} in a property's content

Posted by mananjani <ma...@gmail.com>.
Hi Willem,

Thanks for your prompt response. Works like a charm.

Also, I found that following is a bit convenient...

<propertyPlaceholder id="properties"
                            
location="classpath:META-INF/spring/camel.properties" 
                             xmlns="http://camel.apache.org/schema/spring"
prefixToken="[[" suffixToken="]]"/>

Regards
Manan



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-escape-and-in-a-property-s-content-tp5736742p5736751.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to escape {{ and }} in a property's content

Posted by Willem jiang <wi...@gmail.com>.
Hi,

You can set another prefix and SuffixToken on your custom property component, just like this

<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
<property name="prefixToken" value="(("/>
<property name="suffixToken" value="))"/>
</bean>  


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Sunday, August 4, 2013 at 7:58 PM, mananjani wrote:

> Hi,
>  
> We are using hybris e-commerce platform, which has its own flexible search
> query language. It uses {{ as prefix and }} as suffix for a subquery.
>  
> We want to fire such a query using camel spring dsl, but it's trying to
> evaluate the content within {{ and }} as a property. Here's our
> configuration...
>  
> <camel:route>
> <camel:from uri="direct:processProducts"/>
> <camel:log message="${header.fromRow} -
> ${property[googleProductExport.batchSize]}"></camel:log>
> <camel:setBody>
> <camel:constant>
> select {p.pk (http://p.pk)}, {p.code},  
> ( {{ select group_concat({pr.price} separator ', ') from {PriceRow AS pr}
> where {pr.product}={p.pk (http://p.pk)} }} ) AS prices,  
> group_concat({cat.code} separator ', ') AS categories  
> FROM {Product AS p  
> JOIN CatalogVersion AS cv ON {cv.PK}={p.catalogVersion}  
> JOIN Catalog AS c ON {c.PK}={cv.catalog}  
> JOIN CategoryProductRelation AS r on {r.target}={p.pk (http://p.pk)}  
> JOIN Category AS cat on {cat.pk (http://cat.pk)}={r.source}}  
> WHERE {p.variantType} IS NULL  
> AND {p.code} IS NOT NULL  
> AND {p.name (http://p.name)} IS NOT NULL  
> AND {c.id} = 'clothescatalog'  
> AND {cv.version} = 'Online'  
> group by {p.pk (http://p.pk)}
> LIMIT ${in.headers.fromRow}, ${googleProductExport.batchSize}
> </camel:constant>
> </camel:setBody>
> <camel:to uri="jdbc:hybrisDataSource" />
> <camel:log message="${in.body}"></camel:log>
> </camel:route>
>  
> Can someone please let me know how to escape them?
>  
> Thanks
> Manan
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-escape-and-in-a-property-s-content-tp5736742.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).