Home Forums Business Model Classes Best approach to move attribute from Person to Entity

Viewing 3 reply threads
  • Author
    Posts
    • #15244
      Mark De CarvalhoMark De Carvalho
      Participant

      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
    • #15848
      Trevor BallTrevor Ball
      Participant

      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
    • #16015
      Ed ShawEd Shaw
      Keymaster

      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
    • #16021

      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
Viewing 3 reply threads
  • You must be logged in to reply to this topic.