Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 934A0200C6F for ; Tue, 9 May 2017 10:29:36 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 91C3B160BB6; Tue, 9 May 2017 08:29:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 888D1160BB3 for ; Tue, 9 May 2017 10:29:35 +0200 (CEST) Received: (qmail 69074 invoked by uid 500); 9 May 2017 08:29:34 -0000 Mailing-List: contact dev-help@ofbiz.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ofbiz.apache.org Delivered-To: mailing list dev@ofbiz.apache.org Received: (qmail 69063 invoked by uid 99); 9 May 2017 08:29:34 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2017 08:29:34 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id F05341813D7 for ; Tue, 9 May 2017 08:29:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.999 X-Spam-Level: ** X-Spam-Status: No, score=2.999 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 8xZBz8gTq3A6 for ; Tue, 9 May 2017 08:29:31 +0000 (UTC) Received: from mail.ecomify.de (mail.ecomify.de [178.77.98.9]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 4CBD25F569 for ; Tue, 9 May 2017 08:29:31 +0000 (UTC) Received: from localhost (mail.ecomify.de [127.0.0.1]) by mail.ecomify.de (Postfix) with ESMTP id 429CF6D for ; Tue, 9 May 2017 10:29:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at ecomify.de Received: from mail.ecomify.de ([127.0.0.1]) by localhost (lvps178-77-98-9.dedicated.hosteurope.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PnBhHGgHLzjL for ; Tue, 9 May 2017 10:29:23 +0200 (CEST) From: Martin Becker Content-Type: multipart/signed; boundary="Apple-Mail=_646C4AAF-3335-40E9-B26F-29A06B847D76"; protocol="application/pkcs7-signature"; micalg=sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Unused attributes of ShoppingCart and ShoppingCartItem Date: Tue, 9 May 2017 10:29:22 +0200 References: To: dev@ofbiz.apache.org In-Reply-To: Message-Id: archived-at: Tue, 09 May 2017 08:29:36 -0000 --Apple-Mail=_646C4AAF-3335-40E9-B26F-29A06B847D76 Content-Type: multipart/alternative; boundary="Apple-Mail=_658285AF-C670-44C0-9A62-2AB694DF8886" --Apple-Mail=_658285AF-C670-44C0-9A62-2AB694DF8886 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Yes indeed, Deepak. Some additional infos: * With the definition of ShoppingCartItem.attributeNames you are able to = get context entries auto added to the =E2=80=9Eattributes=E2=80=9C Map = within ShoppingCartHelper.addToCart. Such attributes may than be used, = as described by Deepak, to be persisted anywhere or to just influence = the checkout process. Those attributes are not necessarily to be = persistet, they may be temporarily attributes like tokens or else just = for the current checkout logic. * The automatic adding of orderItemAttributes is controlled by the = order.properties property =E2=80=9Eorder.item.attr.prefix=E2=80=9C. All = context entries with this prefix (e.g. from an addToCart form) get added = to the orderItemAttributes by ShoppingCartHelper.addToCart method. * It is also possible to distinguish cart items by different attribute = (and orderItemAttribute) values because of their relevance within the = ShoppingCartItem.equals method In my opinion the attribute maps differ fairly from the straightly = domain model orderAttribute/orderItemAttribute ones and are not = obsolete. Regards Martin Becker www.ecomify.de > Am 09.05.2017 um 09:02 schrieb Deepak Dixit = : >=20 > I think purpose of attributes is different, if you want to set some = custom > attribute to implement custom flow so you can use attribute. > These attribute value can be store in any entity or can be used to = perform > business logic implementation as well. >=20 > Like in case of ShoppingCartItem, we set fromInventoryItemId as item > attribute and while creation order item we copy this field to > OrderItem.fromInventoryItem. >=20 > And if you want to store attribute in order or item level then you use > orderAttributes or orderItemAttributes. >=20 > Thanks & Regards > -- > Deepak Dixit > www.hotwaxsystems.com >=20 > On Tue, May 9, 2017 at 10:31 AM, Suraj Khurana < > suraj.khurana@hotwaxsystems.com> wrote: >=20 >> Hi Devs, >>=20 >> I am curious about some protected data members of ShoppingCartItem = and >> ShoppingCart class. >> ShoppingCartItem contains: >>=20 >>=20 >>=20 >> *private Map orderItemAttributes =3D null;private = Map> Object> attributes =3D null;* >> While ShoppingCart have: >>=20 >> *private Map orderAttributes =3D = FastMap.newInstance();* >> *private Map attributes =3D FastMap.newInstance();* >>=20 >> I think orderAttributes and orderItemAttributes are pretty clear by = the >> name itself, what is the actual use of *attributes* data member for = each >> class. >>=20 >> Can this be removed and replaced with orderAttribute or = orderItemAttribute >> itself? >>=20 >> -- >> Thanks and Regards, >> Suraj Khurana >> Sr. Enterprise Software Engineer >> HotWax Systems - The global leader in innovative enterprise commerce >> solutions powered by Apache OFBiz. >>=20 --Apple-Mail=_658285AF-C670-44C0-9A62-2AB694DF8886 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Yes indeed, Deepak.

Some additional infos:

* With the definition of = ShoppingCartItem.attributeNames you are able to get context entries auto = added to the =E2=80=9Eattributes=E2=80=9C Map within = ShoppingCartHelper.addToCart. Such attributes may than be used, as = described by Deepak, to be persisted anywhere or to just influence the = checkout process. Those attributes are not necessarily to be persistet, = they may be temporarily attributes like tokens or else just for the = current checkout logic.

* The automatic adding of orderItemAttributes is controlled = by the order.properties property =E2=80=9Eorder.item.attr.prefix=E2=80=9C.= All context entries with this prefix (e.g. from an addToCart form) get = added to the orderItemAttributes by ShoppingCartHelper.addToCart = method.

* It = is also possible to distinguish cart items by different attribute (and = orderItemAttribute) values because of their relevance within the = ShoppingCartItem.equals method

In my opinion the attribute maps differ = fairly from the straightly domain model = orderAttribute/orderItemAttribute ones and are not obsolete.

Regards

Martin Becker


Am 09.05.2017 um 09:02 schrieb = Deepak Dixit <deepak.dixit@hotwaxsystems.com>:

I = think purpose of attributes is different, if you want to set some = custom
attribute to implement custom flow so you can use = attribute.
These attribute value can be store in any = entity or can be used to perform
business logic = implementation as well.

Like in case of = ShoppingCartItem, we set fromInventoryItemId as item
attribute and while creation order item we copy this field = to
OrderItem.fromInventoryItem.

And if you want to store attribute in order or item level = then you use
orderAttributes or orderItemAttributes.

Thanks & Regards
--
Deepak Dixit
www.hotwaxsystems.com

On = Tue, May 9, 2017 at 10:31 AM, Suraj Khurana <
suraj.khurana@hotwaxsystems.com> wrote:

Hi Devs,
I am curious about some protected data members of = ShoppingCartItem and
ShoppingCart class.
ShoppingCartItem contains:



*private Map<String, String> = orderItemAttributes =3D null;private Map<String,
Object> attributes =3D null;*
While = ShoppingCart have:

*private Map<String, = String> orderAttributes =3D FastMap.newInstance();*
*private Map<String, Object> attributes =3D = FastMap.newInstance();*

I think = orderAttributes and orderItemAttributes are pretty clear by the
name itself, what is the actual use of *attributes* data = member for each
class.

Can = this be removed and replaced with orderAttribute or = orderItemAttribute
itself?

--
Thanks and Regards,
Suraj = Khurana
Sr. Enterprise Software Engineer
HotWax Systems - The global leader in innovative enterprise = commerce
solutions powered by Apache OFBiz.


= --Apple-Mail=_658285AF-C670-44C0-9A62-2AB694DF8886-- --Apple-Mail=_646C4AAF-3335-40E9-B26F-29A06B847D76 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIK8zCCBQkw ggPxoAMCAQICEDB2NhJGxtzmF8Qe2xj7zVMwDQYJKoZIhvcNAQELBQAwdTELMAkGA1UEBhMCSUwx FjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4xKTAnBgNVBAsTIFN0YXJ0Q29tIENlcnRpZmljYXRpb24g QXV0aG9yaXR5MSMwIQYDVQQDExpTdGFydENvbSBDbGFzcyAxIENsaWVudCBDQTAeFw0xNjExMTQx NjA5MjhaFw0yMDAyMTQxNjA5MjhaMEwxITAfBgNVBAMMGG1hcnRpbi5iZWNrZXJAZWNvbWlmeS5k ZTEnMCUGCSqGSIb3DQEJARYYbWFydGluLmJlY2tlckBlY29taWZ5LmRlMIIBIjANBgkqhkiG9w0B AQEFAAOCAQ8AMIIBCgKCAQEAostyxMIRhYkbMRbBXCbrIG+9QKShrNduUqQ99nCwHcoHCDsXb52f XM/LTCGkHCuWBgQyU0zUycq5WGO3cwJcnAaucckfkY8U8dpd7oFhwYZ0EEJTwgyvkH+DQPeoKqV8 w22/7yR+oNf8QzHdCOpVcFhcpoo1/BhB0k8J7fkMbOxSpcHhgyTc51zE+gjqa49FvjmgXWacfJBq 2l3noe1JBW++biMao0+pwuLxTTNo9fFblqqZwySgW/WevXNSanwD9tQqRBn4EN8bSReL0Q1pPrxB Lu6yNRvJkwn+3RTwX8j91F8azgPcRRf3iCZvQ8bg2vpuw8yL592EXQWiHvYRkwIDAQABo4IBvDCC AbgwDgYDVR0PAQH/BAQDAgSwMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAJBgNVHRME AjAAMB0GA1UdDgQWBBTMWcPzvO/uaUol0V8mdUQqf/hmdDAfBgNVHSMEGDAWgBQkgWw5Yb5JD4+3 G0YrySi1J0htaDBvBggrBgEFBQcBAQR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