WCS | Custom Dataload | Attribute Dictionary Dataload | BOD Objects to Set in Custom Data Reader

If you are writing custom datareader for Attribute Dictionary Dataload, here is the sample snippet for different BOD Objects to set,

// AttributeDictionary External Identifier Type
AttributeExternalIdentifierType attributeExternalIdentifierType = CommerceFoundationFactory.eINSTANCE.createAttributeExternalIdentifierType();
attributeExternalIdentifierType.setIdentifier("OSInstalled");

// Attribute Dictionary Identifier Type
AttributeIdentifierType attributeIdentifierType = CommerceFoundationFactory.eINSTANCE.createAttributeIdentifierType();
attributeIdentifierType.setExternalIdentifier(attributeExternalIdentifierType);

// Attribute Dictionary Attribute Type
AttributeDictionaryAttributeType attrDictAttrType = CatalogFactory.eINSTANCE.createAttributeDictionaryAttributeType();

// Basic Details of the Attribute Dictionary Attribute
attrDictAttrType.setAttributeIdentifier(attributeIdentifierType);
attrDictAttrType.setName("Operating System Installed");
attrDictAttrType.setAttributeType("AssignedValues");
attrDictAttrType.setAttributeDataType("STRING");
attrDictAttrType.setLanguage("-1");
attrDictAttrType.setDescription("Default Operating System Installed in the Laptop");

// Flags for Attribute Dictionary Attribute
attrDictAttrType.setDisplayable(true);
attrDictAttrType.setSearchable(true);
attrDictAttrType.setComparable(true);
attrDictAttrType.setFacetable(true);
attrDictAttrType.setMerchandisable(true);
attrDictAttrType.setDisplaySequence(Double.valueOf("1"));

Set this prepared AttributeDictionaryAttributeType to DataLoadBusinessObject and return the same in next() method for the Custom Data Reader.

Refer WCS | Dataload Utility | Writing Custom Dataload link to know more details of custom data readers

13 comments:

  1. Hi Sir,

    I am trying to load attribute dictionary data from XML file.
    The code snippet above inserts ATTR.IDENTIFIER, ATTRDESC.NAME,ATTRDESC.DESCRIPTION, ATTR.COMPARABLE, ATTR.SORTORDER.

    I also need to insert ATTRDESC.DESCRIPTION2 and ATTR.FIELD3.

    I am not able to find any setter methods for these in AttributeDictionaryAttributeType.

    Could you please help me how can I insert ATTRDESC.DESCRIPTION2 and ATTR.FIELD3. ?

    ReplyDelete
    Replies
    1. // ATTR.FIELD3
      attributeDictionaryAttribute.getExtendedData().put("Field3", "My Sample Field3 Data");

      // ATTRDESC.DESCRIPTION2
      attributeDescription.getExtendedData().put("SecondaryDescription", "My Sample Data");

      Delete
  2. Apart from the above columns, I also need to populate ATTRDESC.NOTEINFO.

    ReplyDelete
    Replies
    1. // ATTRDESC.NOTEINFO
      attributeDescription.getExtendedData().put("Footnote", "My Sample footnote");

      Delete
  3. Thanks Sir.
    How do I associate the attributeDescription and attrDictAttrType ?
    Beacuse my reader is returning attrDictAttrType ultimately through DataLoadBusinessObject.

    ReplyDelete
  4. // Create AttributeDictionaryAttributeType with all the required data
    AttributeDictionaryAttributeType attrDictAttrType = CatalogFactory.eINSTANCE.createAttributeDictionaryAttributeType();
    ....
    ....

    // Create AttributeDescriptionType
    AttributeDescriptionType attributeDescriptionType = CatalogFactory.eINSTANCE.createAttributeDescriptionType();
    attributeDescriptionType.setName("Sample Name");
    attributeDescriptionType.setDescription("Sample Desc");
    attributeDescriptionType.setLanguage("-1");
    attrDictAttrType.getAttributeDescription().add(attributeDescriptionType);

    Like this, you can add n no. of AttributeDescriptionType with different languages to AttributeDictionaryAttributeType Object

    ReplyDelete
  5. Hello, this code snippet seems to load ATTR and ATTRDESC.
    I have 2 issues:
    Issue #1 : While trying to load descriptive attributes, I am getting exception as:

    Exception message:
    The mandatory property AttributeDataType is missing in the business object AttributePropertyType. The path is AttributeDataType.
    Stack trace:
    com.ibm.commerce.foundation.dataload.exception.DataLoadApplicationException: The mandatory property AttributeDataType is missing in the business object AttributePropertyType. The path is AttributeDataType.

    Seems like attrDictAttrType.setAttributeType("AssignedValues");
    is causing trouble.
    Can you please help me on this.

    Issue#2 : I am not clear how should I load attribute value. i.e data for tables: ATTRVALDESC.VALUE ?

    ReplyDelete
  6. Please tell me how to load data for attribute values, such as ATTRVAL and ATTRVALDESC ?

    ReplyDelete
  7. ATTRVAL and ATTRVALDESC are also loaded by AttributeDictionaryAttributeMediator, but I am unaware what kind of object will hold these values ?

    ReplyDelete
  8. May I know who is this?

    ATTR, ATTRDESC will be loaded as part of Attribute Dictionary Dataload. If you have Predefined Allowed values, then only you can load ATTRVAL & ATTRVALDESC values as part of Attribute Dictionary Dataload.

    CATENTRYATTR, ATTRVAL, ATTRVALDESC will be loaded as part of Catentry Attributes Dataload.

    Let me know, if this clears your doubt.

    ReplyDelete
  9. Hi Sir,
    I posted the above questions.
    I am working on a project where client is moving to a different PIM.
    Earlier PIM approach was with loading data using AccessBeans.
    This time for new PIM we are trying to use DataLoad utility

    Client will send us a XML with all catalog, catalog entry and attribute related data.
    Our client has a B2B site, where they don't have any defining attribute. We follow attribute dictionary model.
    They have only Descriptive attributes and attributes with assigned values.
    like: Size of machine, battery power etc.
    Suppose Battery Voltage is an attribute, whose value is 20Volts
    This is Assigned value
    So I need to the attribute Battery Voltage and its value 20Volts
    Client expects to see attribute value what they sent in XML. They don't use Management center to assign value to.
    I am able to create entries in ATTR and ATTRDESC .
    Now I want to create entries in ATTRVAL and ATTRVALDESC to insert 20Volts as value.
    In earlier approach this was done by AccessBeans and AttributeValues were attcahed with a attribute.
    Is it not possible using DataLoad ?

    ReplyDelete
  10. It is tough enough to type it here as it is bit bigger topic.

    Can you please reach out on my mobile, I can explain them in detail.

    ReplyDelete

My Writings........

HCL Commerce v9.1 | Local Store Vs Remote Store

  Local Store Remote Store Project Type Migrated (Lift & Shift) - Newly Imp...