Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-103481

Service Builder should automatically add CompanyId field for non-control tables

Details

    Description

      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:

      • ClassName_
      • ClusterGroup
      • Configuration_
      • Counter
      • Country
      • ListType
      • PortalPreferences
      • QUARTZ_BLOB_TRIGGERS
      • QUARTZ_CALENDARS
      • QUARTZ_CRON_TRIGGERS
      • QUARTZ_FIRED_TRIGGERS
      • QUARTZ_JOB_DETAILS
      • QUARTZ_LOCKS
      • QUARTZ_PAUSED_TRIGGER_GRPS
      • QUARTZ_SCHEDULER_STATE
      • QUARTZ_SIMPLE_TRIGGERS
      • QUARTZ_SIMPROP_TRIGGERS
      • QUARTZ_TRIGGERS
      • Region
      • Release_
      • ResourceAction
      • ServiceComponent

      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.

       

      Behavior chart

       

      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.

       

      Attachments

        Issue Links

          Activity

            People

              support-lep@liferay.com SE Support
              alberto.chaparro Alberto Chaparro
              Kiyoshi Lee Kiyoshi Lee
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Packages

                  Version Package