Script: Class dw.customer.ProductList

Class ProductList

Represents a list of products (and optionally a gift certificate) that is typically maintained by a customer. This class can be used to implement a number of different storefront features, e.g. shopping list, wish list and gift registry. A product list is always owned by a customer. The owner can be anonymous or a registered customer. The owner can be the person for which items from that list will be purchased (wish list). Or it can be a person who maintains the list, for example a gift registry, on behalf of the bridal couple. Each product list can have a registrant and a co-registrant. A registrant is typically associated with an event related product list such as a gift registry. It holds information about a person associated with the event such as a bride or groom. A shipping address can be associated with this product list to ship the items, e.g. to an event location. A post-event shipping address can be associated to ship items to which could not be delivered on event date. The product list can also hold information about the event date and event location.

Constants

EXPORT_STATUS_EXPORTED : Number=1

Constant for when Export Status is Exported

EXPORT_STATUS_NOTEXPORTED : Number=0

Constant for when Export Status is Not Exported

TYPE_CUSTOM_1 : Number=100

Constant representing a custom list type attribute.

TYPE_CUSTOM_2 : Number=101

Constant representing a custom list type attribute.

TYPE_CUSTOM_3 : Number=102

Constant representing a custom list type attribute.

TYPE_GIFT_REGISTRY : Number=11

Constant representing the gift registry type attribute.

TYPE_SHOPPING_LIST : Number=12

Constant representing the shopping list type attribute.

TYPE_WISH_LIST : Number=10

Constant representing the wish list registry type attribute.

Properties

anonymous : boolean Read Only

Returns true if this product list is owned by an anonymous customer.

coRegistrant : ProductListRegistrant Read Only

The ProductListRegistrant assigned to the coRegistrant attribute or null if this list has no co-registrant.

currentShippingAddress : CustomerAddress Read Only

This is a helper method typically used with an event related list. It provides the appropriate shipping address based on the eventDate. If the current date is after the eventDate, then the postEventShippingAddress is returned, otherwise the shippingAddress is returned. If the eventDate is null, then null is returned.

description : String

A description text that, for example, explains the purpose of this product list.

eventCity : String

For event related uses (e.g. gift registry), this holds the event city.

eventCountry : String

For event related uses (e.g. gift registry), this holds the event country.

eventDate : Date

For event related uses (e.g. gift registry), this holds the date of the event.

eventState : String

For event related uses (e.g. gift registry), this holds the event state.

eventType : String

For event related uses (e.g. gift registry), this holds the type of event, e.g. Wedding, Baby Shower.

exportStatus : EnumValue Read Only

The export status of the product list.
Possible values are: EXPORT_STATUS_NOTEXPORTED, EXPORT_STATUS_EXPORTED.

giftCertificateItem : ProductListItem Read Only

The item in the list that represents a gift certificate.

ID : String Read Only

The unique system generated ID of the object.

items : Collection Read Only

A collection containing all items in the list.

lastExportTime : Date Read Only

The date where this product list has been exported successfully the last time.

name : String

The name of this product list given by its owner.

owner : Customer Read Only

The customer that created and owns the product list.

postEventShippingAddress : CustomerAddress

The shipping address for purchases made after the event date.

productItems : Collection Read Only

A collection containing all items in the list that reference products.

public : boolean

A flag, typically used to determine if the object is searchable by other customers.

publicItems : Collection Read Only

A collection containing all items in the list that are flagged as public.

purchases : Collection Read Only

The aggregated purchases from all the individual items.

registrant : ProductListRegistrant Read Only

The ProductListRegistrant assigned to the registrant attribute or null if this list has no registrant.

shippingAddress : CustomerAddress

Return the address that should be used as the shipping address for purchases made from the list.

type : Number Read Only

An int representing the type of object (e.g. wish list, gift registry). This is set at object creation time.

Constructor Summary

This class does not have a constructor, so you cannot create it directly.

Method Summary

createCoRegistrant() : ProductListRegistrant

Create a ProductListRegistrant and assign it to the coRegistrant attribute of the list.

createGiftCertificateItem() : ProductListItem

Create an item in the list that represents a gift certificate.

createProductItem(product : Product) : ProductListItem

Create an item in the list that references the specified product.

createRegistrant() : ProductListRegistrant

Create a ProductListRegistrant and assign it to the registrant attribute of the list.

getCoRegistrant() : ProductListRegistrant

Returns the ProductListRegistrant assigned to the coRegistrant attribute or null if this list has no co-registrant.

getCurrentShippingAddress() : CustomerAddress

This is a helper method typically used with an event related list.

getDescription() : String

Returns a description text that, for example, explains the purpose of this product list.

getEventCity() : String

For event related uses (e.g.

getEventCountry() : String

For event related uses (e.g.

getEventDate() : Date

For event related uses (e.g.

getEventState() : String

For event related uses (e.g.

getEventType() : String

For event related uses (e.g.

getExportStatus() : EnumValue

Returns the export status of the product list.
Possible values are: EXPORT_STATUS_NOTEXPORTED, EXPORT_STATUS_EXPORTED.

getGiftCertificateItem() : ProductListItem

Returns the item in the list that represents a gift certificate.

getID() : String

Returns the unique system generated ID of the object.

getItem(ID : String) : ProductListItem

Returns the item from the list that has the specified ID.

getItems() : Collection

Returns a collection containing all items in the list.

getLastExportTime() : Date

Returns the date where this product list has been exported successfully the last time.

getName() : String

Returns the name of this product list given by its owner.

getOwner() : Customer

Returns the customer that created and owns the product list.

getPostEventShippingAddress() : CustomerAddress

Returns the shipping address for purchases made after the event date.

getProductItems() : Collection

Returns a collection containing all items in the list that reference products.

getPublicItems() : Collection

Returns a collection containing all items in the list that are flagged as public.

getPurchases() : Collection

Returns the aggregated purchases from all the individual items.

getRegistrant() : ProductListRegistrant

Returns the ProductListRegistrant assigned to the registrant attribute or null if this list has no registrant.

getShippingAddress() : CustomerAddress

Return the address that should be used as the shipping address for purchases made from the list.

getType() : Number

Returns an int representing the type of object (e.g.

isAnonymous() : boolean

Returns true if this product list is owned by an anonymous customer.

isPublic() : boolean

A flag, typically used to determine if the object is searchable by other customers.

removeCoRegistrant() : void

Removes the ProductListRegistrant assigned to the coRegistrant attribute.

removeItem(item : ProductListItem) : void

Removes the specified item from the list.

removeRegistrant() : void

Removes the ProductListRegistrant assigned to the registrant attribute.

setDescription(description : String) : void

Set the description of this product list.

setEventCity(eventCity : String) : void

Set the event city to which this product list is related.

setEventCountry(eventCountry : String) : void

Set the event country to which this product list is related.

setEventDate(eventDate : Date) : void

Set the date of the event to which this product list is related.

setEventState(eventState : String) : void

Set the event state to which this product list is related.

setEventType(eventType : String) : void

Set the event type for which this product list was created by the owner.

setName(name : String) : void

Set the name of this product list.

setPostEventShippingAddress(address : CustomerAddress) : void

This is typically used by an event related list (e.g.

setPublic(flag : boolean) : void

Makes this product list visible to other customers or hides it.

setShippingAddress(address : CustomerAddress) : void

Associate an address, used as the shipping address for purchases made from the list.

Methods inherited from class ExtensibleObject

describe, getCustom

Methods inherited from class PersistentObject

getCreationDate, getLastModified, getUUID

Methods inherited from class Object

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Method Detail

createCoRegistrant

createCoRegistrant() : ProductListRegistrant

Create a ProductListRegistrant and assign it to the coRegistrant attribute of the list. An exception is thrown if the list already has a coRegistrant assigned to it.

Returns:

the created ProductListRegistrant instance.

Throws:

CreateException - if one already exists

createGiftCertificateItem

createGiftCertificateItem() : ProductListItem

Create an item in the list that represents a gift certificate. A list may only contain a single gift certificate, so an exception is thrown if one already exists in the list.

Returns:

the created item.

Throws:

CreateException - if a gift certificate item already exists in the list.


createProductItem

createProductItem(product : Product) : ProductListItem

Create an item in the list that references the specified product.

Parameters:

product - the product to use to create the list item.

Returns:

the created item.


createRegistrant

createRegistrant() : ProductListRegistrant

Create a ProductListRegistrant and assign it to the registrant attribute of the list. An exception is thrown if the list already has a registrant assigned to it.

Returns:

the created ProductListRegistrant instance.

Throws:

CreateException - if one already exists


getCoRegistrant

getCoRegistrant() : ProductListRegistrant

Returns the ProductListRegistrant assigned to the coRegistrant attribute or null if this list has no co-registrant.

Returns:

the ProductListRegistrant assigned to the coRegistrant attribute or null if this list has no co-registrant.


getCurrentShippingAddress

getCurrentShippingAddress() : CustomerAddress

This is a helper method typically used with an event related list. It provides the appropriate shipping address based on the eventDate. If the current date is after the eventDate, then the postEventShippingAddress is returned, otherwise the shippingAddress is returned. If the eventDate is null, then null is returned.

Returns:

the appropriate address, as described above.


getDescription

getDescription() : String

Returns a description text that, for example, explains the purpose of this product list.

Returns:

a description text explaining the purpose of this product list. Returns an empty string if the description is not set.


getEventCity

getEventCity() : String

For event related uses (e.g. gift registry), this holds the event city.

Returns:

the event city. The event city or an empty string if no event city is set.


getEventCountry

getEventCountry() : String

For event related uses (e.g. gift registry), this holds the event country.

Returns:

the event country. The event country or an empty string if no event country is set.


getEventDate

getEventDate() : Date

For event related uses (e.g. gift registry), this holds the date of the event.

Returns:

the date of the event.


getEventState

getEventState() : String

For event related uses (e.g. gift registry), this holds the event state.

Returns:

the event state. The event state or an empty string if no event state is set.


getEventType

getEventType() : String

For event related uses (e.g. gift registry), this holds the type of event, e.g. Wedding, Baby Shower.

Returns:

the type of event. Returns an empty string, if not set.


getExportStatus

getExportStatus() : EnumValue

Returns the export status of the product list.
Possible values are: EXPORT_STATUS_NOTEXPORTED, EXPORT_STATUS_EXPORTED.

Returns:

Product list export status


getGiftCertificateItem

getGiftCertificateItem() : ProductListItem

Returns the item in the list that represents a gift certificate.

Returns:

the gift certificate item, or null if it doesn't exist.


getID

getID() : String

Returns the unique system generated ID of the object.

Returns:

the ID of object.


getItem

getItem(ID : String) : ProductListItem

Returns the item from the list that has the specified ID.

Parameters:

ID - the product list item identifier.

Returns:

the specified item, or null if it's not found in the list.


getItems

getItems() : Collection

Returns a collection containing all items in the list.

Returns:

all items.


getLastExportTime

getLastExportTime() : Date

Returns the date where this product list has been exported successfully the last time.

Returns:

The time of the last successful export or null if this product list was not exported yet.


getName

getName() : String

Returns the name of this product list given by its owner.

Returns:

the name of this product list. Returns an empty string if the name is not set.


getOwner

getOwner() : Customer

Returns the customer that created and owns the product list.

Returns:

Owning customer


getPostEventShippingAddress

getPostEventShippingAddress() : CustomerAddress

Returns the shipping address for purchases made after the event date.

Returns:

the shipping address for purchases made after the event date. Returns null if no post-event shipping address is associated.


getProductItems

getProductItems() : Collection

Returns a collection containing all items in the list that reference products.

Returns:

all product items.


getPublicItems

getPublicItems() : Collection

Returns a collection containing all items in the list that are flagged as public.

Returns:

all public items.


getPurchases

getPurchases() : Collection

Returns the aggregated purchases from all the individual items.

Returns:

purchases


getRegistrant

getRegistrant() : ProductListRegistrant

Returns the ProductListRegistrant assigned to the registrant attribute or null if this list has no registrant.

Returns:

the ProductListRegistrant assigned to the registrant attribute or null if this list has no registrant.


getShippingAddress

getShippingAddress() : CustomerAddress

Return the address that should be used as the shipping address for purchases made from the list.

Returns:

the shipping address. The shipping address of this list or null if no address is associated.


getType

getType() : Number

Returns an int representing the type of object (e.g. wish list, gift registry). This is set at object creation time.

Returns:

the type of object.


isAnonymous

isAnonymous() : boolean

Returns true if this product list is owned by an anonymous customer.

Returns:

true if the owner of this product list is anonymous, false otherwise.


isPublic

isPublic() : boolean

A flag, typically used to determine if the object is searchable by other customers.

Returns:

true if the product list is public. False otherwise.


removeCoRegistrant

removeCoRegistrant() : void

Removes the ProductListRegistrant assigned to the coRegistrant attribute.


removeItem

removeItem(item : ProductListItem) : void

Removes the specified item from the list. This will also cause all purchase information associated with that item to be removed.

Parameters:

item - The item to remove.


removeRegistrant

removeRegistrant() : void

Removes the ProductListRegistrant assigned to the registrant attribute.


setDescription

setDescription(description : String) : void

Set the description of this product list.

Parameters:

description - The description of this product list. The description can have up to 256 characters, longer descriptions get truncated. If an empty string is provided, the description gets set to null.


setEventCity

setEventCity(eventCity : String) : void

Set the event city to which this product list is related.

Parameters:

eventCity - The event city can have up to 256 characters, longer event city get truncated. If an empty string is provided, the event city gets set to null.


setEventCountry

setEventCountry(eventCountry : String) : void

Set the event country to which this product list is related.

Parameters:

eventCountry - The event country can have up to 256 characters, longer event country get truncated. If an empty string is provided, the event country gets set to null.


setEventDate

setEventDate(eventDate : Date) : void

Set the date of the event to which this product list is related.

Parameters:

eventDate - The event date or null if no event date should be available.


setEventState

setEventState(eventState : String) : void

Set the event state to which this product list is related.

Parameters:

eventState - The event state can have up to 256 characters, longer event state get truncated. If an empty string is provided, the event state gets set to null.


setEventType

setEventType(eventType : String) : void

Set the event type for which this product list was created by the owner.

Parameters:

eventType - The event type can have up to 256 characters, longer event type get truncated. If an empty string is provided, the event type gets set to null.


setName

setName(name : String) : void

Set the name of this product list.

Parameters:

name - The name of this product list. The name can have up to 256 characters, longer names get truncated. If an empty string is provided, the name gets set to null.


setPostEventShippingAddress

setPostEventShippingAddress(address : CustomerAddress) : void

This is typically used by an event related list (e.g. gift registry) to specify a shipping address for purchases made after the event date.

Parameters:

address - The shipping address.


setPublic

setPublic(flag : boolean) : void

Makes this product list visible to other customers or hides it.

Parameters:

flag - If true, this product list becomes visible to other customers. If false, this product list can only be seen and searched by its owner.


setShippingAddress

setShippingAddress(address : CustomerAddress) : void

Associate an address, used as the shipping address for purchases made from the list.

Parameters:

address - The shipping address.