javasap-commerce-cloudb2b

Can a B2B customer ever be anonymous in Hybris?


Is there any scenario where the B2B customer can be anonymous as well in Hybris?

The method:

public CustomerModel getAnonymousUser() {
    return (CustomerModel)this.getSessionService().executeInLocalView(new SessionExecutionBody() {
        public Object execute() {
            DefaultUserService.this.searchRestrictionService.disableSearchRestrictions();
            return DefaultUserService.this.getUserForUID(UserConstants.ANONYMOUS_CUSTOMER_UID, CustomerModel.class);
        }
    });
}

in DefaultUserService.java suggests that the anonymous user will be of type Customer.

Is there any scenario where it can be of type B2BCustomer?


Solution

  • No, it can't.

    If you check in Backoffice, under Customers node, you can find an anonymous instance, and its type is Customer (if you check in Administration tab).

    B2BCustomer is a subtype of Customer, and they share the same unique attribute: uid. So, you can't have another B2BCustomer instance whose uid is also anonymous.