public class Utils extends Utils
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static GenericEcomUser |
clone(GenericEcomUser user)
In case of
GuestUser pas back original; since its Guest. |
static String |
deriveUserContacts(Order order,
String defaultFieldToReturn,
Map dataMap)
Utility to derive contact details from an
Order |
static Address |
getAddress(Order order,
String type)
Convenience helper to extract the Address from an Order.
|
static Map<String,Address> |
getAddresses(Order order)
Convenience helper to extract the Address from an Order.
|
static Address |
getPreferredAddress(Address preferredAddress,
Address... addresses)
Get the preferred Address from a List
|
static IGenericEcomUser |
getUserForLocalUse(String sessionUserId,
org.apache.wicket.protocol.http.WebRequest requst,
Class<? extends GenericEcomUser> userClass)
Guarantees a
IGenericEcomUser for the session; and clones the User object if its a RegisteredUser to ensure
the session user variable is not affected. |
static IGenericEcomUser |
initUserWithAddressTypes(IGenericEcomUser user,
List<String> addressTypes)
For a user preinitialize any Address fields to ensure the
Address types are not null |
static void |
transitionUser(IGenericEcomUser guest,
RegisteredUser ru)
|
getAttributeValue, getEntityValue, getInstance, getObjectWithFieldValue, getProductWithAttribute, getResourceUrl, getResourceUrl, getResourceUrls, getResourceUrls, sizeToString
public static void transitionUser(IGenericEcomUser guest, RegisteredUser ru)
public static GenericEcomUser clone(GenericEcomUser user) throws Exception
GuestUser
pas back original; since its Guest.
in case of RegisteredUser
create a Deep Copy.user
- as GenericEcomUser
Exception
public static IGenericEcomUser getUserForLocalUse(String sessionUserId, org.apache.wicket.protocol.http.WebRequest requst, Class<? extends GenericEcomUser> userClass)
IGenericEcomUser
for the session; and clones the User object if its a RegisteredUser
to ensure
the session user variable is not affected.sessionUserId
- as an Id to identify a GuestUser
requst
- as WebRequest
userClass
- as the Class to instantiate with the id if no user existspublic static IGenericEcomUser initUserWithAddressTypes(IGenericEcomUser user, List<String> addressTypes)
Address
types are not nulluser
- as IGenericEcomUser
, typically from session. See WicketUtils.getUserFromSession(org.apache.wicket.Request, Class)
addressTypes
- as List
of Strings, each representing Address.getType()
. Example Address.TYPE_BILLING
public static String deriveUserContacts(Order order, String defaultFieldToReturn, Map dataMap)
Order
order
- as Order
from which to derive the contact infodefaultFieldToReturn
- as String; field to return. Example: email @nullable truedataMap
- @nullable true; the Map in which all other data will be filled inpublic static Address getAddress(Order order, String type)
order
- as Ordertype
- public static Address getPreferredAddress(Address preferredAddress, Address... addresses)
Copyright © 2018. All rights reserved.