[Hippo-cms7-user] Get bean by name of the document

Chandan AGARWAL chandan.agarwal at smile-benelux.com
Thu Sep 27 09:08:34 CEST 2012


I guess no one saw my reply... can anyone help me with my problem stated my previous reply...I am blocked because of this problem. 

Thanks in advance 


Cdt, 
Chandan AGARWAL 
IED 
Smile Benelux 
Brussels 
Mb - (+32) 0492101358 

----- Original Message -----

From: "Chandan AGARWAL" <chandan.agarwal at smile-benelux.com> 
To: "Hippo CMS 7 implementation list" <hippo-cms7-user at lists.onehippo.org> 
Sent: Wednesday, September 26, 2012 10:27:22 AM 
Subject: Re: [Hippo-cms7-user] Get bean by name of the document 


Hi Jeroen, 
Here is the code snippet of my code : 

@Path("/contentBlocks/") 
public class ContentBlockResource extends AbstractContentResource { 

@GET 
@Path("/{documentName}") 
@Produces("text/xml") 
public ContentBlockRepresentation getContentBlockByName(@Context HttpServletRequest servletRequest, 
@Context HttpServletResponse servletResponse, @PathParam("documentName") String documentName) { 

ContentBlockRepresentation contentBlockRepresentation = new ContentBlockRepresentation(); 

HstRequestContext requestContext = getRequestContext(servletRequest); 


// I need to get the bean by the document name passed in the pathParam variable here and then map it as a contentBlockRepresentation object and return it back to the client 


return contentBlockRepresentation; 
} 

} 

@XmlRootElement(name = "contentBlock") 
public class ContentBlockRepresentation { 

private String title; 
private String description; 
private ImageRepresentation image; 

public ContentBlockRepresentation() { 
} 

public ContentBlockRepresentation(String title, String description, ImageRepresentation image) { 
this.title = title; 
this.description = description; 
this.image = image; 
} 

public String getTitle() { 
return title; 
} 

public void setTitle(String title) { 
this.title = title; 
} 

public String getDescription() { 
return description; 
} 

public void setDescription(String description) { 
this.description = description; 
} 

@XmlElement(name = "image") 
public ImageRepresentation getImage() { 
return image; 
} 

public void setImage(ImageRepresentation image) { 
this.image = image; 
} 

} 

As you see I am passing the name of the document that i want as a pathParam . For eg I have created a file called "quickaccess" of document type ContentBlock in the cms inside the folder cullen. 
When i call my class from the rest client with the url contentBlocks/quickaccess , I want to get the corresponding bean of quickaccess, which I would convert to my object ContentBlockRepresentation and send it back. 

So, my question is how can i get the bean by the name of the document ? 



Cdt, 
Chandan AGARWAL 
IED 
Smile Benelux 
Brussels 
Mb - (+32) 0492101358 

----- Original Message -----

From: "Jeroen Reijn" <j.reijn at onehippo.com> 
To: "Hippo CMS 7 implementation list" <hippo-cms7-user at lists.onehippo.org> 
Sent: Wednesday, September 26, 2012 9:59:38 AM 
Subject: Re: [Hippo-cms7-user] Get bean by name of the document 

Could you perhaps explain what you have tried? 
What bean are you trying to get? A document of a child node? 

Jeroen 

On Tue, Sep 25, 2012 at 8:01 PM, Chandan AGARWAL 
<chandan.agarwal at smile-benelux.com> wrote: 
> Hello, 
> I am using spring Rest template to extract the data from hippo using plain 
> JAX-RS Services and displaying this data in the frontend using the rest 
> client. 
> 
> I am passing the name of the document as the parameter and would like to get 
> the corresponding bean for this document. 
> 
> Could you tell me how can I get the bean by name of the document added in 
> the repository. 
> 
> Thanks 
> 
> Cdt, 
> Chandan AGARWAL 
> IED 
> Smile Benelux 
> Brussels 
> Mb - (+32) 0492101358 
> 
> 
> _______________________________________________ 
> Hippo-cms7-user mailing list and forums 
> http://www.onehippo.org/cms7/support/forums.html 



-- 
Jeroen Reijn 
Solution Architect 
Hippo 

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 

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onehippo.org/pipermail/hippo-cms7-user/attachments/20120927/0d6fc76a/attachment.htm>


More information about the Hippo-cms7-user mailing list