0

我无法创建条件类型为“booleanCondition”的 Unomi 规则。当我选择“OR”运算符并尝试创建新规则时,我有IllegalArgumentException(下面的堆栈跟踪)。但是,如果选择“AND”运算符,在同一规则中我没有错误,并且该规则按我的需要工作。

示例规则如下:

"itemId": "test-rule",
  "itemType": "rule",
  "version": 1,
 "condition": {
   "parameterValues": {
   "subConditions": [ 
    {
      "type": "eventTypeCondition",
      "parameterValues": {
        "eventTypeId": "view"
      }
    },
    {
     "type": "profilePropertyCondition",
      "parameterValues": {
        "propertyName": "properties.nbOfVisits",
        "comparisonOperator": "greaterThan",
        "propertyValueInteger" : 1
      }
    },
    {
     "type": "profilePropertyCondition",
      "parameterValues": {
        "propertyName": "properties.someTestProperty",
        "comparisonOperator": "equals",
        "propertyValue" : "Test value"
      }
    }
   ],
   "operator" : "or"
 },
 "type": "booleanCondition"},
"actions": [
    {
    "parameterValues": {
        "setPropertyName": "test name",
        "setPropertyValue": "test value",
        "storeInSession": true
                },
      "type": "setPropertyAction"
    }

  ],
  "linkedItems": null,
  "raiseEventOnlyOnceForProfile": false,
  "raiseEventOnlyOnceForSession": false,
  "raiseEventOnlyOnce": false,
  "priority": 1,
  "metadata": {
    "id": "test-rule",
    "name": "test-rule",
    "description": "test rule",
    "scope": "systemscope",
    "tags": [],
    "systemTags": [ ],
    "enabled": true,
    "missingPlugins": false,
    "hidden": false,
    "readOnly": false
  }

堆栈跟踪错误:

java.lang.IllegalArgumentException
  at org.apache.unomi.services.impl.definitions.DefinitionsServiceImpl.extractConditionBySystemTag(DefinitionsServiceImpl.java:509)
  at org.apache.unomi.services.impl.rules.RulesServiceImpl.setRule(RulesServiceImpl.java:360)
  at Proxy8201644d_3a75_4301_b38d_53e8230320d6.setRule(Unknown Source)
  at org.apache.unomi.rest.RulesServiceEndPoint.setRule(RulesServiceEndPoint.java:81)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
  at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
  at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201)
  at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104)
  at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
  at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
  at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
  at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
  at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
  at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
  at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
  at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
  at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216)
  at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
  at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
  at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276)
  at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:760)
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)
  at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226)
  at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
  at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
  at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
  at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
  at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
  at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1592)
  at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
  at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1296)
  at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:298)
  at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
  at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
  at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
  at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1211)
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

我还尝试研究 Unomi 存储库中的源代码,发现一些奇怪的方法导致了这个异常......为什么它会这样工作?

截图 unomi 方法在这里

4

0 回答 0