Vasily Pankratov
Vasily Pankratov

Reputation: 357

Overriding default Liferay Organization model

I need to customise Liferay's default behaviour: currently, each organization must hava a unique name -- I need to override this behaviour to allow duplicate names. Also, currently there are lots of entities in current Organization_ table in database.

Is it possible to override default model and remove uniqueness constraint while preserving old entities? If yes, how would I approach this?

Of course, I could just add unique suffixes to new saved entities and remove them on display, but this approach seems wierd.

Upvotes: 0

Views: 46

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48077

Is it possible to override default model and remove uniqueness constraint while preserving old entities?

Yes, it surely is, as you can override everything in Liferay

If yes, how would I approach this?

Sarcastic Approach

  1. identify all the places, where Liferay handles Organizations and might implicitly rely on their uniqueness.
  2. hope that I indeed found all the places
  3. evaluate if it's feasible to change all those places to not rely on the uniqueness of the name any more
  4. hope that I found everything, and that my changes make sense
  5. set aside a lot of money to pay for future maintenance of my changes, when I need to adopt the changes to future versions of Liferay.
  6. to 10. determine that it's not worth it and move on to an alternative solution

Alternative Approach:

  1. Determine where this new display is required
  2. implement alternative name, e.g. through Expandos (Custom Fields)
  3. change display where needed to show the Expando values instead of the organization's name.

Upvotes: 2

Related Questions