If you are writing custom datareader for Catalog Entry Attributes Dataload, here is the sample snippet for different BOD Objects to set,
// Create CatalogEntryAttributesType
CatalogEntryAttributesType catentryAttrType = CatalogFactory.eINSTANCE.createCatalogEntryAttributesType();
// Create PartNumberIdentifierType
PartNumberIdentifierType partNumberIdentifierType = CommerceFoundationFactory.eINSTANCE.createPartNumberIdentifierType();
partNumberIdentifierType.setPartNumber("Reebok_1234");
// Create CatalogEntryIdentifierType
CatalogEntryIdentifierType catalogEntryIdentifierType = CommerceFoundationFactory.eINSTANCE.createCatalogEntryIdentifierType();
catalogEntryIdentifierType.setExternalIdentifier(partNumberIdentifierType);
// Get the attributes list from the Catalog entry
List<CatalogAttributeType> catattrTypeList = catEntryType.getCatalogEntryAttributes().getAttributes();
// Create Basic Details of Catentry Object
CatalogEntryType catEntryType = CatalogFactory.eINSTANCE.createCatalogEntryType();
catEntryType.setCatalogEntryIdentifier(catalogEntryIdentifierType);
catEntryType.setCatalogEntryAttributes(catentryAttrType);
// ---------------------------------- Adding attributes 1
// Create AttributeExternalIdentifierType
AttributeExternalIdentifierType attributeExternalIdentifierType1 = CommerceFoundationFactory.eINSTANCE.createAttributeExternalIdentifierType();
attributeExternalIdentifierType1.setIdentifier("Reebok_1234_Wash_Instruction");
AttributeIdentifierType attributeIdentifierType1 = CommerceFoundationFactory.eINSTANCE.createAttributeIdentifierType();
attributeIdentifierType1.setExternalIdentifier(attributeExternalIdentifierType);
// Create ValueType Object
ValueType valueType1 = CatalogFactory.eINSTANCE.createValueType();
valueType1.setValue("Don't wash to with hot water");
valueType1.setIdentifier("Reebok_1234_Wash_Instruction_Val");
// Catalog Attribute Type
CatalogAttributeType catalogAttributeType1 = CatalogFactory.eINSTANCE.createCatalogAttributeType();
catalogAttributeType1.setAttributeIdentifier(attributeIdentifierType);
catalogAttributeType1.setValue(valueType);
catalogAttributeType1.setUsage(DESCRIPTIVE);
catalogAttributeType1.setAttributeDataType("STRING");
catalogAttributeType1.setLanguage("en_US");
// Add this Attribute to catAttrTypeList Object
catAttrTypeList.add(catalogAttributeType1);
// ---------------------------------- Adding attributes 2
AttributeExternalIdentifierType attributeExternalIdentifierType2 = CommerceFoundationFactory.eINSTANCE.createAttributeExternalIdentifierType();
attributeExternalIdentifierType2.setIdentifier("Reebok_1234_DryCleaning_Instruction");
AttributeIdentifierType attributeIdentifierType2 = CommerceFoundationFactory.eINSTANCE.createAttributeIdentifierType();
attributeIdentifierType2.setExternalIdentifier(attributeExternalIdentifierType);
ValueType valueType2 = CatalogFactory.eINSTANCE.createValueType();
valueType2.setValue("Don't do dry cleaning");
valueType2.setIdentifier("Reebok_1234_DryCleaning_Instruction_Val");
// Catalog Attribute Type
CatalogAttributeType catalogAttributeType2 = CatalogFactory.eINSTANCE.createCatalogAttributeType();
catalogAttributeType2.setAttributeIdentifier(attributeIdentifierType);
catalogAttributeType2.setValue(valueType);
catalogAttributeType2.setUsage(DESCRIPTIVE);
catalogAttributeType2.setAttributeDataType("STRING");
catalogAttributeType2setLanguage("en_US");
// Add this Attribute to catAttrTypeList Object
catAttrTypeList.add(catalogAttributeType2);
Set this prepared CatalogEntryType to DataLoadBusinessObject and return the same in next() method for the Custom Data Reader.
// Create CatalogEntryAttributesType
CatalogEntryAttributesType catentryAttrType = CatalogFactory.eINSTANCE.createCatalogEntryAttributesType();
// Create PartNumberIdentifierType
PartNumberIdentifierType partNumberIdentifierType = CommerceFoundationFactory.eINSTANCE.createPartNumberIdentifierType();
partNumberIdentifierType.setPartNumber("Reebok_1234");
// Create CatalogEntryIdentifierType
CatalogEntryIdentifierType catalogEntryIdentifierType = CommerceFoundationFactory.eINSTANCE.createCatalogEntryIdentifierType();
catalogEntryIdentifierType.setExternalIdentifier(partNumberIdentifierType);
// Get the attributes list from the Catalog entry
List<CatalogAttributeType> catattrTypeList = catEntryType.getCatalogEntryAttributes().getAttributes();
// Create Basic Details of Catentry Object
CatalogEntryType catEntryType = CatalogFactory.eINSTANCE.createCatalogEntryType();
catEntryType.setCatalogEntryIdentifier(catalogEntryIdentifierType);
catEntryType.setCatalogEntryAttributes(catentryAttrType);
// ---------------------------------- Adding attributes 1
// Create AttributeExternalIdentifierType
AttributeExternalIdentifierType attributeExternalIdentifierType1 = CommerceFoundationFactory.eINSTANCE.createAttributeExternalIdentifierType();
attributeExternalIdentifierType1.setIdentifier("Reebok_1234_Wash_Instruction");
AttributeIdentifierType attributeIdentifierType1 = CommerceFoundationFactory.eINSTANCE.createAttributeIdentifierType();
attributeIdentifierType1.setExternalIdentifier(attributeExternalIdentifierType);
// Create ValueType Object
ValueType valueType1 = CatalogFactory.eINSTANCE.createValueType();
valueType1.setValue("Don't wash to with hot water");
valueType1.setIdentifier("Reebok_1234_Wash_Instruction_Val");
// Catalog Attribute Type
CatalogAttributeType catalogAttributeType1 = CatalogFactory.eINSTANCE.createCatalogAttributeType();
catalogAttributeType1.setAttributeIdentifier(attributeIdentifierType);
catalogAttributeType1.setValue(valueType);
catalogAttributeType1.setUsage(DESCRIPTIVE);
catalogAttributeType1.setAttributeDataType("STRING");
catalogAttributeType1.setLanguage("en_US");
// Add this Attribute to catAttrTypeList Object
catAttrTypeList.add(catalogAttributeType1);
// ---------------------------------- Adding attributes 2
AttributeExternalIdentifierType attributeExternalIdentifierType2 = CommerceFoundationFactory.eINSTANCE.createAttributeExternalIdentifierType();
attributeExternalIdentifierType2.setIdentifier("Reebok_1234_DryCleaning_Instruction");
AttributeIdentifierType attributeIdentifierType2 = CommerceFoundationFactory.eINSTANCE.createAttributeIdentifierType();
attributeIdentifierType2.setExternalIdentifier(attributeExternalIdentifierType);
ValueType valueType2 = CatalogFactory.eINSTANCE.createValueType();
valueType2.setValue("Don't do dry cleaning");
valueType2.setIdentifier("Reebok_1234_DryCleaning_Instruction_Val");
// Catalog Attribute Type
CatalogAttributeType catalogAttributeType2 = CatalogFactory.eINSTANCE.createCatalogAttributeType();
catalogAttributeType2.setAttributeIdentifier(attributeIdentifierType);
catalogAttributeType2.setValue(valueType);
catalogAttributeType2.setUsage(DESCRIPTIVE);
catalogAttributeType2.setAttributeDataType("STRING");
catalogAttributeType2setLanguage("en_US");
// Add this Attribute to catAttrTypeList Object
catAttrTypeList.add(catalogAttributeType2);
Set this prepared CatalogEntryType to DataLoadBusinessObject and return the same in next() method for the Custom Data Reader.
Hello Sir,
ReplyDeleteI am trying to load attribute values through data load.
For example, want to add value for partnumber="P_36866"
attr.identifier='BAR_MOUNT' ----> this attribute existed before starting dataload.
attrVal.identifier='P_36866'
attrval value is Large
But get error:
The assigned value with identifier "P_36866" for the attribute "BAR_MOUNT" already exists in the system. An assigned value identifier cannot be assigned to multiple catalog entries. Specify an attribute value with a unique identifier.
I understand that because ATTRVAL table already has
attr_id + identifier present, so not able to insert again.
But in this case Dataload should fetch the attrVal_id and modify its value?
Why is that not happening ? Can you please help.
Can you please call on my mobile to discuss?
DeleteHello,
ReplyDeleteI need to insert values in CATENTRYATTR.FIELD1 and CATENTRYATTR.FIELD3, please help me understand how to insert these? As no direct method is available for CatalogAttributeType.
I tried with CatalogAttributeType.getExtendedData().put("Field1", "1165");
but no luck.
Is there anything I am missing?
Can you please try this?
DeleteCatalogAttributeType.getExtendedData().put("AttributeRelationshipField1", Integer.parseInt("1165"));
CatalogAttributeType.getExtendedData().put("AttributeRelationshipField2", Integer.parseInt("1165"));
CatalogAttributeType.getExtendedData().put("AttributeRelationshipField3", "1165");
Thanks,
Yashod
Thanks, it worked.
ReplyDeleteBut somehow field1 is also taking string, as
catalogAttributeType.getExtendedData().put("AttributeRelationshipField1","1165");