Page 1 of 1

Where to create new custom files in broadeaf ?

Posted: Tue Jun 04, 2013 3:55 am
by ankit
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

Re: Where to create new custom files in broadeaf ?

Posted: Tue Jun 04, 2013 1:34 pm
by phillipuniverse
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.

Re: Where to create new custom files in broadeaf ?

Posted: Wed Jun 05, 2013 4:56 am
by ankit
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

Re: Where to create new custom files in broadeaf ?

Posted: Thu Jun 06, 2013 12:18 am
by bpolster
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.

Re: Where to create new custom files in broadeaf ?

Posted: Thu Jun 06, 2013 3:14 am
by ankit
Thanks for your brief reply Brian.

Re: Where to create new custom files in broadeaf ?

Posted: Tue Oct 29, 2013 4:17 am
by Deepak
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

Re: Where to create new custom files in broadeaf ?

Posted: Tue Oct 29, 2013 9:17 am
by phillipuniverse
@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