Page 1 of 1

Where is the domain model java classes? [SOLVED]

Posted: Tue Nov 27, 2012 11:20 am
by skystar3
I have read the Extending Entities tutorial, now i want to override Product for custom purposes, but after installing Broadleaf using the starting guide, i can't find any domain model entities in my Eclipse project?

Is there any extra step do i have to do, after doing the starting guide http://docs.broadleafcommerce.org/curre ... arted.html to load all the domain model entities & implementation classes?

Thank you

[EDIT]

I found all these classes are in the broadleaf-framework-2.0.2-GA.jar, but now how do i attach the source code to this jar?

Re: Where is the domain model java classes?

Posted: Tue Nov 27, 2012 1:20 pm
by phillipuniverse
Sources should automatically be downloaded by Maven. We automatically publish the sources along with the source jars. If you try to open up a class like ProductImpl (with the "Open Type" dialog, ctrl+shift+t for instance) then that should kick off Maven to download the source for that class. It should take a second to resolve, and then you should see the compiled bytecode change into readable source code. You might have to close the file and re-open it for it to reflect the downloaded sources.

Re: Where is the domain model java classes?

Posted: Tue Nov 27, 2012 1:23 pm
by phillipuniverse
One more caveat: if that doesn't work (which would indicate some problem with your Maven environment) then you could check out the framework code from GitHub and tell Eclipse to look at those folders for the BLC source (this is a button while looking at a compiled class in Eclipse; I believe it's called "Attach Sources"). Since you're on 2.0.2-GA (which is our latest GA release), this is the master branch on GitHub.

This shouldn't be necessary though and should only be used as a last resort.

Re: Where is the domain model java classes?

Posted: Tue Nov 27, 2012 4:50 pm
by skystar3
phillipuniverse wrote:Sources should automatically be downloaded by Maven. We automatically publish the sources along with the source jars. If you try to open up a class like ProductImpl (with the "Open Type" dialog, ctrl+shift+t for instance) then that should kick off Maven to download the source for that class. It should take a second to resolve, and then you should see the compiled bytecode change into readable source code. You might have to close the file and re-open it for it to reflect the downloaded sources.


You are right....i can view the sources automatically....works like a charm :D

Thank you

Re: Where is the domain model java classes? [SOLVED]

Posted: Mon Jul 29, 2013 8:13 am
by Anky
How can i do some changes in the product.java ?
I want to add some more general description for product.
like
1) I want to add product installation specification.
2) which version of software it supports.

Likes this many more..

Re: Where is the domain model java classes? [SOLVED]

Posted: Tue Jul 30, 2013 9:56 am
by elbertbautista
Please read our tutorial on extending entities here: http://docs.broadleafcommerce.org/core/ ... g-entities

This allows you to provide any custom implementation that may not be supported out of the box with Broadleaf.

Re: Where is the domain model java classes? [SOLVED]

Posted: Thu Aug 01, 2013 7:37 am
by Anky
Hi elbertbautista,

Thanks! for the reply.

I have done the changes according to this documentation (http://docs.broadleafcommerce.org/core/ ... g-entities).

1)I have created two new .java file MyproductImpl.java and MPproduct.java with the following code

here i'm extending the Product.class file

Code: Select all

package com.marketplace.core.catalog.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.broadleafcommerce.common.vendor.service.type.ContainerShapeType;
import org.broadleafcommerce.common.vendor.service.type.ContainerSizeType;
import org.broadleafcommerce.core.media.domain.Media;
import org.broadleafcommerce.core.catalog.domain.product;

public abstract interface MPproduct extends product {
public abstract String getVersion();
public abstract void setVersion(String paramString);
}


here i'm extending the ProductImpl.class file

Code: Select all

package com.marketplace.product.core.domain;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.broadleafcommerce.common.persistence.ArchiveStatus;
import org.broadleafcommerce.common.persistence.Status;
import org.broadleafcommerce.common.presentation.AdminPresentation;
import org.broadleafcommerce.common.presentation.AdminPresentationAdornedTargetCollection;
import org.broadleafcommerce.common.presentation.AdminPresentationClass;
import org.broadleafcommerce.common.presentation.AdminPresentationCollection;
import org.broadleafcommerce.common.presentation.AdminPresentationToOneLookup;
import org.broadleafcommerce.common.presentation.PopulateToOneFieldsEnum;
import org.broadleafcommerce.common.presentation.RequiredOverride;
import org.broadleafcommerce.common.presentation.client.AddMethodType;
import org.broadleafcommerce.common.presentation.client.VisibilityEnum;
import org.broadleafcommerce.common.util.BLCMapUtils;
import org.broadleafcommerce.common.util.DateUtil;
import org.broadleafcommerce.common.util.TypedClosure;
import org.broadleafcommerce.common.vendor.service.type.ContainerShapeType;
import org.broadleafcommerce.common.vendor.service.type.ContainerSizeType;
import org.broadleafcommerce.core.media.domain.Media;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.SQLDelete;
import org.broadleafcommerce.core.catalog.domain.ProductImpl;

@Entity
@Table(name="BLC_PRODUCT")

public class MyproductImpl extends ProductImpl implements MPproduct {

private static final long serialVersionUID = 1L;

@Column(name = "Version")
@AdminPresentation(friendlyName="ProductImpl_Product_Version", order=9, group="ProductImpl_Product_Description", prominent=true, groupOrder=1)
private String version;
public String getVersion()
{
return this.version;
}

public void setVersion(String version)
{
this.version = version;
}

}

2) and then i added following bean under core/src/main/resources/META-INF/persistence.xml file

which will make it look like this:

Code: Select all

<persistence-unit name="blPU" transaction-type="RESOURCE_LOCAL">
        <non-jta-data-source>jdbc/web</non-jta-data-source>
         
         <class>com.marketplace.core.catalog.domain.MyproductImpl</class>
        <exclude-unlisted-classes/>
    </persistence-unit>



3) Then i have added below bean under core/src/main/resources/applicationContext-entity.xml

Code: Select all

<bean id="org.broadleafcommerce.core.catalog.domain.Product" class="com.marketplace.core.catalog.domain.MyproductImpl" scope="prototype"/>


But this thing doesn't work for me

I am getting the HTTP Error:503 in my browser.

Anyone can give me an idea what wrong i did here???

Re: Where is the domain model java classes? [SOLVED]

Posted: Wed Aug 07, 2013 4:51 pm
by elbertbautista
Discussion has been moved and answered in this thread:
viewtopic.php?f=13&t=2041&start=10