I'm working on the extension of the StructuredContentImpl (Broadleaf class). You can find the code below.
Code: Select all
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "MY_SC")
@EntityListeners(value = { AdminAuditableListener.class })
@AdminPresentationClass(friendlyName="MyStructuredContent", ceilingDisplayEntity="org.broadleafcommerce.cms.structure.domain.StructuredContent", populateToOneFields = PopulateToOneFieldsEnum.TRUE)
public class MyStructuredContent extends StructuredContentImpl {
private static final long serialVersionUID = 1L;
@ManyToMany(targetEntity = Product.class)
@JoinTable(name = "MY_SC_PRODUCT_XREF", joinColumns = @JoinColumn(name = "SC_ID", referencedColumnName = "SC_ID"), inverseJoinColumns = @JoinColumn(name = "PRODUCT_ID", referencedColumnName = "PRODUCT_ID"))
@BatchSize(size = 50)
protected List<Product> allProduct = new ArrayList<Product>();
/**
* @return the allProduct
*/
public List<Product> getAllProduct() {
return allProduct;
}
/**
* @param allProduct the allProduct to set
*/
public void setAllProduct(List<Product> allProduct) {
this.allProduct = allProduct;
}
}
I want to attached some products to a structured content in order to use them in the Front Office. I have already read this subject : viewtopic.php?f=12&t=530&p=1572&hilit=structuredcontentimpl#p1572 but I haven't find the solution !
My main issue is when I want to add an instance of MyStructuredContent in the admin, the field "locale" isn't in the form... This field seems to be added in the StructuredContentCustomPersistenceHandler but I don't know if this Handler is used with an instance of MyStructuredContent.
Do you have any suggestions ?
Thank you for your help !
Pierre-Baptiste.