Hi
We have a script developped in XWiki which does not function anymore?
Probably due to migration or rights...
My problem is that the script is developed by a IT partner 3 years ago, in XWiki 1.6
THere is a button in a screen showing a overview of pages with a button to create a new
page.
This button has the following link;
http://www.cdlsworld.org/xwiki/bin/inline/CdlsatdPrivate/DjennaKoekkoek3_do…
?Parent=CdlsatdPrivate.WebHome
&template=CdlsatdCode.CdLS_ATD_UserQuestionsClassTemplate
&name=Djenna
&status=opt_un_answered
&generalize=No
&cdls=DjennaKoekkoek3_doc105
The errorcode is not helping me much...
Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with id
[xwiki:CdlsatdPrivate.DjennaKoekkoek3_doc105]
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:205)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:161)
at
org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:118)
... 87 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method
'get' in class java.util.Collections$EmptyList threw exception
java.lang.IndexOutOfBoundsException: Index: 0 at
xwiki:CdlsatdPrivate.DjennaKoekkoek3_doc105[line 124, column 32]
at
org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493)
at org.apache.velocity.runtime.parser.node.ASTMathNode.value(ASTMathNode.java:84)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
at
org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:196)
... 89 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0
at java.util.Collections$EmptyList.get(Collections.java:2970)
at sun.reflect.GeneratedMethodAccessor11070.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
The code around Line 12 (How should I find the linenumber; should I include with counting
the comments lines or only the lines with code?)
## This sheet will display and edit a Private Question
##
## Test the language to display the information
#if($request.language)
#set($lang=$request.language)
#else
#set($lang=$context.language)
#end
$lang {{html}}<br/>{{/html}}
## Build a list of possible status the question can have to populate dropdown
## dependant on the language it will take the list from CdlsatdCode.Translations
## the key values of list should, off course, not be translated
##
dd_status_question_v1=opt_un_answered,opt_answered,opt_in_progress,opt_more_info_required
##
## First get the translated meanings
#set($engList = $msg.get('dd_status_user_questions_en'))
#set($engStatusList=[])
#foreach( $op in $engList.split("[|,]"))
#set($temp2 = $engStatusList.add($op))
#end
$engStatusList {{html}}<br/>{{/html}}
## Second get the list codes
#set($questionStatusComma = $msg.get('dd_status_question_v1'))
#set($statusList=[])
#foreach($keyStatusTxt in $questionStatusComma.split("[|,]"))
#set($temp3 = $statusList.add($keyStatusTxt))
#end
$statusList {{html}}<br/>{{/html}}
##
## The privat question is a object of class CdlsatdCode.CdLS_ATD_UserQuestionsClass
#set($userQuestionObj =
$doc.getObject("CdlsatdCode.CdLS_ATD_UserQuestionsClass"))
## Get the staus of the question
#set($userQnStatus = $userQuestionObj.getProperty('status').getValue())
##
## Evaluate the creation of a new question (or a modification)
#if($request.getParameter('success') == 'true')
## We have a slightly disturbing Rights implementation
## User is a client
## If you are not in User you are considered a Moderator (or question support person)
## But also these people should be allowed to post questions, currently they are not!
## better implementation would be; All approped people should be in User, some have
extra rights like Moderator or Global moderator
#if($xwiki.getUser().isUserInGroup("XWiki.User"))
{{info}}{{html
clean="false"}}$msg.get('msg_success_question_posted'){{/html}}{{/info}}
#else
{{info}}{{html
clean="false"}}$msg.get('msg_success'){{/html}}{{/info}}
#end
#end
It looks like it find an empty object...
This is exactly what I find, it looks like the code is creating a page with a empty
object,
but it fails to set values in the object, and after that I understand the error,
What I do not inderstand where the code is that would set the values in the object, I
would expect it in the Template?
But maybe it is hidden in the code on the page where the button is in the Form-area
So maybe I should ask the question how I would do this in the new XWiki 2.7 (which we are
running) If I should start all new
I would like to create a page with an object of which a few attributes are hidden from the
user (containing some ID and status information)
After the click the user should experience that he is on the newly created page and
filling in the remaining attributes of the object (a Question and Answer)
Second, since the intention of the page/object is to start a workflow; 1) Create a
Question by a user (this step) -> 2) Accepting the Question by a moderator by status
change-> 4) Moderator answering the question by typing a answer-> User accepting the
answer and closing the case by changing the status
What is the best practise to put the code for each step in the workflow? At this moment
all the code is in the templatesheet of the page, making it difficult to maintain and look
for the code
Would you advise to put the code in the template or put code in velocity macro's and
have buttons in the sheet
Help would be very much appreciated, both on finding the cause of the error and on advise
what is the best practise to do such USE-Case