Where to create new custom files in broadeaf ?

Topics related to getting started with the Broadleaf Commerce framework.

Moderator: jocanas

Where to create new custom files in broadeaf ?

Postby ankit » Tue Jun 04, 2013 3:55 am

Hi,

I am looking into the broadleaf tutorials.
In Adding Customer Attribute Tutorial http://docs.broadleafcommerce.org/dev/Adding-Customer-Attribute-Tutorial.html, where we need put the new java classes. For example, where to create HCRegisterCustomerForm class. In tutorial no package is describe.
So i put that class in DemoSite/site project but i can't find the RegisterCustomerForm class. Do we need to give some core framework project references ?

And dose docs defines the proper architecture for broadleaf. because i can't find it.

Thanks in advance.
Ankit
ankit
Beginner
Beginner
 
Posts: 15
Joined: Mon Jun 03, 2013 1:25 am

Re: Where to create new custom files in broadeaf ?

Postby phillipuniverse » Tue Jun 04, 2013 1:34 pm

That depends on what type of class it is. That specific class looks like a form DTO, so I would probably put that in the 'site' project. In general, classes should go like this:

admin - all admin-specific code (you probably won't have much, if any, of this)
core - all Hibernate entities, services, daos that both the admin and site application might need to use
site - anything related to Spring MVC in operating your frontend web application (@Controller, Form DTOs, validators)

Adding a task for us to add this in a bit more detail in the docs. Let me know if you have additional questions.
phillipuniverse
Team Member
Team Member
 
Posts: 1252
Joined: Tue Dec 20, 2011 12:11 pm

Re: Where to create new custom files in broadeaf ?

Postby ankit » Wed Jun 05, 2013 4:56 am

Hi phillipuniverse,

Thanks for your reply.
For customization we are extending the entity, services etc. as per the docs.
Can it be possible to directly change into core rather then extending entity, services etc ? Is there any tutorial available for that ?

Thanks,
Ankit
ankit
Beginner
Beginner
 
Posts: 15
Joined: Mon Jun 03, 2013 1:25 am

Re: Where to create new custom files in broadeaf ?

Postby bpolster » Thu Jun 06, 2013 12:18 am

Changing the source code makes sense when you intend to do a pull request to the main code base because you've found a bug or fixed a simple issue.

Normally (meaning 99.9% of the time) you do NOT want to modify the core framework. The Broadleaf Commerce team has added extension points and customizability throughout the framework.

By using these extension points and customization hooks, you benefit from future upgrades in a predictable way. As soon as you modify the core source you've made upgrades difficult for yourself going forward.

Of course the core framework code is available on Github and your welcome to fork the project and do what you want ... but it is not recommended.
Brian Polster
Broadleaf Commerce
bpolster@broadleafcommerce.org
bpolster
Team Member
Team Member
 
Posts: 135
Joined: Fri Nov 20, 2009 1:40 am

Re: Where to create new custom files in broadeaf ?

Postby ankit » Thu Jun 06, 2013 3:14 am

Thanks for your brief reply Brian.
ankit
Beginner
Beginner
 
Posts: 15
Joined: Mon Jun 03, 2013 1:25 am

Re: Where to create new custom files in broadeaf ?

Postby Deepak » Tue Oct 29, 2013 4:17 am

Hello Mr.Philip Universe
I had a question which is how to add a controller,services and dao. I saw your discussion which is with ankit regarding that you have shared a docs for that may i know the link please.because it will be helpful for me for the further use.

In previous comment the url is http://docs.broadleafcommerce.org/dev/A ... orial.html,
but it is not openning.


regards
deepak
Thanks
Deepak
Deepak
Beginner
Beginner
 
Posts: 20
Joined: Tue Sep 03, 2013 8:15 am

Re: Where to create new custom files in broadeaf ?

Postby phillipuniverse » Tue Oct 29, 2013 9:17 am

@deepak,

The link has changed to http://docs.broadleafcommerce.org/core/ ... e-tutorial. You're probably more interested in our extending services tutorial though: http://docs.broadleafcommerce.org/core/ ... s-tutorial

Since the 'core' Maven module does not already have it when you first download the DemoSite code, you'll need to add a src/main/java folder in order to house all of that code, as well as add it to the Java build path. From there, you can add more packages and classes just like you would anywhere else. As I mentioned earlier, there are some logical distinctions for what kinds of things go in what maven modules.

This is a bit less obvious than I would like; I opened an issue to make this a bit more explicit here: https://github.com/BroadleafCommerce/DemoSite/issues/36
phillipuniverse
Team Member
Team Member
 
Posts: 1252
Joined: Tue Dec 20, 2011 12:11 pm


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 2 guests