How can i use CQL Filter [attr IN List ]? - cql

I am trying to use the In filter of CQL on my query as cited on the documentation but it is not working and the parsing error I'm getting says there is no IN filter in CQL :
org.geotools.filter.text.cql2.CQLException: Encountered "IS IN" at line 1, column 15.
Was expecting one of:
"(" ...
":" ...
<IDENTIFIER> ...
"." ...
<NOT> ...
"like" ...
"is" "null" ...
"is" <NOT> ...
"exists" ...
"does-not-exist" ...
"tequals" ...
"before" ...
"after" ...
"during" ...
"between" ...
<EQ> ...
<GT> ...
<LT> ...
<GTE> ...
<LTE> ...
<NEQ> ...
Parsing : point_type_id IS IN ('1','2','3').
is there any fix to this error or i will use multiple filter and combine them with OR ??

You are attempting to parse IS IN which is invalid - try just point_type_id IN ('1','2','3').

Related

Grok filter Pattern -Unable to get required values from Square bracket

Part of log sample entry given below
[\"request_type\", \"post\"], [\"status_code\", 404], [\"u_id\", 111111]
Need to get the values list post,404,111111 using grok, worked for below example
[\"user_id\", 111111] => %{GREEDYDATA:A}, %{WORD:U_ID}\] gives output as
"A": [
[
"[\\"user_id\\""
]
],
"U_ID": [
[
"111111"
]
]}
"
When trying to keep "user_id" and extract it's value using filter "
[\"user_id\", %{WORD:U_ID}\]
getting compile error or {}
Please let me know where the error or any thing missing filter pattern.
Here is the grok pattern that matches your log:
%{GREEDYDATA:no_use}%{POSINT:status_code}\]%{GREEDYDATA:no_use} %{POSINT:UID}\]
I have used the Grok Debugger to validate the grok pattern.
Output:

Calling a method with parameters on managed bean with EL in XPages

I have a managed bean with I can call via SSJS in the following way:
xptI18NBean.getValue("customer.cardNumber")
However I would like to use EL instead but I do not manage to find the EL equivalent.
I tried
${xptI18NBean.value(customer.cardNumber)}
But then I get the error message:
xptI18NBean.value(customer.cardNumber)
Påträffade "(", en av ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "", "/", "div", "%", "mod", "and", "&&", "or", "||", "?"] förväntades
Encountered "(" at line 1, column 20. Was expecting one of: "}" ... "." ... ">" ... "gt" ... "<" ... "lt" ... "==" ... "eq" ... "<=" ... "le" ... ">=" ... "ge" ... "!=" ... "ne" ... "[" ... "+" ... "-" ... "" ... "/" ... "div" ... "%" ... "mod" ... "and" ... "&&" ... "or" ... "||" ... "?" ...
What am I doing wrong?
The direct answer is that the version of EL that XPages uses doesn't support method parameters.
That said, the sort of bean you have there seems like it either already implements DataObject or is a prime candidate to do so. If the bean implements DataObject, you could do ${xptI18NBean['customer.cardNumber']}, which would then resolve to be the same call as in SSJS there.
Additionally, the XPages Jakarta EE project includes an opt-in ability to use EL 3, which does support method parameters.

Grok Parsing Failure in logstash with Pattern That Includes Square Brackets

I have a log pattern where every log element is enclosed in square brackets. I can't control the original log. I just want the grok parsing to ignore the brackets and only interpret what's between them. Based on something close to the following line:
2019-04-04 13.23.57.057 [52] [77] [MEASURE] [XYZService]
, I want the pattern to see the 52 as a threadId. I have the following code:
if [message] =~ "MEASURE" {
grok {
match => { " message" => "%{TIMESTAMP_ISO8601:logtime} [%{NUMBER:threadId}] %{GREEDYDATA:restofmessage}" }
}
}
else {
drop()
}
In this state, I get a grokparsefailure when logstash attempts to interpret the line. I am certain its only related to the bracketed portion, because when I remove that pattern, every works fine. I would be grateful for any ideas what I am doing wrong. Thanks
nevermind. I got it to work by escaping the brackets like this: \ [ %{NUMBER:threadId}
\ ]

JSF managed bean does not display [duplicate]

The below JSF snippet:
<p:dataTable value="#{userbean.getAll()}" var="user">
Throws this exception:
Encountered "(" at line 1, column 18. Was expecting one of: "}" ... "." ... "[" ... ">" ... "gt" ... "<" ... "lt" ... ">=" ... "ge" ... "<=" ... "le" ... "==" ... "eq" ... "!=" ... "ne" ... "&&" ... "and" ... "||" ... "or" ... "*" ... "+" ... "-" ... "/" ... "div" ... "%" ... "mod" ...
org.apache.el.parser.ParseException: Encountered "(" at line 1, column 18. Was expecting one of:
"}" ...
"." ...
"[" ...
">" ...
"gt" ...
"<" ...
"lt" ...
">=" ...
"ge" ...
"<=" ...
"le" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"&&" ...
"and" ...
"||" ...
"or" ...
"*" ...
"+" ...
"-" ...
"/" ...
"div" ...
"%" ...
"mod" ...
at org.apache.el.parser.ELParser.generateParseException(ELParser.java:2142)
at org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2024)
at org.apache.el.parser.ELParser.DeferredExpression(ELParser.java:113)
at org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:40)
at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:93)
at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:150)
at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:194)
at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
at com.sun.faces.facelets.el.ELText$ELTextVariable.apply(ELText.java:203)
at com.sun.faces.facelets.compiler.AttributeInstruction.apply(AttributeInstruction.java:101)
at com.sun.faces.facelets.compiler.UIInstructionHandler.apply(UIInstructionHandler.java:141)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:196)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
How is this caused and how can I solve it?
That can happen if your environment doesn't support EL 2.2. Invoking direct methods with parentheses/arguments like this
value="#{userbean.getAll()}"
is only supported since EL 2.2, which goes hand in hand with Servlet 3.0. If you're getting this exception, then that can only mean that you're not deploying to a Servlet 3.0 compatible container, or that your webapp's web.xml is not declared conform Servlet 3.0, or that your webapp's /WEB-INF/lib is littered with arbitrarily downloaded servletcontainer-specific JAR files originating from a completely different servletcontainer make/version which doesn't comply EL 2.2.
There are basically 2 solutions:
Use EL 2.1 compatible syntax, this works on Servlet 2.5 compatible containers:
value="#{userbean.all}"
Upgrade to a Servlet 3.0 compatible container (Tomcat 7, Glassfish 3, JBoss AS 6, etc), or fix your web.xml to comply Servlet 3.0.
You should also make absolutely sure that your webapp's /WEB-INF/lib does not contain any servletcontainer-specific libraries such as el-api.jar and friends (see also this related question).
Please note that this is not a JSF problem at all. You got an exception from javax.el/org.apache.el package, not from javax.faces/com.sun.faces package. This means that it's an EL problem. It's basically saying that your EL syntax is wrong. It encountered an ( where it didn't expect that. The expected characters/operators are clearly listed thereafter.
See also:
Invoke direct methods or methods with arguments / variables / parameters in EL
How to call a method with a parameter in JSF
Our EL wiki page

ELException when parsing a conditional expression in the style property of h:inputText

I'm having a problem with one of my custom JSF components. My component is called inputTextCustom.
In one of the pages that uses this custom component, I have :
<s:inputTextCustom length="400px"/>
And within my custom component's definition, I use a h:inputText as follows:
<ui:composition>
....
....
<h:inputText style="width:#{empty length ? 500px : length}" />
....
....
</ui:composition>
But, I get the following exception:
javax.el.ELException: Error Parsing: width:#{empty length ? 500px : length}
at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:125)
at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:150)
at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:194)
at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
at com.sun.facelets.tag.TagAttribute.getValueExpression(TagAttribute.java:256)
... 119 more
Caused by: org.apache.el.parser.ParseException: Encountered " "?" "? "" at line 1, column 22.
Was expecting one of:
"}" ...
"." ...
"[" ...
">" ...
"gt" ...
"<" ...
"lt" ...
">=" ...
"ge" ...
"<=" ...
"le" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"&&" ...
"and" ...
"||" ...
"or" ...
"*" ...
"+" ...
"-" ...
"/" ...
"div" ...
"%" ...
"mod" ...
at org.apache.el.parser.ELParser.generateParseException(ELParser.java:2142)
at org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2024)
at org.apache.el.parser.ELParser.DeferredExpression(ELParser.java:113)
at org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:40)
at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:93)
... 123 more
Could someone tell me what I'm doing wrong here?
Thanks in advance!
When you want to represent string values in EL, you need to explicitly quote them.
<h:inputText style="width:#{empty length ? '500px' : length}" />
Double quotes are also syntactically valid, but that usually doesn't mix very well with the syntax highlighter of the average editor (also not of the one here on SO) when the expression is inlined in a tag attribute value which is by itself enclosed in double quotes.
<h:inputText style="width:#{empty length ? "500px" : length}" />

Resources