Affects Version/s: None
Fix Version/s: None
Component/s: Core Infrastructure > Service Builder
We should have a new flag called company-scope at entity level in Service Builder which allows controlling the addition of the companyId field. By default it would be set to non-required. For current tables with the companyId field we should set it to true but ignore the addition of the companyId if it's already added in the service.xml.
When we run service builder:
- If the company-scope flag is set to true (required), we will add the companyId field if it's not already defined in the service.xml
- If the company-scope flag is set to false (non-required) we won't do anything
- If the company-scope flag is absent we will show an error if the companyId is not already defined in the service.xml asking the user to add the flag with the right value (we should document it properly)
Right now the companyId has been included in all tables (
LPS-103034) except the current control tables:
Once this is done, we can create a SF rule (in another separate LPS, not as part of this one) which will enforce Liferay developers to add the companyId field (it will check company-scope set to false or absent and the companyId field is not already present). We will be able to add those tables in a whitelist to bypass this rule for control tables.
|company-scope attribute||companyId column||SB behavior||SF behavior|
|true||present||back off||automatically remove companyId declaration|
|true||absent||automatically add companyId||back off|
|false||present||back off||warn bad combination, suggesting either setting company-scope to true and remove companyId column, or just remove companyId column|
|false||absent||back off||back off|
|absent||present||back off||automatically set company-scope to true and automatically remove companyId declaration|
|absent||absent||back off||automatically set company-scope to false|
The absent support for "company-scope" is just for backward compatibility. Once run SF, it needs to be set to an explicit value.