#960 haystackInvokeAction issue with enums

Ricky Villa Mon 29 Nov 2021

I can get the haystackInvokeAction to work with number,bool, and strings types, but not enums. Not sure if it is a syntax issue or a bug on the nhaystack side not handling it correctly.

**Request:**
haystackInvokeAction(@p:demo:r:29184cc3-47cb6fec, "C.Equips.Vav01.STATUS".parseRef, "override", {value: "OCCUPIED", duration: 10min})

**Response:**
haystack::CallErr: java.lang.ClassCastException: javax.baja.sys.BString cannot be cast to javax.baja.sys.BDynamicEnum
=== Remote Trace ===
java.lang.ClassCastException: javax.baja.sys.BString cannot be cast to javax.baja.sys.BDynamicEnum
  at auto.javax_baja_control_util_BEnumOverride.s(AutoGenerated)
  at com.tridium.sys.schema.ComplexSlotMap.set(ComplexSlotMap.java:849)
  at javax.baja.sys.BComplex.set(BComplex.java:650)
  at javax.baja.sys.BComplex.set(BComplex.java:655)
  at javax.baja.sys.BComplex.set(BComplex.java:690)
  at nhaystack.util.TypeUtil.actionArgsToBaja(TypeUtil.java:151)
  at nhaystack.server.NHServer.onInvokeAction(NHServer.java:449)
  at org.projecthaystack.server.HServer.invokeAction(HServer.java:404)
  at org.projecthaystack.server.InvokeActionOp.onService(HStdOps.java:353)
  at org.projecthaystack.server.HOp.onService(HOp.java:48)
  at org.projecthaystack.server.HServlet.onService(HServlet.java:90)
  at org.projecthaystack.server.HServlet.doPost(HServlet.java:53)
  at nhaystack.server.BNHaystackServlet.doPost(BNHaystackServlet.java:93)
  at javax.baja.web.BWebServlet.service(BWebServlet.java:134)
  at com.tridium.web.WebProcess.serviceWebServlet(WebProcess.java:531)
  at com.tridium.web.WebProcess.service(WebProcess.java:125)
  at com.tridium.web.SysServlet.service(SysServlet.java:114)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:805)
  at com.tridium.httpd.ServiceThread.handleRequest(ServiceThread.java:356)
  at com.tridium.httpd.ServiceThread.run(ServiceThread.java:109)

=== Fantom Trace ===
haystack::CallErr: java.lang.ClassCastException: javax.baja.sys.BString cannot be cast to javax.baja.sys.BDynamicEnum
  concurrent::ActorFuture.get (ActorFuture.java:108)
  haystackExt::CascadingFuture.get (HaystackActor.fan:43)
  haystackExt::HaystackActor.sendSync (HaystackActor.fan:22)
  haystackExt::HaystackLib.toResult (HaystackLib.fan:356)
  haystackExt::HaystackLib.haystackInvokeAction (HaystackLib.fan:243)
  java.lang.reflect.Method.invoke (Method.java:498)
  fan.sys.Method.invoke (Method.java:573)
  fan.sys.Method$MethodFunc.callList (Method.java:212)
  fan.sys.Method.callList (Method.java:138)
  axon::FantomFn.doCall (FantomFn.fan:140)
  axon::AxonContext.callInNewFrame (AxonContext.fan:152)
  axon::AxonContext.callInNewFrame (AxonContext.fan)
  axon::FantomFn.callx (FantomFn.fan:128)
  axon::Fn.callLazy (Fn.fan:75)
  axon::Call.eval (Call.fan:39)
  finStackHost::FinHostLib.secureEval (FinHostMod.fan:668)
  java.lang.reflect.Method.invoke (Method.java:498)
  fan.sys.Method.invoke (Method.java:573)
  fan.sys.Method$MethodFunc.callList (Method.java:212)
  fan.sys.Method.callList (Method.java:138)
  axon::FantomFn.doCall (FantomFn.fan:140)
  axon::AxonContext.callInNewFrame (AxonContext.fan:152)
  axon::AxonContext.callInNewFrame (AxonContext.fan)
  axon::FantomFn.callx (FantomFn.fan:128)
  axon::LazyFantomFn.callLazy (FantomFn.fan:176)
  22 More...
  haystack::CallErr: java.lang.ClassCastException: javax.baja.sys.BString cannot be cast to javax.baja.sys.BDynamicEnum
    haystackExt::HaystackClient.call (HaystackClient.fan:102)
    haystackExt::HaystackClient.doCallFn (HaystackClient.fan:131)
    fan.sys.Func$Indirect0.call (Func.java:128)
    concurrent::Actor.receive (Actor.java:102)
    concurrent::Actor._dispatch (Actor.java:274)
    concurrent::Actor._work (Actor.java:229)
    concurrent::ThreadPool$Worker.run (ThreadPool.java:273)

Login or Signup to reply.