Writer section protection through password in JAVA?

Have anyone worked on protecting section(s) by applying password in libre writer through JAVA?
I have recorded macro but macro doesn’t capture password instead it gives me below line:

dispatcher.executeDispatch(document, “.uno:EditCurrentRegion”, “”, 0, Array())

I am unable to translate this Array() i.e. how can i provide password in macro for each section in libre writer document? P.S. if anyone has JAVA code for section protection via same/different password(s) for all section(s) of libre writer document that will be grateful.