Home › Forums › Business Model › Classes › Best approach to move attribute from Person to Entity
- This topic has 3 replies, 4 voices, and was last updated 3 years, 9 months ago by Community Manager.
-
AuthorPosts
-
-
January 22, 2021 at 2:16 pm #15244Mark De CarvalhoParticipant
What is the recommended approach for moving an attribute up to Entity from Person? In my example, i want to move serviceLevel to Entity as I want it to also apply to HH and Companies (and any child of entity). Right now its only defined on Person. I have it working by customizing Person and Entity and moving the attribute, but we are worried about upgrades in the future so would prefer to not customize these classes. I tried Augments, but that only allows me to add the attribute to Entity, but does not allow removing from Person through Augment. What is the best practice for this situation?
0 -
February 20, 2021 at 4:57 pm #15848Trevor BallParticipant
I think the customization approach is the best option, at least in the near term. Currently, virtually every client project customizes the main classes (including Entity) anyway.
In addition or instead, one could consider logging a feature request to move serviceLevel to Entity in core product, although of course that would introduce a (potentially long) delay before you could implement your project if you chose to wait for it. I tend to agree it makes sense for it to be there, and I’m not sure why it wasn’t put there initially; to answer that we’d probably have to ask a product manager from the ancient times. 😉
0 -
February 22, 2021 at 6:50 pm #16015Ed ShawKeymaster
While the customization approach is the most expedient, it isn’t the best for long term maintenance. Our current best practices recommend augments if they fit the purpose. In this case, if we just implement the same definition of the attribute from on a parent class, (Entity) there should be no issue with it being in the child class (Person) as well i.e. no need to delete it from Person and just Augment it in to Entity.
But…
It looks to me like serviceLevel already exists in Entity. It is added through the ENTITY_TOUCH_TYPE aspect’s Entity pointcut. This is where the serviceLevel attribute and it’s persistence is defined (along with other service level stuff). Looks to me like the only reason that it was overridden on Person was to change the updateAudit property from “auto” to “true”.
0 -
February 22, 2021 at 7:00 pm #16021Community ManagerKeymaster
Nice find Ed !
That said, if it were another scenario … you wouldn’t “remove” the attribute from Person.meta.
You would just add it to Entity.meta (through augments) ; that should work and just override is in Person.meta similar to how its already done.
0
-
-
AuthorPosts
- You must be logged in to reply to this topic.