If you are writing custom datareader for Catalog Entry Attachment Assets Dataload, here is the sample snippet for different BOD Objects to set,
// Create PartNumberIdentifierType Object
PartNumberIdentifierType partNumberIdentifierType = CommerceFoundationFactory.eINSTANCE.createPartNumberIdentifierType();
partNumberIdentifierType.setPartNumber("MotoG");
// Create CatalogEntryIdentifierType Object
CatalogEntryIdentifierType catalogEntryIdentifierType = CommerceFoundationFactory.eINSTANCE.createCatalogEntryIdentifierType();
catalogEntryIdentifierType.setExternalIdentifier(partNumberIdentifierType);
// Create CatalogEntryType Object
CatalogEntryType catEntryType = CatalogFactory.eINSTANCE.createCatalogEntryType();
catEntryType.setCatalogEntryIdentifier(catalogEntryIdentifierType);
// Get the List object which stores the attachment references from catEntry object
List<AttachmentReferenceType> catAtcmtRefTypList = catEntryType.getAttachmentReference();
// Create AttachmentUsageType Object
AttachmentUsageType attachmentUsageType = CommerceFoundationFactory.eINSTANCE.createAttachmentUsageType();
attachmentUsageType.setUsageName("Img_Center_180_135");
// Create AttachmentExternalIdentifierType Object
AttachmentExternalIdentifierType attachmentExternalIdentifierType = CommerceFoundationFactory.eINSTANCE.createAttachmentExternalIdentifierType();
attachmentExternalIdentifierType.setIdentifier("MyImage1");
// Create AttachmentIdentifierType Object
AttachmentIdentifierType identifierType = CommerceFoundationFactory.eINSTANCE.createAttachmentIdentifierType();
identifierType.setExternalIdentifier(attachmentExternalIdentifierType);
// Create AttachmentReferenceType Object
AttachmentReferenceType attachmentReferenceType = CommerceFoundationFactory.eINSTANCE.createAttachmentReferenceType();
attachmentReferenceType.setAttachmentUsage(attachmentUsageType);
attachmentReferenceType.setAttachmentIdentifier(identifierType);
atchmtRefTypList.add(attachmentReferenceType);
Set this prepared CatalogEntryType to DataLoadBusinessObject and return the same in next() method for the Custom Data Reader.
// Create PartNumberIdentifierType Object
PartNumberIdentifierType partNumberIdentifierType = CommerceFoundationFactory.eINSTANCE.createPartNumberIdentifierType();
partNumberIdentifierType.setPartNumber("MotoG");
// Create CatalogEntryIdentifierType Object
CatalogEntryIdentifierType catalogEntryIdentifierType = CommerceFoundationFactory.eINSTANCE.createCatalogEntryIdentifierType();
catalogEntryIdentifierType.setExternalIdentifier(partNumberIdentifierType);
// Create CatalogEntryType Object
CatalogEntryType catEntryType = CatalogFactory.eINSTANCE.createCatalogEntryType();
catEntryType.setCatalogEntryIdentifier(catalogEntryIdentifierType);
// Get the List object which stores the attachment references from catEntry object
List<AttachmentReferenceType> catAtcmtRefTypList = catEntryType.getAttachmentReference();
// Create AttachmentUsageType Object
AttachmentUsageType attachmentUsageType = CommerceFoundationFactory.eINSTANCE.createAttachmentUsageType();
attachmentUsageType.setUsageName("Img_Center_180_135");
// Create AttachmentExternalIdentifierType Object
AttachmentExternalIdentifierType attachmentExternalIdentifierType = CommerceFoundationFactory.eINSTANCE.createAttachmentExternalIdentifierType();
attachmentExternalIdentifierType.setIdentifier("MyImage1");
// Create AttachmentIdentifierType Object
AttachmentIdentifierType identifierType = CommerceFoundationFactory.eINSTANCE.createAttachmentIdentifierType();
identifierType.setExternalIdentifier(attachmentExternalIdentifierType);
// Create AttachmentReferenceType Object
AttachmentReferenceType attachmentReferenceType = CommerceFoundationFactory.eINSTANCE.createAttachmentReferenceType();
attachmentReferenceType.setAttachmentUsage(attachmentUsageType);
attachmentReferenceType.setAttachmentIdentifier(identifierType);
atchmtRefTypList.add(attachmentReferenceType);
Set this prepared CatalogEntryType to DataLoadBusinessObject and return the same in next() method for the Custom Data Reader.
No comments:
Post a Comment