Programmatic XML Export

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Programmatic XML Export

sharath
Hello,

A couple of questions regarding programmatically importing content as XML:

1. Is there a way to convert Hippo Bean to its corresponding XML representation (i.e., the same xml representation that could be obtained thru hippo console - xml export)?

2. Export all the documents as XML.

Thanks,
Sharath
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

abhishek bhardwaj
hello
I am not sure about it but i am sending u a link that can be helpful to you.........





link->

http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch06s04.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

Minos Chatzidakis-2
In reply to this post by sharath
Hi Sharath,

1. Is there a way to convert Hippo Bean to its corresponding XML
representation (i.e., the same xml representation that could be obtained
thru hippo console - xml export)?

Your question is not very clear. A HippoBean is the entity created in HST framework to represent jcr nodes that in turn represent documents in your cms. Exporting a hippo bean is different than exporting the node. You should use [1] to expose hippo beans in your site. 
On the other hand, what you get when you export in the console is the xml representation of the jcr nodes directly (even if they don't represent documents). You can get that programmatically if you use method exportDocumentView in javax.jcr.session. To connect to the hippo repository see [2].


Minos

--
 

2. Export all the documents as XML.

Thanks,
Sharath




--
View this message in context: http://hippo.2275632.n2.nabble.com/Programmatic-XML-Export-tp7580151.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html





_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

sharath
Hello Minos,

Thanks for the information.  Just to clarify my question: When I meant export the bean as XML, I want to get the JCR XML representation of a HippoBean inside my HST based REST application.

So, as you suggested, exportDocumentView might be the way to go. could you let me know if there is a hippo example demonstrating the usage of exportDocumentView?

Thanks,
Sharath
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

Minos Chatzidakis-2
Well you don't need an example.. there is the actual implementation in the console that you could take a look at: http://svn.onehippo.org/viewvc/hippo-cms7/cms/trunk/console/

Minos


On Thu, Jan 10, 2013 at 2:09 PM, sharath <[hidden email]> wrote:
Hello Minos,

Thanks for the information.  Just to clarify my question: When I meant
export the bean as XML, I want to get the JCR XML representation of a
HippoBean inside my HST based REST application.

So, as you suggested, exportDocumentView might be the way to go. could you
let me know if there is a hippo example demonstrating the usage of
exportDocumentView?

Thanks,
Sharath



--
View this message in context: http://hippo.2275632.n2.nabble.com/Programmatic-XML-Export-tp7580151p7580159.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
With kind regards/Met vriendelijke groet,
Minos Chatzidakis

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

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

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

sharath
Hello Minos,

Thanks for the link.  I am not sure if I found an implementation that uses exportDocumentView in the link provided.  Could you point me to a class containing the usage?

Thanks,
Sharath
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

Ate Douma-3
On 01/10/2013 04:51 PM, sharath wrote:
> Hello Minos,
>
> Thanks for the link.  I am not sure if I found an implementation that uses
> exportDocumentView in the link provided.  Could you point me to a class
> containing the usage?

I suspect Minos was referring to
http://svn.onehippo.org/repos/hippo/hippo-cms7/cms/trunk/console/frontend/src/main/java/org/hippoecm/frontend/plugins/console/menu/content/ContentExportDialog.java

HTH,

Ate

>
> Thanks,
> Sharath
>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/Programmatic-XML-Export-tp7580151p7580161.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>


--
mailto:[hidden email]    http://www.onehippo.com     http://www.onehippo.org
Europe Amsterdam   Oosteinde 11, 1017 WT, Amsterdam  +31 (0)20 522 4466
USA    Boston      1 Broadway, Cambridge, MA 02142    +1 877 414 4776 toll free
_______________________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does not
waive any related rights and obligations. Any distribution, use or copying of
this e-mail or the information it contains by other than an intended recipient
is unauthorized. If you received this e-mail in error, please advise me (by
return e-mail or otherwise) immediately.

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

Minos Chatzidakis-2
On Thu, Jan 10, 2013 at 5:00 PM, Ate Douma <[hidden email]> wrote:
On 01/10/2013 04:51 PM, sharath wrote:
Hello Minos,

Thanks for the link.  I am not sure if I found an implementation that uses
exportDocumentView in the link provided.  Could you point me to a class
containing the usage?

I suspect Minos was referring to http://svn.onehippo.org/repos/hippo/hippo-cms7/cms/trunk/console/frontend/src/main/java/org/hippoecm/frontend/plugins/console/menu/content/ContentExportDialog.java


 
HTH,

Ate



Thanks,
Sharath



--
View this message in context: http://hippo.2275632.n2.nabble.com/Programmatic-XML-Export-tp7580151p7580161.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
mailto:[hidden email]    http://www.onehippo.com     http://www.onehippo.org
Europe Amsterdam   Oosteinde 11, 1017 WT, Amsterdam  <a href="tel:%2B31%20%280%2920%20522%204466" value="+31205224466" target="_blank">+31 (0)20 522 4466
USA    Boston      1 Broadway, Cambridge, MA 02142    <a href="tel:%2B1%20877%20414%204776" value="+18774144776" target="_blank">+1 877 414 4776 toll free
_______________________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does not
waive any related rights and obligations. Any distribution, use or copying of
this e-mail or the information it contains by other than an intended recipient
is unauthorized. If you received this e-mail in error, please advise me (by
return e-mail or otherwise) immediately.


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
With kind regards/Met vriendelijke groet,
Minos Chatzidakis

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

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

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

sharath
In reply to this post by Ate Douma-3
Hello Minos & Ate,

That did the trick!! Thanks for your help.  (Earlier I was trying to instantiate explicitly HippoDocumentExportViewer and configuring it manually - following the pattern in org.onehippo.cms7.autoexport.Exporter and had to jump thru hoops.)

Thanks,
Sharath
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

abhishek bhardwaj
Hi all,

m just want to make a reset password application n i have use following pages but it didnt work plz help.......


forgotpass.java


package com.mootly.wcm.member;

import java.util.HashMap;
import java.util.Map;

import javax.jcr.Session;

import org.hippoecm.hst.content.beans.manager.workflow.WorkflowCallbackHandler;
import org.hippoecm.hst.content.beans.manager.workflow.WorkflowPersistenceManager;
import org.hippoecm.hst.core.component.HstComponentException;
import org.hippoecm.hst.core.component.HstRequest;
import org.hippoecm.hst.core.component.HstResponse;
import org.hippoecm.repository.reviewedactions.FullReviewedActionsWorkflow;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.mootly.wcm.beans.EmailMessage;
import com.mootly.wcm.beans.EmailTemplate;
import com.mootly.wcm.beans.MemberSignupDocument;
import com.mootly.wcm.components.BaseComponent;
import com.mootly.wcm.utils.ContentStructure;
import com.mootly.wcm.utils.GoGreenUtil;
import com.mootly.wcm.utils.VelocityUtils;

public class ForgotPass extends BaseComponent {
    private static final Logger log = LoggerFactory.getLogger(ForgotPass.class);
   
    public static final String SUCCESS= "success";
    @Override
    public void doBeforeRender(HstRequest request, HstResponse response) {
        // TODO Auto-generated method stub
        super.doBeforeRender(request, response);
        log.error("This is ForgotPass");
        request.setAttribute("pageName", "Forgot Password");
        request.setAttribute("message", "How can you forget your password!!!");
       
    }
   
    @Override
    public void doAction(HstRequest request, HstResponse response)
            throws HstComponentException {
        // TODO Auto-generated method stub
        super.doAction(request, response);
        //Any submission will go here
        String email = GoGreenUtil.getEscapedParameter(request, "email");
        //do some magic here to retrieve the password and send it via email
        EmailMessage ms = new EmailMessage();
        ms.setTo(new String[] {"[hidden email]"});
        ms.setHtmlBody("this is your test mail");
        ms.setTemplateKey("test mail");
        ms.setSubject("welcome to mootly");
        ms.setPlainBody("hello how are you");
        createEmail(request,ms);
        response.setRenderParameter(SUCCESS, SUCCESS);
    }
       
    public EmailMessage createEmail(HstRequest request,EmailMessage msg){
       
        Session persistableSession = null;
        WorkflowPersistenceManager wpm;
        try{
        persistableSession = getPersistableSession(request);
        wpm = getWorkflowPersistenceManager(persistableSession);
        //SIMPLE WORKFLOW
        wpm.setWorkflowCallbackHandler(new FullReviewedWorkflowCallbackHandler());
       
        final String memberpath=ContentStructure.getEmailTemplatesPath(request) + "/mootly";
        final String itReturnPath = wpm.createAndReturn(memberpath, EmailMessage.NAMESPACE , EmailMessage.NODE_NAME, true);
        EmailMessage emailMessage = (EmailMessage) wpm.getObject(itReturnPath);
        if (emailMessage != null) {
            log.error("Email template found");
            log.error("Email template HTML BODY");
            emailMessage.setSubject(msg.getSubject());
            emailMessage.setHtmlBody(msg.getHtmlBody());
            emailMessage.setPlainBody(msg.getPlainBody());
            emailMessage.setTo(msg.getTo());
            emailMessage.setTemplateKey(msg.getTemplateKey());
            wpm.update(emailMessage);
            return emailMessage;
                }
        else {
            log.warn("Failed to add membership document for '{}': could not retrieve Review bean for node '{}'.", EmailMessage.NODE_NAME, itReturnPath);
            GoGreenUtil.refreshWorkflowManager(wpm);
            return emailMessage;
             }
        }
        catch(Exception e){
            log.warn("this is error for email",e);
            return null;
        }
        finally {
            if (persistableSession != null) {
                persistableSession.logout();
            }
        }
       
    }
    @Override
    public void doBeforeServeResource(HstRequest request, HstResponse response)
            throws HstComponentException {
        // TODO Auto-generated method stub
        super.doBeforeServeResource(request, response);
    }
    private static class FullReviewedWorkflowCallbackHandler implements WorkflowCallbackHandler<FullReviewedActionsWorkflow> {
        public void processWorkflow(FullReviewedActionsWorkflow wf) throws Exception {
            wf.publish();
        }
    }
}


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

abhishek bhardwaj
hi
it show erroe under dobefore render as describe "this is forgot password"


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Ard
Reply | Threaded
Open this post in threaded view
|

Re: Programmatic XML Export

Ard
In reply to this post by abhishek bhardwaj
Hello,

can you start a new thread for a new topic instead of hijacking an
existing thread?

Thanks

Regards Ard

On Fri, Jan 11, 2013 at 8:13 AM, Abhishek Bhardwaj <[hidden email]> wrote:

> Hi all,
>
> m just want to make a reset password application n i have use following
> pages but it didnt work plz help.......
>
>
> forgotpass.java
>
>
> package com.mootly.wcm.member;
>
> import java.util.HashMap;
> import java.util.Map;
>
> import javax.jcr.Session;
>
> import
> org.hippoecm.hst.content.beans.manager.workflow.WorkflowCallbackHandler;
> import
> org.hippoecm.hst.content.beans.manager.workflow.WorkflowPersistenceManager;
> import org.hippoecm.hst.core.component.HstComponentException;
> import org.hippoecm.hst.core.component.HstRequest;
> import org.hippoecm.hst.core.component.HstResponse;
> import org.hippoecm.repository.reviewedactions.FullReviewedActionsWorkflow;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> import com.mootly.wcm.beans.EmailMessage;
> import com.mootly.wcm.beans.EmailTemplate;
> import com.mootly.wcm.beans.MemberSignupDocument;
> import com.mootly.wcm.components.BaseComponent;
> import com.mootly.wcm.utils.ContentStructure;
> import com.mootly.wcm.utils.GoGreenUtil;
> import com.mootly.wcm.utils.VelocityUtils;
>
> public class ForgotPass extends BaseComponent {
>     private static final Logger log =
> LoggerFactory.getLogger(ForgotPass.class);
>
>     public static final String SUCCESS= "success";
>     @Override
>     public void doBeforeRender(HstRequest request, HstResponse response) {
>         // TODO Auto-generated method stub
>         super.doBeforeRender(request, response);
>         log.error("This is ForgotPass");
>         request.setAttribute("pageName", "Forgot Password");
>         request.setAttribute("message", "How can you forget your
> password!!!");
>
>     }
>
>     @Override
>     public void doAction(HstRequest request, HstResponse response)
>             throws HstComponentException {
>         // TODO Auto-generated method stub
>         super.doAction(request, response);
>         //Any submission will go here
>         String email = GoGreenUtil.getEscapedParameter(request, "email");
>         //do some magic here to retrieve the password and send it via email
>         EmailMessage ms = new EmailMessage();
>         ms.setTo(new String[] {"[hidden email]"});
>         ms.setHtmlBody("this is your test mail");
>         ms.setTemplateKey("test mail");
>         ms.setSubject("welcome to mootly");
>         ms.setPlainBody("hello how are you");
>         createEmail(request,ms);
>         response.setRenderParameter(SUCCESS, SUCCESS);
>     }
>
>     public EmailMessage createEmail(HstRequest request,EmailMessage msg){
>
>         Session persistableSession = null;
>         WorkflowPersistenceManager wpm;
>         try{
>         persistableSession = getPersistableSession(request);
>         wpm = getWorkflowPersistenceManager(persistableSession);
>         //SIMPLE WORKFLOW
>         wpm.setWorkflowCallbackHandler(new
> FullReviewedWorkflowCallbackHandler());
>
>         final String
> memberpath=ContentStructure.getEmailTemplatesPath(request) + "/mootly";
>         final String itReturnPath = wpm.createAndReturn(memberpath,
> EmailMessage.NAMESPACE , EmailMessage.NODE_NAME, true);
>         EmailMessage emailMessage = (EmailMessage)
> wpm.getObject(itReturnPath);
>         if (emailMessage != null) {
>             log.error("Email template found");
>             log.error("Email template HTML BODY");
>             emailMessage.setSubject(msg.getSubject());
>             emailMessage.setHtmlBody(msg.getHtmlBody());
>             emailMessage.setPlainBody(msg.getPlainBody());
>             emailMessage.setTo(msg.getTo());
>             emailMessage.setTemplateKey(msg.getTemplateKey());
>             wpm.update(emailMessage);
>             return emailMessage;
>                 }
>         else {
>             log.warn("Failed to add membership document for '{}': could not
> retrieve Review bean for node '{}'.", EmailMessage.NODE_NAME, itReturnPath);
>             GoGreenUtil.refreshWorkflowManager(wpm);
>             return emailMessage;
>              }
>         }
>         catch(Exception e){
>             log.warn("this is error for email",e);
>             return null;
>         }
>         finally {
>             if (persistableSession != null) {
>                 persistableSession.logout();
>             }
>         }
>
>     }
>     @Override
>     public void doBeforeServeResource(HstRequest request, HstResponse
> response)
>             throws HstComponentException {
>         // TODO Auto-generated method stub
>         super.doBeforeServeResource(request, response);
>     }
>     private static class FullReviewedWorkflowCallbackHandler implements
> WorkflowCallbackHandler<FullReviewedActionsWorkflow> {
>         public void processWorkflow(FullReviewedActionsWorkflow wf) throws
> Exception {
>             wf.publish();
>         }
>     }
> }
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html