mo:override, overriding enumeration types
Posted: Tue Jun 18, 2013 4:05 pm
I was trying to override a enumeration type and didn't find much information on it. Once Phillip pointed me in the right direction, i wanted to put this out there incase anyone else need help on it.
Scenario, add a new value to the Inventory Type in the admin screen for a Product.
to do: Create a new class in the admin: org.broadleafcommerce.core.order.service.type.MyInventoryType
Next reference it using mo:overrides
in the top of the xml of applicationContext-admin.xml, verify or add
then append to xsi:schemaLocation
next, add the mo:override tag and configuration
explanation:
the ceilingEntity is ultimately the entity that the information is located at.
field name is the field you are wanting to add to from the ceiling entity point of view.
property is enumeration type, and the value being the class that you just created.
build and start it up.
Scenario, add a new value to the Inventory Type in the admin screen for a Product.
to do: Create a new class in the admin: org.broadleafcommerce.core.order.service.type.MyInventoryType
Code: Select all
public class MyInventoryType extends InventoryType {
private static final long serialVersionUID = 1L;
public static final InventoryType NONE = new InventoryType("PREORDER", "Pre-Publication");
}
Next reference it using mo:overrides
in the top of the xml of applicationContext-admin.xml, verify or add
Code: Select all
xmlns:mo="http://schema.broadleafcommerce.org/mo"
then append to xsi:schemaLocation
Code: Select all
http://schema.broadleafcommerce.org/mo
http://schema.broadleafcommerce.org/mo/mo-2.2.xsd
next, add the mo:override tag and configuration
Code: Select all
<mo:override id="blMetadataOverrides">
<mo:overrideItem ceilingEntity="org.broadleafcommerce.core.catalog.domain.Product">
<mo:field name="defaultSku.inventoryType">
<mo:property name="broadleafEnumeration" value="org.broadleafcommerce.core.order.service.type.MyInventoryType" />
</mo:field>
</mo:overrideItem>
</mo:override>
explanation:
the ceilingEntity is ultimately the entity that the information is located at.
field name is the field you are wanting to add to from the ceiling entity point of view.
property is enumeration type, and the value being the class that you just created.
build and start it up.