Manzoor Hussain
Manzoor Hussain

Reputation: 9

Remove unwanted attributes of Product

i create Item Type Books with following attribute title,author,publishingAttribute,isAvailable all are String except isAvailable this is boolean there is no extend the any class but when i run select from HAC it show extra attribute i want to remove this attribute i can how i can delete it.

This is my item type

 [<itemtype generate="false" code="Books" autocreate="true">
            <deployment table="Books" typecode="20000" />
                <attributes>
                    <attribute qualifier="title" type="java.lang.String">
                        <description>Book Title</description>
                        <modifiers initial="true"/>
                        <persistence type="property"/>
                    </attribute>

                    <attribute qualifier="author" type="java.lang.String">
                        <description>>Book Author Name</description>
                   <persistence type="property"/>
                    </attribute>

                    <attribute qualifier="publishingAttribute" type="java.lang.String">
                    <description>>Book Author Attribute</description>
                        <persistence type="property"/>
                    </attribute>


                <attribute qualifier="isAvailable" type="java.lang.Boolean">
                <description>Available or not </description>
                        <persistence type="property"/>enter image description here
                    </attribute>
                </attributes>
            </itemtype>][1]

Upvotes: 0

Views: 1779

Answers (1)

Arvind Kumar Avinash
Arvind Kumar Avinash

Reputation: 79075

Look at the following itemtype definitions available in core-items.xml:

<itemtype code="Item"
          extends=""
          jaloclass="de.hybris.platform.jalo.Item"
          deployment="de.hybris.platform.persistence.Item"
          autocreate="true"
          generate="false"
          abstract="true">
    <attributes>
        <attribute autocreate="true" qualifier="creationtime" type="java.util.Date">
            <persistence type="cmp" qualifier="creationTimestampInternal"/>
            <modifiers read="true" write="false" search="true" optional="true" initial="true"/>
        </attribute>
        <attribute autocreate="true" qualifier="modifiedtime" type="java.util.Date">
            <persistence type="cmp" qualifier="modifiedTimestampInternal"/>
            <modifiers read="true" write="true" search="true" optional="true"/>
        </attribute>
        <attribute autocreate="true" qualifier="itemtype" type="ComposedType">
            <persistence type="cmp" qualifier="typePkString"/>
            <modifiers read="true" write="true" search="true" optional="true"/>
        </attribute>
        <attribute autocreate="true" qualifier="owner" type="Item">
            <persistence type="cmp" qualifier="ownerPkString"/>
            <modifiers read="true" write="false" search="true" optional="true" private="false" initial="true"/>
        </attribute>
        <attribute autocreate="true" qualifier="pk" type="de.hybris.platform.core.PK">
            <persistence type="cmp" qualifier="pkString"/>
            <modifiers read="true" write="false" search="true" optional="false"/>
        </attribute>
         <attribute autocreate="true" qualifier="sealed" type="boolean">
            <persistence type="property" qualifier="sealed"/>
            <modifiers read="true" write="false" search="true" optional="true"/>
        </attribute>
    </attributes>
</itemtype>

<itemtype code="ExtensibleItem"
          extends="Item"
          jaloclass="de.hybris.platform.jalo.ExtensibleItem"
          deployment="de.hybris.platform.persistence.ExtensibleItem"
          autocreate="true"
          generate="false" abstract="true">
</itemtype>

<itemtype code="LocalizableItem"
          extends="ExtensibleItem"
          jaloclass="de.hybris.platform.jalo.c2l.LocalizableItem"
          deployment="de.hybris.platform.persistence.c2l.LocalizableItem"
          autocreate="true"
          generate="false" abstract="true">
</itemtype>

<itemtype code="GenericItem"
          extends="LocalizableItem"
          jaloclass="de.hybris.platform.jalo.GenericItem"
          deployment="de.hybris.platform.persistence.GenericItem"
          autocreate="true"
          generate="false">
</itemtype

As you can see, GenericItem extends LocalizableItem, LocalizableItem extends ExtensibleItem, and ExtensibleItem extends Item i.e. GenericItem ▸ LocalizableItem ▸ ExtensibleItem ▸ Item. It means that GenericItem inherits 6 attributes, creationtime, modifiedtime, itemtype, owner, pk, and sealed from Item.

When you create an itemtype without extending another itemtype, it extends GenericItem by default and therefore you will see all these 6 inherited attributes (creationtime, modifiedtime, itemtype, owner, pk, and sealed) in that itemtype.

For example, the following Flexible Search query will return these 6 inherited attributes (creationtime, modifiedtime, itemtype, owner, pk, and sealed) along with the attributes you have declared in your itemtype definition:

SELECT * FROM {Books}

Upvotes: 1

Related Questions