Bug 109206 - Change "TYPE" to 'BASE_DATA_OBJECT_TYPE" throughout CMS domain classes
Change "TYPE" to 'BASE_DATA_OBJECT_TYPE" throughout CMS domain classes
Status: CLOSED RAWHIDE
Product: Red Hat Enterprise CMS
Classification: Retired
Component: other (Show other bugs)
nightly
All Linux
medium Severity medium
: ---
: ---
Assigned To: Justin Ross
Jon Orris
:
Depends On:
Blocks: 113496
  Show dependency treegraph
 
Reported: 2003-11-05 12:02 EST by Daniel Berrange
Modified: 2007-04-18 12:59 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-11 16:03:11 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2003-11-05 12:02:55 EST
Description of problem:

The convention for naming the static string constant refering to the
object type is "BASE_DATA_OBJECT_TYPE". Unfortunately a number of CMS
domain classes decided to change to just 'TYPE'. So, for example, if 
you reference ContentSection.BASE_DATA_OBJECT_TYPE, you'll in fact be
getting the variable from ACSObjects. This has been a source of at
least 5 really serious bugs in deployments in recent times.

The latest today concerns this innocent looking code:

   DataQuery q = session.retrieve
         ( ContentSection.BASE_DATA_OBJECT_TYPE );
   q.addFilter( PermissionService.getFilterQuery
        ( session.getFilterFactory(), "id", newItem, user.getOID() ) );
            
   // If so, display a content section link
   if( q.next() ) {

This just filters the list of installed content sections by 'NEW_ITEM'
privilege. AWOOGA AWOOGA. No it doesn't, since ContentSection doesn't
define BASE_DATA_OBJECT_TYPE, your in fact retreiving & filtering
*every* single damn object in acs_objects.

On oracle this is reasonably slow for a typical production data set
(ie of the order 250 ms), but on PG, this is astronomically slow
(think 5 minutes).

I believe Aram's permissions denorm work will fix the actuall speed of
the permmissions query, but the pressing issue is that we should
immediately rename all occurrances of TYPE to BASE_DATA_OBJECT_TYPE,
before we have even more wierd bugs.

NB, renaming TYPE is preferable to simply adding

  static String BASE_DATA_OBJECT_TYPE = TYPE

since it causes all usage to immediately become apparent at compile
time & will discourage anyone else from following this bogus
convention again.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Justin Ross 2004-03-02 18:01:08 EST
Changed at 40981.
Comment 2 Daniel Berrange 2004-03-04 07:01:14 EST
This is no where near fixed. The partial change at 40981 will make
things even worse, because now things are inconsistent between
ContentItem & its subclasses

dan@camden$ find */src -name *.java | xargs egrep "public static final
String TYPE" 
cms/src/com/arsdigita/cms/Article.java:    public static final String
TYPE = "com.arsdigita.cms.Article";
cms/src/com/arsdigita/cms/ArticleImageAssociation.java:    public
static final String TYPE = "com.arsdigita.cms.ArticleImageAssociation";
cms/src/com/arsdigita/cms/Asset.java:    public static final String
TYPE = "com.arsdigita.cms.Asset";
cms/src/com/arsdigita/cms/AuthoringKit.java:    public static final
String TYPE = "com.arsdigita.cms.AuthoringKit";
cms/src/com/arsdigita/cms/AuthoringKitStepAssociation.java:    public
static final String TYPE =
"com.arsdigita.cms.AuthoringKitStepAssociation";
cms/src/com/arsdigita/cms/AuthoringStep.java:    public static final
String TYPE = "com.arsdigita.cms.AuthoringStep";
cms/src/com/arsdigita/cms/CategoryTemplateMapping.java:    public
static final String TYPE =
cms/src/com/arsdigita/cms/ContentBundle.java:    public static final
String TYPE = "com.arsdigita.cms.ContentBundle";
cms/src/com/arsdigita/cms/ContentPage.java:    public static final
String TYPE = "com.arsdigita.cms.ContentPage";
cms/src/com/arsdigita/cms/ContentSection.java:    public static final
String TYPE = "com.arsdigita.cms.ContentSection";
cms/src/com/arsdigita/cms/ContentType.java:    public static final
String TYPE = "com.arsdigita.cms.ContentType";
cms/src/com/arsdigita/cms/ContentTypeLifecycleDefinition.java:   
public static final String TYPE =
"com.arsdigita.cms.ContentTypeLifecycleDefinition";
cms/src/com/arsdigita/cms/ContentTypeWorkflowTemplate.java:    public
static final String TYPE =
cms/src/com/arsdigita/cms/FileAsset.java:    public static final
String TYPE = "com.arsdigita.cms.FileAsset";
cms/src/com/arsdigita/cms/Folder.java:    public static final String
TYPE = "com.arsdigita.cms.Folder";
cms/src/com/arsdigita/cms/ImageAsset.java:    public static final
String TYPE = "com.arsdigita.cms.ImageAsset";
cms/src/com/arsdigita/cms/ItemTemplateMapping.java:    public static
final String TYPE =
cms/src/com/arsdigita/cms/ReusableImageAsset.java:    public static
final String TYPE = "com.arsdigita.cms.ReusableImageAsset";
cms/src/com/arsdigita/cms/SectionTemplateMapping.java:    public
static final String TYPE =
cms/src/com/arsdigita/cms/StandalonePage.java:    public static final
String TYPE = "com.arsdigita.cms.StandalonePage";
cms/src/com/arsdigita/cms/Template.java:    public static final String
TYPE = "com.arsdigita.cms.Template";
cms/src/com/arsdigita/cms/TemplateMapping.java:    public static final
String TYPE =
cms/src/com/arsdigita/cms/TextAsset.java:    public static final
String TYPE = "com.arsdigita.cms.TextAsset";
cms/src/com/arsdigita/cms/TextPage.java:    public static final String
TYPE = "com.arsdigita.cms.TextPage";
cms/src/com/arsdigita/cms/UserDefinedContentItem.java:    public
static final String TYPE = "com.arsdigita.cms.UserDefinedContentItem";
cms/src/com/arsdigita/cms/contenttypes/Link.java:    public static
final String TYPE
cms/src/com/arsdigita/cms/dispatcher/Resource.java:    public static
final String TYPE = "com.arsdigita.cms.Resource";
cms/src/com/arsdigita/cms/dispatcher/ResourceMapping.java:    public
static final String TYPE = "com.arsdigita.cms.ResourceMapping";
cms/src/com/arsdigita/cms/dispatcher/ResourceType.java:    public
static final String TYPE = "com.arsdigita.cms.ResourceType";
cms/src/com/arsdigita/cms/installer/portlet/Initializer.java:   
public static final String TYPES = "types";
cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinition.java:   
public static final String TYPE = "com.arsdigita.cms.LifecycleDefinition";
cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java:    public
static final String TYPE = "com.arsdigita.cms.LifecycleService";
cms/src/com/arsdigita/cms/lifecycle/Phase.java:    public static final
String TYPE = "com.arsdigita.cms.Phase";
cms/src/com/arsdigita/cms/lifecycle/PhaseDefinition.java:    public
static final String TYPE = "com.arsdigita.cms.PhaseDefinition";
cms/src/com/arsdigita/cms/publishToFile/PublishedLink.java:    public
static final String TYPE = 
cms/src/com/arsdigita/cms/ui/ContentPageTable.java:    public static
final String TYPE_LABEL = "typeLabel";
cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java:    public
static final String TYPE_ID = "tid";
core/src/com/arsdigita/formbuilder/BebopObjectType.java:    public
static final String TYPE_ID = "id";
core/src/com/arsdigita/formbuilder/MetaObject.java:    public static
final String TYPE_ID = "typeId";
core/src/com/arsdigita/formbuilder/PersistentDataQuery.java:    public
static final String TYPE_ID = "typeId";
core/src/com/arsdigita/messaging/Message.java:    public static final
String TYPE      = "type";
core/src/com/arsdigita/mimetypes/ImageMimeType.java:    public static
final String TYPE = "com.arsdigita.cms.ImageMimeType";
core/src/com/arsdigita/mimetypes/MimeType.java:    public static final
String TYPE = "com.arsdigita.cms.MimeType";
core/src/com/arsdigita/mimetypes/MimeTypeExtension.java:    public
static final String TYPE = "com.arsdigita.cms.MimeTypeExtension";
core/src/com/arsdigita/mimetypes/MimeTypeStatus.java:    public static
final String TYPE = "com.arsdigita.cms.MimeTypeStatus";
core/src/com/arsdigita/mimetypes/TextMimeType.java:    public static
final String TYPE = "com.arsdigita.cms.TextMimeType";
core/src/com/arsdigita/mimetypes/converters/ConvertFormat.java:   
public static final String TYPE = "com.arsdigita.cms.ConvertFormat";
core/src/com/arsdigita/mimetypes/converters/PostConvertHTML.java:   
public static final String TYPE =
core/src/com/arsdigita/mimetypes/converters/PreConvertHTML.java:   
public static final String TYPE =
core/src/com/arsdigita/search/lucene/Document.java:    public static
final String TYPE                = "type";
core/src/com/arsdigita/search/lucene/Document.java:    public static
final String TYPE_SPECIFIC_INFO  = "typeSpecificInfo";
ct-address/src/com/arsdigita/cms/contenttypes/Address.java:    public
static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-agenda/src/com/arsdigita/cms/contenttypes/Agenda.java:    public
static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-article/src/com/arsdigita/cms/contenttypes/Article.java:    public
static final String TYPE
ct-bookmark/src/com/arsdigita/cms/contenttypes/Bookmark.java:   
public static final String TYPE
ct-contact/src/com/arsdigita/cms/contenttypes/Contact.java:  public
static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-contact/src/com/arsdigita/cms/contenttypes/ContactType.java: 
public static final String TYPE_NAME = "typeName";
ct-esdservice/src/com/arsdigita/cms/contenttypes/ESDService.java:   
public static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-event/src/com/arsdigita/cms/contenttypes/Event.java:    public
static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-faqitem/src/com/arsdigita/cms/contenttypes/FAQItem.java:    public
static final String TYPE
ct-filestorageitem/src/com/arsdigita/cms/contenttypes/FileStorageItem.java:
   public static final String TYPE
ct-glossaryitem/src/com/arsdigita/cms/contenttypes/GlossaryItem.java:
   public static final String TYPE
ct-htmlform/src/com/arsdigita/cms/contenttypes/HTMLForm.java:   
public static final String TYPE
ct-inlinesite/src/com/arsdigita/cms/contenttypes/InlineSite.java:   
public static final String TYPE
ct-job/src/com/arsdigita/cms/contenttypes/Job.java:    public static
final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-legalnotice/src/com/arsdigita/cms/contenttypes/LegalNotice.java:  
 public static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-minutes/src/com/arsdigita/cms/contenttypes/Minutes.java:    public
static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-motditem/src/com/arsdigita/cms/contenttypes/MOTDItem.java:   
public static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-mparticle/src/com/arsdigita/cms/contenttypes/ArticleSection.java: 
  public static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-mparticle/src/com/arsdigita/cms/contenttypes/MultiPartArticle.java:
   public static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java:   
public static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-organization/src/com/arsdigita/cms/contenttypes/Organization.java:
   public static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-pressrelease/src/com/arsdigita/cms/contenttypes/PressRelease.java:
   public static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-service/src/com/arsdigita/cms/contenttypes/Service.java:    public
static final String TYPE = BASE_DATA_OBJECT_TYPE;
ct-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java:   
public static final String TYPE
Comment 3 Justin Ross 2004-03-11 16:03:11 EST
This is completed as of change 41278.

Note You need to log in before you can comment on or make changes to this bug.