Class Customer

All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
GeneratedB2BCustomer

public class Customer extends GeneratedCustomer
The hybris Platform customer item.

Since 3.1-u6 the automatic generation of customer id is removed for getting better performance at customer creation. Nevertheless, if you want to have an automated customer id generation you can add the following code to your own customer type:

 protected Item createItem(final SessionContext ctx, final ComposedType type, final ItemAttributeMap allAttributes)
                throws JaloBusinessException
 {
        if (allAttributes.get(Customer.CUSTOMERID) == null)
    {
                allAttributes.put(Customer.CUSTOMERID, UserManager.getInstance().generateCustomerID());
    }
        return super.createItem(ctx, type, allAttributes);
 }
 

In case you do not have an own customer type add the following code to your manager class:

 public void beforeItemCreation(final SessionContext ctx, final ComposedType type, final ItemAttributeMap attributes)
                throws JaloBusinessException
 {
        if (TypeManager.getInstance().getComposedType(Customer.class).isAssignableFrom(type))
    {
                if (attributes.get(Customer.CUSTOMERID) == null)
        {
                        attributes.put(Customer.CUSTOMERID, UserManager.getInstance().generateCustomerID());
        }
    }
        super.beforeItemCreation(ctx, type, attributes);
 }
 

Also see PLA-6951.

See Also: