Hi,
I suffered to find hql query to use $xwiki.activitystream.method but if I use where condition on eventid field I obtain this error :-(
Caused by: org.hibernate.QueryException: could not resolve property: EventId of: com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl [select act from com.xpn.xwiki.plugin.activitystream.impl.ActivityEventImpl as act where act.EventId='757328280-1453216488000-dishFheu' order by act.date desc]
at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:81)
>
> > >
> > Did you try using
> > >
> searchEvents and building an HQL that
> >
> >
> >
> Anyway I found table and field to use an hql query here:
> > http://platform.xwiki.org/xwiki/bin/view/DevGuide/DatabaseSchema
> (I must use a ggogle glass+zoom to see field ;-) )
> > but my query with
> $services.query.hql($hql).execute() doesn't work with
> table name (rg.hibernate.hql.ast.QuerySyntaxException:
> activitystream_events is not mapped ).
> >
> Then I tested with simple query:
> > SELECT
> doc.XWD_TITLE FROM xwikidoc AS doc WHERE doc.XWD_FULLNAME =
> 'Main.WebHome'
> > didn't work
> => Caused by: org.hibernate.hql.ast.QuerySyntaxException:
> xwikidoc is not mapped [select doc.XWD_TITLE FROM xwikidoc
> AS doc WHERE doc.XWD_FULLNAME = 'Main.WebHome']
> > SELECT doc.title FROM XWikiDocument AS doc
> WHERE doc.fullName = 'Main.WebHome'
> > working fine
> > With
> velocity+API we can not use hql query with true field/table
> name?
> > If we can not then where I can
> found field/table mapping name for activitystream_events
> table?
> >
> > Thxs
>
> _______________________________________________
> users mailing list
> users(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
--- En date de : Mar 19.1.16, vincent(a)massol.net <vincent(a)massol.net> a écrit :
> De: vincent(a)massol.net <vincent(a)massol.net>
> Objet: Re: [xwiki-users] Fw : Re: How can I get event object through a form
> À: "XWiki Users" <users(a)xwiki.org>
> Date: Mardi 19 janvier 2016, 8h09
> Also note that the AS has
> a buitin feature to delete old events, see your xwiki.cfg
> file:
>
....
> xwiki.plugin.activitystream.daystokeepevents=0
Yes I know that and delete some event with API :-)
My problem is the way to give some selected event object through a form with $request.getParameterValues() to delete these events.
>
> If you still need to delete
> event manually you could check the code executed by the
> scheduler job.
I didn't found it either Scheduler.ActivityStreamCleaner is empty and anyway I suppose it is groovy code (look into xar source if needed).
> > Did you try using
> searchEvents and building an HQL that
> >
Anyway I found table and field to use an hql query here:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/DatabaseSchema (I must use a ggogle glass+zoom to see field ;-) )
but my query with $services.query.hql($hql).execute() doesn't work with table name (rg.hibernate.hql.ast.QuerySyntaxException: activitystream_events is not mapped ).
Then I tested with simple query:
SELECT doc.XWD_TITLE FROM xwikidoc AS doc WHERE doc.XWD_FULLNAME = 'Main.WebHome'
didn't work => Caused by: org.hibernate.hql.ast.QuerySyntaxException: xwikidoc is not mapped [select doc.XWD_TITLE FROM xwikidoc AS doc WHERE doc.XWD_FULLNAME = 'Main.WebHome']
SELECT doc.title FROM XWikiDocument AS doc WHERE doc.fullName = 'Main.WebHome'
working fine
With velocity+API we can not use hql query with true field/table name?
If we can not then where I can found field/table mapping name for activitystream_events table?
Thxs
>
> Did you try using searchEvents and building an HQL that
> retrieves the Event object with the given IDs? Then, once
> you get the Event objects, you can use
> deleteActivityEvent on each of them.
That is what I was affraid of ... hql query. I though there was a simplier way like xcontext stuff or convert id in event object ;-)
Thxs I will give a try (must found id field and table)
>
> I try to make an Admin form to delete some event from
> activity stream.
>
> I manage:
>
> - to list events in a checkbox list
>
> - to delete an event
>
> #foreach ($MonEvent in
> $xwiki.activitystream.getEventsForUser($MyUserr, false, 300,
> 0))
>
> #if
> ($MonEvent.getPage()=='MySpace.MyPage')
>
> * event deletion
>
>
> $xwiki.activitystream.deleteActivityEvent($MonEvent)
>
> #end
>
> #end
>
> - but I didn't manage to pass an event id/object with
> form to my deleteActivityEvent method :-(
>
>
>
> It doesn't work because when I get my event through
> $request.getParameterValues('IdEntry'), event ID is
> transformed in text and is not event object anymore.
>
>
>
> I use velocity with xwiki 7.0.1 and my page contains this
> code:
>
>
>
> **********************************
>
> {{velocity}}
>
> {{html}}
>
> ## My form to select events to delete
>
> <form method="get"
> id="DelActivityStream" onsubmit="return
> confirm('Are you sure?')">
>
> <div class="container">
>
> #foreach ($MonEvent in
> $xwiki.activitystream.getEvents(false, 200, 0 ))
>
> ##1. AAA $MonEvent - $MonEvent.getPage()
>
> #set($MycheckBox="<input
> type='checkbox' name='IdEntry'
> value='")
>
> #set($MycheckBox=$MycheckBox +
> "$MonEvent")
>
> #set($MycheckBox=$MycheckBox + "'/>"
> + "$MonEvent.getPage() - $MonEvent.getDisplayDate() -
> $MonEvent.getType() - $MonEvent.getPriority() -
> $MonEvent.getUser() - $MonEvent.getEventId() -
> $MonEvent.getEvent() " + "<br />")
>
> $MycheckBox
>
> #end
>
> ## <input type="checkbox"
> name="IdEntry"
> value="${doc.fullName}"/> This is checkbox
> <br />
>
> </div>
>
> <span
> class="buttonwrapper"><input
> type="submit" value="Supprimer les entrées
> du flux d'activité"
> class="button"/></span>
>
> </form>
>
> {{/html}}
>
>
>
> ## get select events ID
>
> $request.getParameterValues('IdEntry')
>
>
>
> ## i want to delete these ID
>
> #foreach ($MyValue in
> $request.getParameterValues('IdEntry'))
>
> * try to delete this event with ID: $MyValue
> $MyValue.getPage()
>
> ## $MyValue.getPage() it doesn't work because
> $MyValue is not event anymore
>
> ## delete event method
>
> :-(
>
> #end
>
> **********************************
>
>
>
> To resume, do you have a way to give an event object to my
> deleteActivityEvent with form+velocity (because
> deleteActivityEvent accept only event object) ?
>
>
>
> Thxs
>
>
>
> Pascal B
>
> _______________________________________________
>
> users mailing list
>
> users(a)xwiki.org
>
> http://lists.xwiki.org/mailman/listinfo/users
>
>
>
Hi,
I try to make an Admin form to delete some event from activity stream.
I manage:
- to list events in a checkbox list
- to delete an event
#foreach ($MonEvent in $xwiki.activitystream.getEventsForUser($MyUserr, false, 300, 0))
#if ($MonEvent.getPage()=='MySpace.MyPage')
* event deletion
$xwiki.activitystream.deleteActivityEvent($MonEvent)
#end
#end
- but I didn't manage to pass an event id/object with form to my deleteActivityEvent method :-(
It doesn't work because when I get my event through $request.getParameterValues('IdEntry'), event ID is transformed in text and is not event object anymore.
I use velocity with xwiki 7.0.1 and my page contains this code:
**********************************
{{velocity}}
{{html}}
## My form to select events to delete
<form method="get" id="DelActivityStream" onsubmit="return confirm('Are you sure?')">
<div class="container">
#foreach ($MonEvent in $xwiki.activitystream.getEvents(false, 200, 0 ))
##1. AAA $MonEvent - $MonEvent.getPage()
#set($MycheckBox="<input type='checkbox' name='IdEntry' value='")
#set($MycheckBox=$MycheckBox + "$MonEvent")
#set($MycheckBox=$MycheckBox + "'/>" + "$MonEvent.getPage() - $MonEvent.getDisplayDate() - $MonEvent.getType() - $MonEvent.getPriority() - $MonEvent.getUser() - $MonEvent.getEventId() - $MonEvent.getEvent() " + "<br />")
$MycheckBox
#end
## <input type="checkbox" name="IdEntry" value="${doc.fullName}"/> This is checkbox <br />
</div>
<span class="buttonwrapper"><input type="submit" value="Supprimer les entrées du flux d'activité" class="button"/></span>
</form>
{{/html}}
## get select events ID
$request.getParameterValues('IdEntry')
## i want to delete these ID
#foreach ($MyValue in $request.getParameterValues('IdEntry'))
* try to delete this event with ID: $MyValue $MyValue.getPage()
## $MyValue.getPage() it doesn't work because $MyValue is not event anymore
## delete event method
:-(
#end
**********************************
To resume, do you have a way to give an event object to my deleteActivityEvent with form+velocity (because deleteActivityEvent accept only event object) ?
Thxs
Pascal B
When I try to execute the database to filesystem porter tool in xwiki 7.4, I
see the following error:
Failed to execute the [groovy] macro. Click on this message
for details.
Can anyone suggest how to resolve or work around this problem?
My environment is Debian jessie, Postgresql 9.4, WAR file running on tomcat8
and openjdk-7
The details are below.
org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Script
Macro for content [import com.xpn.xwiki.doc.XWikiAttachment;
import com.xpn.xwiki.doc.XWikiDocument;
import com.xpn.xwiki.doc.DeletedAttachment;
import org.xwiki.store.legacy.doc.internal.ListAttachmentArchive;
import com.xpn.xwiki.store.XWikiAttachmentStoreInterface;
import org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore;
import com.xpn.xwiki.store.AttachmentVersioningStore;
import org.xwiki.store.legacy.store.internal.XWikiHibernateTransaction;
import com.xpn.xwiki.store.AttachmentRecycleBinStore;
import com.xpn.xwiki.web.Utils;
import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.XWiki;
import com.xpn.xwiki.XWikiException;
import org.xwiki.store.filesystem.internal.FilesystemStoreTools;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.hibernate.ObjectNotFoundException;
private void printIntro(final XWiki wiki)
{
println("= Filesystem attachment storage porting script =");
println("== Step 1: Switch to Filesystem attachments. ==");
boolean ret = isFilesystemStore(wiki.getAttachmentStore()) \
&& isFilesystemStore(wiki.getAttachmentVersioningStore()) \
&& isFilesystemStore(wiki.getAttachmentRecycleBinStore());
println(getStoreLine(isFilesystemStore(wiki.getAttachmentStore()),
wiki.getAttachmentStore()));
println(getStoreLine(isFilesystemStore(wiki.getAttachmentVersioningStore()),
wiki.getAttachmentVersioningStore()));
println(getStoreLine(isFilesystemStore(wiki.getAttachmentRecycleBinStore()),
wiki.getAttachmentRecycleBinStore()));
if (!ret) {
println("Please edit your xwiki.cfg file by modifying "
+ "the attachment store lines to read as follows:");
println("xwiki.store.attachment.hint = file");
println("xwiki.store.attachment.versioning.hint = file");
println("xwiki.store.attachment.recyclebin.hint = file");
println("Also make sure they are not commented out.");
}
println("== Step 2: Add this directory to your backup routine. ==");
println("This is your storage directory, "
+ "when filesystem attachments are enabled you have to back this up
"
+ "as part of your data backup routine.\n");
println(Utils.getComponent(FilesystemStoreTools.class).storageDir.getAbsolutePath());
println("== Step 3: Copy attachments from database to filesystem. ==");
println("Now you are ready to copy the data over from your database to
the filesystem. "
+ "It is prudent to leave the attachments in the database since this
is still experimental "
+ "and in most situations the attachment data is not bothersome just
sitting in the "
+ "database. As such, this script contains no facility to delete
entries from the database.");
println("If anything goes wrong in this function, it will fail with an
error message, "
+ "you should get the stack trace (probably in the log file) and
keep it to "
+ "confuse and humiliate the developers with. No harm should be done
since this only loads "
+ "from the database and only saves to the filesystem.");
}
main();
private void main()
{
final XWikiContext xc = xcontext.getContext();
final XWiki wiki = xc.getWiki();
int startAt = 0;
int seconds = 20;
boolean dryRun = true;
boolean verbose = false;
boolean go = request.getMethod().equals("POST") &&
request.getParameter("doIt") != null;
boolean ajax = "plain".equals(request.getParameter("xpage"));
int endedAt = 0;
if (!ajax) {
this.printIntro(wiki);
}
if (go) {
startAt = Integer.parseInt(request.getParameter("startAt"));
seconds = Integer.parseInt(request.getParameter("seconds"));
dryRun = "on".equals(request.getParameter("dryRun"));
verbose = "on".equals(request.getParameter("verbose"));
endedAt = this.doIt(startAt, seconds, dryRun, verbose, ajax);
if (ajax) {
if (endedAt == -1) {
this.printFooter();
} else {
println("\n{{html clean=false}}<meta name='endedAt'
content='"
+ endedAt + "' />{{/html}}");
}
return;
}
}
this.printJs();
if (!go || endedAt > startAt) {
println("\n{{html clean=false}}");
println("<div id='javascriptSpace'></div>");
println("<form action='?time=" + System.nanoTime()
+ "#doItForm' id='doItForm' method='POST'>");
println("<input type='hidden' name='seconds' value='" + seconds + "'
/>");
println("<input type='hidden' id='startAt' name='startAt' value='" +
endedAt + "' />");
println("<dl>");
println("<dt><label for='dryRun'>Dry Run, don't save any
files.</label></dt>");
println("<dd><input type='checkbox' name='dryRun' checked='"
+ ((dryRun) ? "checked" : "") + "' /></dd>");
println("<dt><label for='verbose'>Verbose, show every
attachment.</label></dt>");
println("<dd><input type='checkbox' name='verbose' checked='"
+ ((verbose) ? "checked" : "") + "' /></dd>");
println("</dl>");
println("<input type='hidden' name='doIt' value='yes' />")
println("<input type='submit' name='start' value='"
+ ((endedAt > startAt) ? "Continue" : "Start") + "' />");
println("</form>");
println("")
println("{{/html}}\n");
return;
}
this.printFooter();
}
private void printFooter()
{
println("== Step 4: make sure everything is working. ==");
println("Check to make sure your attachments are still there, if an
attachment is broken, "
+ "it will appear to be there but on opening it will tell you the
attachment does not exist. "
+ "If something goes terribly wrong with filesystem attachments, you
may have your old "
+ "attachment system back simply by changing the lines in the
xwiki.cfg file and restarting "
+ "the container. HOWEVER: This will not preserve attachments which
were uploaded **after** "
+ "switching to filesystem attachments so as users edit the system
you will become "
+ "locked in to filesystem attachments unless a script is written to
do the "
+ "inverse of this one.");
println("Despite being experimental, the filesystem attachment storage
is quite stable and the "
+ "risk of actually losing something so that it is unrecoverable is
very remote.");
println("NOTE: This must be run seperately in each subwiki.");
println("\n\nEnjoy and give feedback.");
}
private static boolean isFilesystemStore(final Object store)
{
return store.getClass().getName().contains("Filesystem");
}
private static String getStoreLine(final boolean isFilesystem, final Object
store)
{
return "(%style='color:" + (isFilesystem ? "#080" : "#d00") + "'%)(((* "
+ store + ")))";
}
private void printJs()
{
println("""\n{{html}}{{/html}}""");
}
/**
* Port all attachments from the original form to filesystem attachment
store.
* Do one batch at a time so the user can see the progress and it won't time
out.
*
* @param startAt the index of the first job to do, 0 to start at the
beginning.
* @param seconds the number of seconds to run for before returning.
* @param dryRun don't save any files if this is true.
* @return the number of the first job which was not done. This can be
startAt in the next call.
* -1 if the operation is complete.
*/
private int doIt(int startAt, int seconds, boolean dryRun, boolean verbose,
boolean ajax)
{
final XWikiContext xc = this.xcontext.getContext();
final XWiki wiki = xc.getWiki();
final FilesystemAttachmentStore fileAttachStore =
Utils.getComponent(XWikiAttachmentStoreInterface.class, "file");
final XWikiAttachmentStoreInterface defAttachStore =
Utils.getComponent(XWikiAttachmentStoreInterface.class,
"hibernate");
final AttachmentVersioningStore defAttachmentVersioningStore =
Utils.getComponent(AttachmentVersioningStore.class, "hibernate");
int count = 0;
long stopTime = System.currentTimeMillis() + (1000 * seconds);
println("(%style='color:#00d'%)(((");
if (verbose && startAt == 0) {
println("\n== Attachments ==\n");
}
for (String docName : xwiki.searchDocuments("where 1=1")) {
if (count < startAt) {
count++;
continue;
} else if (stopTime < System.currentTimeMillis()) {
println(")))");
return count;
} else {
count++;
}
final XWikiDocument doc = xwiki.getDocument(docName).getDocument();
try {
final XWikiHibernateTransaction transaction = new
XWikiHibernateTransaction(xc);
if (verbose) {
println("* [[" + doc.getFullName() + "]]");
}
// This is the equivilant of doc.getAttachmentList() but there
is an issue which
// causes some attachments to be lost.
// jira.xwiki.org/browse/XWIKI-7936
def hql = "select att from XWikiAttachment att WHERE
att.docId=?";
for (XWikiAttachment attach : xwiki.search(hql, [doc.getId()]))
{
attach.setDoc(doc);
if (verbose) {
println("** [[attach:" + doc.getFullName() + "@" +
attach.getFilename() + "]]");
}
try {
fileAttachStore.loadAttachmentContent(attach, xc,
false);
continue;
} catch (XWikiException noAttachmentInFilesystem) {
// no such attachment, let's save it.
}
try {
try {
defAttachStore.loadAttachmentContent(attach, xc,
true);
} catch (XWikiException notInHibernate) {
final Throwable wrapped =
notInHibernate.getException();
if (wrapped && wrapped instanceof
ObjectNotFoundException) {
println("(%style='color:#c80'%)(((");
println("Unable to find this attachment
[[attach:" + attach.getFilename()
+ "@" + doc.getFullName() + "]] in the
database, "
+ "it may be the result of database
corruption from a failed "
+ "upload prior to the fixing of "
+
"[[jira.xwiki.org/browse/XWIKI-5055]]");
println("xwikiattachment_content.XWA_ID = " +
attach.getId());
println(")))");
}
}
defAttachmentVersioningStore.loadArchive(attach, xc,
true);
try {
// jira.xwiki.org/jira/browse/XWIKI-6199
attach.getAttachment_archive().getVersions();
} catch (NullPointerException e) {
attach.setAttachment_archive(new
ListAttachmentArchive([attach]));
}
// Setup the runnables to do the save but don't save
just yet.
fileAttachStore.getAttachmentContentSaveRunnable(attach,
false, xc)
.runIn(transaction);
} catch (Exception e) {
println("(%style='color:#d00'%)(((");
println("Error in [" + doc.getFullName() + ":" +
attach.getFilename() + "]"
+ e.getMessage());
println(ExceptionUtils.getStackTrace(e));
println(")))");
}
}
if (!dryRun) {
transaction.start();
}
} catch (Exception e) {
println("(%style='color:#d00'%)(((");
println("Failed to port attachments for document [" +
doc.getFullName() + "]");
println(e.getMessage());
println(ExceptionUtils.getStackTrace(e));
println(")))");
}
}
println(")))");
if (startAt < count) {
int attachCount =
xwiki.search("select count(at) from XWikiDocument as doc, "
+ "XWikiAttachment as at where at.docId =
doc.id").get(0).intValue();
println("**[" + attachCount + "] attachments.**");
}
// And now for the deleted attachments.
final AttachmentRecycleBinStore fileBin =
Utils.getComponent(AttachmentRecycleBinStore.class, "file");
final AttachmentRecycleBinStore defaultBin =
Utils.getComponent(AttachmentRecycleBinStore.class, "hibernate");
if (verbose && startAt < count) {
println("\n== Deleted Attachments ==\n");
}
List<Object[]> entries =
xwiki.search("select da.id, da.docName, da.filename, da.date from
DeletedAttachment as da");
if (verbose && entries.size() == 0) {
println("\nnone.");
}
int delAttachCount = 0;
for (Object[] o : entries) {
long delAttachId = o[0];
final String docName = o[1];
final String fileName = o[2];
final Date deleteDate = o[3];
delAttachCount++;
if (count < startAt) {
if (verbose && !ajax) {
println("* [[" + docName + "]] - " + fileName);
}
count++;
continue;
} else if (stopTime < System.currentTimeMillis()) {
return count;
}
count++;
try {
final DeletedAttachment delAttach =
defaultBin.getDeletedAttachment(delAttachId, xc, true);
// Can't use the transaction runnable here because
(non-filesystem)
// deleted attachments hold all content in memory so they have
to be
// handled one at a time.
final XWikiAttachment attach = delAttach.restoreAttachment(null,
xc);
try {
// jira.xwiki.org/jira/browse/XWIKI-6199
attach.getAttachment_archive().getVersions();
} catch (NullPointerException e) {
attach.setAttachment_archive(new
ListAttachmentArchive([attach]));
}
if (!dryRun) {
fileBin.saveToRecycleBin(attach,
delAttach.getDeleter(),
delAttach.getDate(),
xc,
false);
}
if (verbose) {
println("* [[" + docName + "]]");
println("** " + fileName + " - Deleted: " + deleteDate);
}
} catch (Exception e) {
println("(%style='color:#d00'%)(((");
println("* [[" + docName + "]] - " + fileName + " - Deleted: " +
deleteDate);
println(e.getMessage());
println(")))");
println(ExceptionUtils.getStackTrace(e));
}
}
println("\n**[" + delAttachCount + "] deleted attachments.**");
return -1;
}]
at
org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluateBlock(AbstractJSR223ScriptMacro.java:199)
at
org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluateBlock(AbstractJSR223ScriptMacro.java:60)
at
org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182)
at
org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58)
at
org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:269)
at
org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
at
org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:95)
at
org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:253)
at
org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:126)
at
org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:56)
at
org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:96)
at
org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:39)
at
org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:113)
at
org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:50)
at
org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:68)
at
org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:42)
at
com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1164)
at
com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1127)
at
com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1179)
at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:692)
at sun.reflect.GeneratedMethodAccessor562.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
at
org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
at
org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567)
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.ASTBlock.render(ASTBlock.java:72)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at
org.xwiki.velocity.introspection.TryCatchDirective.render(TryCatchDirective.java:72)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:256)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:725)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:626)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:604)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:570)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:556)
at
com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65)
at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1876)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1854)
at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:821)
at sun.reflect.GeneratedMethodAccessor226.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
at
org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
at
org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at
org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:216)
at
org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:311)
at
org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:256)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:725)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:626)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:604)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:570)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:556)
at
com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65)
at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1876)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1854)
at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:821)
at sun.reflect.GeneratedMethodAccessor226.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
at
org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
at
org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at
org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:216)
at
org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:311)
at
org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:256)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
at
org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:725)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:626)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:604)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:570)
at
com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:556)
at
com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65)
at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1876)
at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:180)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:431)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:184)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:115)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:127)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:66)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:137)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
at
org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2340)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.script.ScriptException:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
failed:
Script7.groovy: -1: Mixing private and public/protected methods of the same
name causes multimethods to be disabled and is forbidden to avoid surprising
behaviour. Renaming the private methods will solve the problem.
@ line -1, column -1.
Script7.groovy: 62: Mixing private and public/protected methods of the same
name causes multimethods to be disabled and is forbidden to avoid surprising
behaviour. Renaming the private methods will solve the problem.
@ line 62, column 1.
private void main()
^
2 errors
at
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:159)
at
org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.eval(AbstractJSR223ScriptMacro.java:340)
at
org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluateBlock(AbstractJSR223ScriptMacro.java:249)
at
org.xwiki.rendering.macro.script.AbstractJSR223ScriptMacro.evaluateBlock(AbstractJSR223ScriptMacro.java:194)
... 154 more
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed:
Script7.groovy: -1: Mixing private and public/protected methods of the same
name causes multimethods to be disabled and is forbidden to avoid surprising
behaviour. Renaming the private methods will solve the problem.
@ line -1, column -1.
Script7.groovy: 62: Mixing private and public/protected methods of the same
name causes multimethods to be disabled and is forbidden to avoid surprising
behaviour. Renaming the private methods will solve the problem.
@ line 62, column 1.
private void main()
^
2 errors
at
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at
org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1075)
at
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:212)
at
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngineImpl.java:374)
at
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:151)
... 157 more
--
View this message in context: http://xwiki.475771.n2.nabble.com/Admin-Tools-database-to-filesystem-porter…
Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi users,
I am writing because I have an object in my Java code to be represented in
XWiki. My idea is to create an XClass and a related style sheet, then I
would create a Base Object for each object to be represented with a wiki
page.
I need to update the wiki every time the data structure that I have in Java
is modified but I can't understand how to do what I've written above.
Thank you,
Giordano.
On 18 Jan 2016 at 11:15:44, Gerritjan Koekkoek (gerritjan@cdlsworld.org(mailto:gerritjan@cdlsworld.org)) wrote:
>
> Could I do this in the params:
>
>
> label=abc
>
>
> target=Sandbox.try2
>
>
> icon=gerritjan.png
>
>
> test=$stringtool.split("item1, item2, item3", “ ,”)
>
> I tried to test it, but did not work?
It won’t work because the parameter values are not typed, they are strings.
So if you have:
#foreach ($uix in $services.uix.getExtensions(…))
#set ($params = $uix.parameters)
...
#end
then $params is always a String.
Thanks
-Vincent
PS: Please always reply to the list ;)
> The velocity part was:
>
>
> #set($items=$extension.getParameters().get('test'))
>
>
>
>
>
>
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website(http://www.cdlsworld.org)
> Facebook(https://www.facebook.com/gerritjan.koekkoek)
> email(gerritjan(a)cdlsworld.org)
>
>
>
>
>
> From: Vincent Massol on behalf of vincent(a)massol.net
> Sent: 18 January 2016 10:46
> To: XWiki Users
> Cc: Gerritjan Koekkoek
> Subject: Re: [xwiki-users] Data-Types in UIExtension parameters
>
>
> Hi Gerritjan,
>
> On 18 Jan 2016 at 09:34:22, Gerritjan Koekkoek (gerritjan@cdlsworld.org(mailto:gerritjan@cdlsworld.org)) wrote:
> > Hi
> >
> >
> > I wonder if it is possible to use velocity data-types (Number, Date/Time, Array or List, Object) in the parameters field of a UIExtension.
> >
> >
> > I get the impression it is always considered as string and we have to do a conversion?
>
> I’ve updated the UIX Module documentation at
> http://extensions.xwiki.org/xwiki/bin/view/Extension/UIExtension+Module#HMo…
>
> So yes, the parameters field can contain velocity.
>
> > Following example (for a List of items in a Array)
> >
> > cdls.try.abc has the following parameters:
> >
> >
> > label=abc
> >
> > target=Sandbox.try2
> >
> > icon=gerritjan.png
> >
> > test=["Item1", 'item2', "item3"]
> >
> >
> > {{velocity}}
> >
> > $services.uix.getExtensions("cdls.try.abc")
> >
> >
> > #foreach ($extension in $services.uix.getExtensions("cdls.try.abc"))
> >
> > $services.rendering.render($extension.execute(), 'xhtml/1.0')
> >
> > #set($paramlist=$extension.getParameters().get('test'))
> >
> > #end
> >
> >
> > paramlist is String?: $paramlist.class
> >
> >
> > ##Would like it to be a list of items, but now I have to use velocity string functions to create the list...
> >
> > #set($paramlistLengthMinusOne = $paramlist.length() - 1)
> >
> > #set($items = $paramlist.substring(1, $paramlistLengthMinusOne).split(","))
> >
> >
> > #foreach($item in $items)
>
> [snip]
>
> That’s correct, UIX parameters are not typed (they’re strings).
>
> However you can simplify a lot your velocity code.
>
> In the UIX:
> test=item1, item2, item3
>
> In the calling code:
> #set ($paramlist = $extension.getParameters().get('test'))
> #set ($items = $stringtool.split($paramList, “ ,”))
> …
>
> Thanks
> -Vincent
>
> > Gerritjan Koekkoek
> > Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
>
Hi
I wonder if it is possible to use velocity data-types (Number, Date/Time, Array or List, Object) in the parameters field of a UIExtension.
I get the impression it is always considered as string and we have to do a conversion?
Following example (for a List of items in a Array)
cdls.try.abc has the following parameters:
label=abc
target=Sandbox.try2
icon=gerritjan.png
test=["Item1", 'item2', "item3"]
{{velocity}}
$services.uix.getExtensions("cdls.try.abc")
#foreach ($extension in $services.uix.getExtensions("cdls.try.abc"))
$services.rendering.render($extension.execute(), 'xhtml/1.0')
#set($paramlist=$extension.getParameters().get('test'))
#end
paramlist is String?: $paramlist.class
##Would like it to be a list of items, but now I have to use velocity string functions to create the list...
#set($paramlistLengthMinusOne = $paramlist.length() - 1)
#set($items = $paramlist.substring(1, $paramlistLengthMinusOne).split(","))
#foreach($item in $items)
<h1>"$item.replace('"',"")"</h1>
#end
{{/velocity}}
Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website<http://www.cdlsworld.org>
Facebook<https://www.facebook.com/gerritjan.koekkoek>
email<gerritjan(a)cdlsworld.org>
Hi,
I'm a real novice, so please forgive my question if it is trivial.
I've created a simple app with App Within Minutes, and I'd like to
customise it a little. For example I have a boolean checkbox and a
user selector with the app, which I'd like to be disabled (uneditable)
for all users except my manager. So that only the manager can edit the
assigned users to a 'task' and mark the task as complete. I'd also
like a second user selector to default to the currently logged in
user.
I've spent a few days googling the problem, and I've come across
information in the xwiki mailing archive etc which makes me think that
it is possible to run checks against the current user using velocity
or groovy scripts embedded in one of the app sheets and modify the
respective elements. But I don't really understand how.
Can this actually be done?
Can anyone direct me to a resource that would clear this up for me? Or
give me an example code snippet and simple directions for its
implementation i.e. what sheet they should be inserted into? A real
idiot's guide
I'd really appreciate any help you could give me,
Thanks
Danny
Hi users,
Today I am wondering about how to create, inside a wiki page, a drop down
menù containing all the child pages of another space.
Any idea?
Giordano.