Blueprints with a ChannelManagerEventListener for copying content (timeout)

33 views
Skip to first unread message

koev

unread,
Mar 11, 2016, 5:11:31 AM3/11/16
to Hippo Community
Hi,

I am using a blueprint for a new-subsite creation. The new site should start with the same content (copies) from another site. I wrote a ChannelManagerEventListener which copies the correspondent content. Unfortunately sometimes this takes quite long and the channel manager complains, that the connection to the server is lost.

Putting the content into a query template makes it fast, but I always want to base a new client on the content of another client.

I am using
JcrUtils.copy(session, contentRoot, destPath);

but why is it that slow? I had the same experience with Groovy update scripts. What would be an alternative?

Ard Schrijvers

unread,
Mar 15, 2016, 4:56:54 AM3/15/16
to hippo-c...@googlegroups.com
It is slow most likely because it will just have to copy a lot of
content (including creating versions already)

Also copying the content in this way might result in that you still
need to modify the content afterwards (for example translation ids)

Regards Ard

>
> --
> Hippo Community Group: The place for all discussions and announcements about
> Hippo CMS (and HST, repository etc. etc.)
>
> To post to this group, send email to hippo-c...@googlegroups.com
> RSS:
> https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
> ---
> You received this message because you are subscribed to the Google Groups
> "Hippo Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to hippo-communi...@googlegroups.com.
> Visit this group at https://groups.google.com/group/hippo-community.
> For more options, visit https://groups.google.com/d/optout.



--
Hippo Netherlands, Oosteinde 11, 1017 WT Amsterdam, Netherlands
Hippo USA, Inc. 71 Summer Street, 2nd Floor Boston, MA 02110, United
states of America.

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

koev

unread,
Mar 15, 2016, 7:56:28 AM3/15/16
to Hippo Community
OK,

how can I copy documents and instantly generate new translationids? Are there any helper methods like the JcrUtils.copy() ?

Ard Schrijvers

unread,
Mar 15, 2016, 8:02:48 AM3/15/16
to hippo-c...@googlegroups.com
Hey,

On Tue, Mar 15, 2016 at 12:56 PM, 'koev' via Hippo Community
<hippo-c...@googlegroups.com> wrote:
> OK,
>
> how can I copy documents and instantly generate new translationids? Are
> there any helper methods like the JcrUtils.copy() ?

When copying a folder / document via the /console there is the option
to 'create new translation ids'. I am not sure whether this is some
reusable utility. Someone else might chime in here. Writing it
yourself is not complex though (iterate through all copied nodes and
make sure that all folders get a new translation id as well as all
document variants below a handle (note that the variants below a
handle all need to get the same translation id). I am not sure if
someone else built a utility for this. Also, I am not sure whether
there is a folder copy workflow that can do this for you. Hopefully
someone else can chime in here

Regards Ard

koev

unread,
Mar 15, 2016, 8:09:47 AM3/15/16
to Hippo Community
Hi,
thanks, I ll try doing that. I need to do it in a ChannelManagerEventListener so I ll have to do it programatically.
Maybe you know the class which is using the Console for the copying so that I can look into that code?

Regards

koev

unread,
Mar 15, 2016, 8:17:47 AM3/15/16
to Hippo Community
I guess org.hippoecm.frontend.plugins.console.menu.copy.CopyDialog shows the key to success ;)

Ard Schrijvers

unread,
Mar 15, 2016, 8:32:27 AM3/15/16
to hippo-c...@googlegroups.com
On Tue, Mar 15, 2016 at 1:17 PM, 'koev' via Hippo Community
<hippo-c...@googlegroups.com> wrote:
> I guess org.hippoecm.frontend.plugins.console.menu.copy.CopyDialog shows the
> key to success ;)

Sounds like it :-)

I unfortunately cannot really confirm it because I never looked at that code

koev

unread,
Mar 15, 2016, 10:30:25 AM3/15/16
to Hippo Community
Looks good but it generates a new translation:id for each node under a handle.

Ard Schrijvers

unread,
Mar 15, 2016, 10:52:52 AM3/15/16
to hippo-c...@googlegroups.com
On Tue, Mar 15, 2016 at 3:30 PM, 'koev' via Hippo Community
<hippo-c...@googlegroups.com> wrote:
> Looks good but it generates a new translation:id for each node under a
> handle.

I see the copy dialog in the cms with 'create new translation ids'
gives every variant below a handle its own translation id. This is a
bug. Every variant below a handle should have the same translation id.

https://issues.onehippo.com/browse/CMS-9981

Woonsan Ko

unread,
Mar 15, 2016, 11:29:21 AM3/15/16
to hippo-c...@googlegroups.com
Hi,

There's a community forge plugin which uses the same JcrUtils
internally, but cares of the translation id generations:
- http://folderctxmenus.forge.onehippo.org/index.html#Programmatic_Folder_Copy_and_Move

If you want to copy a folder with changing the translation ids
(keeping the same translation ids under the same handle node), you
might want to give it a try.

Regards,

Woonsan


On Tue, Mar 15, 2016 at 10:30 AM, 'koev' via Hippo Community
w....@onehippo.com www.onehippo.com
Boston - 745 Atlantic Ave, 8th Floor, Boston MA 02111
Amsterdam - Oosteinde 11, 1017 WT Amsterdam

koev

unread,
Mar 15, 2016, 12:56:46 PM3/15/16
to Hippo Community
Perfect! Thanks for the tip!
Reply all
Reply to author
Forward
0 new messages