Hi,

Did not follow the discussion in depth, but maybe you are interested in
adding an EventListener on either DocumentCreatingEvent [1] (before) or
DocumentCreatedEvent [2] (after).

Other, more specialized, events exist as well, such as
XObjectAdded/Updated/DeletedEvent [7][8][9] that allows you to catch a user
profile page that was just created (example usage [6]). This way you`re
avoiding to do extra work in checking the type of the created page, like
you would have to do with DocumentCreatedEvent.

The event listener [3] can be built and added either as a java component
[4], a wiki component [5] or with a custom groovy script that does things
manually.

Hope this helps,
Eduard

----------
[1]
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-bridge/src/main/java/org/xwiki/bridge/event/DocumentCreatingEvent.java
[2]
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-bridge/src/main/java/org/xwiki/bridge/event/DocumentCreatedEvent.java
[3]
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial
[4] http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents
[5]
http://extensions.xwiki.org/xwiki/bin/view/Extension/WikiComponent+Module
[6]
https://github.com/xwiki/xwiki-platform/blob/456d6149d12d36f5481e70759e7974815591a2c1/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/event/CommentEventGeneratorListener.java#L63
[7]
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/event/XObjectAddedEvent.java
[8]
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/event/XObjectUpdatedEvent.java
[9]
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/event/XObjectDeletedEvent.java

On Thu, Dec 8, 2016 at 2:41 PM, Hamster <[email protected]> wrote:

> 1) I am not cutting any post. I use Nabble.
>
> http://xwiki.475771.n2.nabble.com/Re-API-Scripting-create-
> user-and-attach-some-files-to-its-profile-td7601934.html
>
> 2) I think my example shows perfectly what you want to accomplish. You want
> to attach an PDF to something which does not yet exist.
>
> Don't be scorned, I am just putting things in perspective. Unless there's
> an
> API which allows you to attach items to pages during the creation of the
> page. Otherwise the procedure will have to be (1) check if a user profile
> exists, if "yes" then attach file, if "no" then first create the user
> profile and then attach the file.
>
>
>
> --
> View this message in context: http://xwiki.475771.n2.nabble.
> com/Re-API-Scripting-create-user-and-attach-some-files-to-
> its-profile-tp7601934p7602032.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
>

Reply via email to