What's the right way to get the current user from the execution context within a Java component?
Taking the example from the guide (http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents) I thought it would be something like the following, which won't compile for me due to the getLocalUser symbol not being found.
import org.xwiki.context.Execution;
import org.xwiki.context.ExecutionContext;
...
@Inject
private Execution execution;
@Override
public String sayHello()
{
ExecutionContext context = execution.getContext();
String user = context.getLocalUser();
return "Hello " + user;
}
I note that in http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/or… the getLocalUser() method is deprecated in lieu of getUserReference() but I'd really rather deal with a String if at all possible.
Hi,
in our company we used the standalone version of XWiki for testing and are
very satisfied with it so we want to migrate to the new version and a more
robust setup.
The setup is Windows Server 2003 R2 (sadly only 32 bits) with Apache 2.4,
MySQL 5 and Tomcat 7.
XWiki 6.3 is setup now including a Wiki Template so I'd like to migrate the
data I exported as XAR from the 5.4.5 standalone instance.
My approach was exporting data from 5.4.5, creating the Wikis using the
template and importing the spaces and pages from the XAR export.
The issue I'm facing is Java heap size which constantly gets in my way. As
we're on a 32 bits system I can only assign ~1.2 GB of memory (the server
has 4GB).
This limitation makes it impossible to import the data into the new setup.
I tried general export/import via administration page and the various
options using the Admin Tools Application but on one of both ends I always
get the out of memory error.
- Using normal export/import: Export works but import throws the error
- Admin Tools - Export pages and spaces: Export works but import throws the
error
- Admin Tools - Large Export on Disk: the heap size error is thrown
Do you have any suggestions/hints on how I can migrate the spaces and pages
I have in the 5.4.5 setup to the 6.3 one?
Thanks in advance,
Dennis
On Mon, Nov 24, 2014 at 9:46 AM, Gerritjan Koekkoek
<gerritjankoekkoek(a)gmail.com> wrote:
Hi,
I'm trying to understand the new SOLR search (i did not understand the old
Lucene very well)
My use-case is the following.
We have a special FAQ application where the object has, amongst others, the
following attributes:
- Subject
- Topic-group
- Language
- Question
- Answer
he default search returns page-title/name, but this is in our case a
non-informational, generated by the system code. So instead of Page name we
would like to show: Subject
You have 3 options:
(1) Use Velocity to output the value of the subject property in the
FAQ title. See
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
Gerritjan: Thanks this is helpful but see below....
(2) I doesn't make sense to have a separate String property to store
the subject when you can store it in the document title.
The designer of our FAQ has opted to store multiple objects of same class
in one page. (because XWiki does not support "multiple locales
(language-country)" on a object level. So the title must pick the subject
name of the object of the current language-country combination. When we
just display the subject we do not need to solve this challenge.
(3) Customize the entire search page just to change the way the search
results are displayed
Yes I fear there is no way around this?
As facets we would like to show Topic-group and Language,
Default (on entering the page with search box) we would like to set the
context-language as a search filter... So when reader is reading french the
result only shows french FAQ (with a french subject title) if english only
english.
By checking and unchecking languages in the facets the user could extend or
reduce the search.
This is already the case with the default search. The context language
is checked by default in the locale facet. See
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
.
It looks the context language is only looking at language attribute of page.
We need to compare with attribute in object.
I think it would be useful if some explanation is how the object-based
facets can be defined.
A challenge is the topic field, this is a list with translation key. So if
user is french-language the list will show french topics, but if he/she
check english as well in facets things get complicated.
We have a business-rule that the english collection of FAQ's is the
baseline, and most comprehensive. The other languages are only translations
of the same. So another languages can not have a question not translated.
So my question is:
How to define the search
http://extensions.xwiki.org/xwiki/bin/view/Extension/Solr+Search+Applicatio…http://design.xwiki.org/xwiki/bin/view/Design/SolrSchemahttp://extensions.xwiki.org/xwiki/bin/view/Extension/Solr+Search+Query+APIhttp://lucene.apache.org/solr/
How to modify the output so page-title is no longer showing
How to modify facets so only the two fields can be set
See
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
.This helps...
Hope this helps,
Marius
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
To folks who have the "Mocca Calendar"[1] application installed in their XWiki instances:
I have just released a new version 2.2.1 to which you might want to update to, as it contains quite a few bugfixes and improvements, thanks to patches send in by several contributors.[2]
However the new release does not show up when you try to update via the "Extension Updater" in your wiki admin; instead the latest version found there will be 2.1.9.
This happened due to a glitch when reorganizing the code which changed the Extension-Id for that application.
Instead please go to "Add extensions", search for "Mocca Calendar" and when the search result comes up, the extension manager should propose you to update to the correct version 2.2.1
Also while upgrading at least in my test instances I got a few spurious conflicts.
If you get them too, even while you have made no modifications to the "code" part of the calendar, please choose to keep the new version to get all updates installed property.
Best regards and sorry for the hiccup,
Clemens
[1] http://extensions.xwiki.org/xwiki/bin/view/Extension/MoccaCalendar
[2] http://jira.xwiki.org/browse/MOCCACAL-32?filter=13491
Many thanks, I'll give that a go.
________________________________________
From: Thomas Mortagne [thomas.mortagne(a)xwiki.com]
Sent: 27 November 2014 23:14
To: Bryn Jeffries
Subject: Re: [xwiki-users] Registering components
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
is a good up to date (we changed several time the mocking system to
use in XWiki by default, it's Mockito currently) example of how to
manipuated a mock of DocumentAccessBridge in a component oriented unit
test.
On Thu, Nov 27, 2014 at 11:42 AM, Bryn Jeffries
<bryn.jeffries(a)sydney.edu.au> wrote:
> Useful to know, thanks. Incidentally, are there any useful mocks, etc, for
> unit testing xwiki component code ( to avoid frequently restarting tomcat)?
> Like a mock execution context, for instance?
>
> Thanks,
>
> Bryn
>
>
>
> ----- Reply message -----
> From: "Thomas Mortagne" <thomas.mortagne(a)xwiki.com>
> To: "XWiki Users" <users(a)xwiki.org>
> Subject: Re: [xwiki-users] Registering components
> Date: Thu, Nov 27, 2014 18:38
>
> On Thu, Nov 27, 2014 at 8:36 AM, Thomas Mortagne
> <thomas.mortagne(a)xwiki.com> wrote:
>> What you have in XE_WAR_HOME/WEB-INF/lib is loaded by Tomcat at
>> startup, there is not much XWiki can do about it.
>>
>> But you can install your jar as an extension using Extension Manager
>> as long as it's on some supported repository (which mean a Maven
>> repository or XWiki repository, see
>>
>> http://extensions.xwiki.org/xwiki/bin/view/Extension/Repository+Application
>> for this last one) and you indicate your repository in
>> xwiki.properties.
>
> Note that Extension Manager is not the best fit right now to test
> snapshot jars since it does not have the required special handling of
> SNAPSHOT needed to update to a new version of the same SNAPSHOT
> version.
>
>>
>> On Thu, Nov 27, 2014 at 5:20 AM, Bryn Jeffries
>> <bryn.jeffries(a)sydney.edu.au> wrote:
>>> Having been put off writing Java components a number of times I've
>>> decided to really tackle the problem head on. I would greatly appreciate any
>>> help in this.
>>>
>>> I've been following the advice in
>>> http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents and I
>>> have compiled a Jar identical to the Hello World example except that the
>>> class and method names differ, hopefully consistently. I've placed the jar
>>> in XE_WAR_HOME/WEB-INF/lib and written a page, which consists only of
>>> {{velocity}}
>>> $services.mycomponent.greet()
>>> {{/velocity}}
>>>
>>> The output when viewed is simple "$services.alertdb.greet()", so nothing
>>> seems to have happened. However, if I restart Tomcat (and then wait a minute
>>> or so for XWiki to restart) the output is "Hello", as desired.
>>>
>>> So is a restart of Tomcat always required? This wasn't mentioned in the
>>> guide. And since extensions can be added via the extension manager without a
>>> restart, is there a sneaky trick to doing the same with my own components.
>>>
>>> Also, is a restart necessary when I update the Jar, either with fixed
>>> methods or modified interface?
>>> _______________________________________________
>>> users mailing list
>>> users(a)xwiki.org
>>> http://lists.xwiki.org/mailman/listinfo/users
>>
>>
>>
>> --
>> Thomas Mortagne
>
>
>
> --
> Thomas Mortagne
>
--
Thomas Mortagne
Hi,
We are looking for the best way to access an external SQL database
using velocity exclusively (because we can't write a macro using
groovy language).
So, we installed and tried to use this plugin :
http://extensions.xwiki.org/xwiki/bin/view/Extension/SQL+Plugin. The
plugin is properly installed. Now we are unsure how to use it : there
is no mention of the user which is used to connect to the database, do
we have to to configure a JNDI ? How ?
As a side question, what is you guys your preferred method to program
xwiki pages with external database access ?
Thanks
--
Martin
Hi,
I imported several .xar files from another xwiki instance and afterwards
wanted to delete the uploaded .xar files.
All but one have successfully been deleted.
Everytime I delete "Xwiki_New.xar" from the import screen inside the
administration screen and refresh the page it's there again.
Also in document index I still see it in the attachments tab and not in the
deleted attachments tab.
Any hints?
Is it safe to simply delete it from xwikiattachment table in the database
with phpMyAdmin?
My system is Windows Server 2003 R2 with Apache 2.4, MySQL 5, Tomcat 7,
XWiki 6.3.
Thanks in advance,
Dennis
Hi,
I'm trying to understand the new SOLR search (i did not understand the old
Lucene very well)
My use-case is the following.
We have a special FAQ application where the object has, amongst others, the
following attributes:
- Subject
- Topic-group
- Language
- Question
- Answer
he default search returns page-title/name, but this is in our case a
non-informational, generated by the system code. So instead of Page name we
would like to show: Subject
As facets we would like to show Topic-group and Language,
Default (on entering the page with search box) we would like to set the
context-language as a search filter... So when reader is reading french the
result only shows french FAQ (with a french subject title) if english only
english.
By checking and unchecking languages in the facets the user could extend or
reduce the search.
A challenge is the topic field, this is a list with translation key. So if
user is french-language the list will show french topics, but if he/she
check english as well in facets things get complicated.
We have a business-rule that the english collection of FAQ's is the
baseline, and most comprehensive. The other languages are only translations
of the same. So another languages can not have a question not translated.
So my question is:
How to define the search
How to modify the output so page-title is no longer showing
How to modify facets so only the two fields can be set
Hello
In a groovy macro I can access the comments on the page like this :
comments = doc.getComments();
now I want to delete the last one... how can I do that?
I tried :
comments[0].delete();
but it doesn't work....
do you know what to type to make it work?
Thanks a lot
Adrien