Class Customer

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.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:
    Serialized Form
    • Field Detail

      • LOGIN_ANONYMOUS_ALWAYS_DISABLED

        public static final java.lang.String LOGIN_ANONYMOUS_ALWAYS_DISABLED
        Configuration constant for login.anonymous.always.disabled/ which allows changing the (default) disabling of the anonymous account.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Customer

        public Customer()
    • Method Detail

      • registerAsJaloObject

        @Deprecated
        public static void registerAsJaloObject()
        Deprecated.
        since ages - this is done automatically on loading hybris platform implementation
        Internal.
      • isAdmin

        @Deprecated
        public boolean isAdmin()
        Deprecated.
        Description copied from class: User
        Checks whether this user has admin status. This is true if the user is the admin user or is (even recursive) member of the admin group.
        Overrides:
        isAdmin in class User
      • isLoginDisabled

        @Deprecated
        public java.lang.Boolean isLoginDisabled​(SessionContext ctx)
        Deprecated.
        since ages - Method doesn't check for anonymous login or if it is disabled before getting the attribute value anymore. See JaloSession.performLogin(String, String, Map)
        Overwritten to always treat the anonymous account locked as long as the login.anonymous.always.disabled configuration property is set to true (which is also the default value).
        Overrides:
        isLoginDisabled in class GeneratedUser
        Returns:
        the loginDisabled - Determines whether user is allowed to login to system.
      • setLoginDisabled

        public void setLoginDisabled​(SessionContext ctx,
                                     java.lang.Boolean disabled)
        Overwritten to log a warning as long as login.anonymous.always.disabled is set to true.
        Overrides:
        setLoginDisabled in class User
        disabled - the loginDisabled - Determines whether user is allowed to login to system.