Hi,
So I am trying to use this function in a user macro I am creating:
getContentInSpaceForAllLabels(int offset, int maxResults, String spaceKey, Label... labels)
(function doc page)
Problem is the part that says "Label... labels". The labels need to be added as separate variables it seems because I have not been able to get to work any other way. Right now I have the function working by using it like this:
#set($pages=$action.labelManager.getContentInSpaceForAllLabels(0, 99, "Spacekey", $label1, $label2, $label3))
This works fine if I know there will always be 3 labels but the problem is I don't know this until run time. I may need to add 2 labels or 6 labels to this function.
Anyone know of a simple way to configure this to work with a dynamic set of labels?
Community moderators have prevented the ability to post new answers.
it's a simple java question, lmg.rtfm.fy
http://docs.oracle.com/javase/6/docs/technotes/guides/language/varargs.html
just syntactic sugar Label... labels
is exactly the same as Label[] labels
so your answer is: just pass an array at runtime
Hi, I tried that before and it doesn't seem to work. This is what I tried: #set($labellist= ["a", "b", "c"]) #set($pages=$action.labelManager.getContentInSpaceForAllLabels(0, 99, "Spacekey", $labellist)) When I revert it back to - #set($pages=$action.labelManager.getContentInSpaceForAllLabels(0, 99, "Spacekey", $label1, $label2, $label3)) - it works fine again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I should also mentioned I tried making an array of labels but that just seemed to blow up confluence: #set($label1=$labelmanager.getLabel("a")) #set($label2=$labelmanager.getLabel("b")) #set($label3=$labelmanager.getLabel("c")) #set($labellist= [$label1, $label2, $label3]) #set($pages=$action.labelManager.getContentInSpaceForAllLabels(0, 99, "Spacekey", $labellist))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.