on 2017 Aug 29 3:28 AM
Hi, I'm creating an impex for a Custom Model that inherits from CronJob, and as property, it has a collection of catalogVersions. So, I would like to know how can I impex this. This is my Model:
<itemtype code="CustomFeedCronJob" autocreate="true" generate="true" extends="CronJob" jaloclass="com.specialized.core.jalo.CustomFeedCronJob">
<description>Cronjob for Sending Data Feeds to Different locations</description>
<attributes>
<attribute qualifier="modelYear" type="java.lang.Integer">
<modifiers write="true" read="true" optional="false"></modifiers>
<persistence type="property"></persistence>
</attribute>
<attribute qualifier="catalogVersions" type="CatalogVersionCollection">
<modifiers write="true" read="true" optional="false"></modifiers>
<persistence type="property"></persistence>
</attribute>
<attribute qualifier="pricesFromCountry" type="Country">
<modifiers write="true" read="true" optional="true"></modifiers>
<persistence type="property"></persistence>
</attribute>
<attribute qualifier="feedType" type="DataFeedType">
<persistence type="property" />
<modifiers read="true" write="true" search="true" optional="false" />
</attribute>
</attributes>
</itemtype>
And the collection
<collectiontype code="CatalogVersionCollection" elementtype="CatalogVersion" autocreate="true" generate="true" type="collection"/>
This is what I've tried so far
$usCatalog = SBCUnitedStatesProductCatalog
#$brCatalogVersion = catalogVersion(CatalogVersion.catalog(Catalog.id[default = $brCatalog]), CatalogVersion.version[default = Online])[default = $brCatalog:Online]
#$brCatalogVersion=catalogversion(catalog(id),version)[unique=true,default=$brCatalog:$catalog-version]
$usCatalogVersion = catalogVersion(CatalogVersion.catalog(Catalog.id[default = $usCatalog]), CatalogVersion.version[default = Online])[default = $usCatalog:Online]
#
#$usCatalog = SBCUnitedStatesProductCatalog
#$usCatalogVersion = catalogVersion(CatalogVersion.catalog(Catalog.id[default = $usCatalog]), CatalogVersion.version[default = Online])[default = $usCatalog:Online]
#
$auCatalog = SBCAustraliaProductCatalog
$auCatalogVersion = catalogVersion(CatalogVersion.catalog(Catalog.id[default = $auCatalog]), CatalogVersion.version[default = Online])[default = $auCatalog:Online]
#
#$ukCatalog = SBCUnitedKingdomProductCatalog
#$ukCatalogVersion = catalogVersion(CatalogVersion.catalog(Catalog.id[default = $ukCatalog]), CatalogVersion.version[default = Online])[default = $ukCatalog:Online]
INSERT_UPDATE CustomFeedCronJob; code[unique = true]; job(code); singleExecutable; modelYear; feedType(code)[default = 'ORACLE']; catalogVersions
;testOracleFeedJob; customFeedCronJob; false; 2018; ORACLE;$usCatalogVersion, $auCatalogVersion
And I'm getting different errors (as you can see I've tried different things), but this is the latest error:
INSERT_UPDATE CustomFeedCronJob;code[unique = true];job(code);singleExecutable;modelYear;feedType(code)[default = 'ORACLE'];catalogVersions
",,,,pk has wrong format: 'catalogVersion(CatalogVersion.catalog(Catalog.id[default = SBCUnitedStatesProductCatalog])':For input string: ""catalogVersion(CatalogVersion.catalog(Catalog.id[default = SBCUnitedStatesProductCatalog])""";testOracleFeedJob;customFeedCronJob;false;2018;ORACLE;catalogVersion(CatalogVersion.catalog(Catalog.id[default = SBCUnitedStatesProductCatalog]), CatalogVersion.version[default = Online])[default = SBCUnitedStatesProductCatalog:Online], catalogVersion(CatalogVersion.catalog(Catalog.id[default = SBCAustraliaProductCatalog]), CatalogVersion.version[default = Online])[default = SBCAustraliaProductCatalog:Online]
Any idea on how can I impex a list of product catalogs to my model?
Thanks and regards
Request clarification before answering.
Lol... I've figured out... in case that you're wondering, I need to define the header and the value variable passed in the impex... as separate macros, not as a single one... something like:
$online = Online
$catalogVersions = catalogVersions(CatalogVersion.catalog(Catalog.id), CatalogVersion.version[default = $online])
$usCatalog = SBCUnitedStatesProductCatalog
$usVersion = CatalogVersion.catalog(Catalog.id[default = $usCatalog]), CatalogVersion.version[default = $online]
$auCatalog = SBCAustraliaProductCatalog
$auVersion = CatalogVersion.catalog(Catalog.id[default = $auCatalog]), CatalogVersion.version[default = $online]
$allVersions = $usCatalog: $online, $auCatalog: $online
INSERT_UPDATE CustomFeedCronJob; code[unique = true]; job(code); singleExecutable; modelYear; feedType(code)[default = 'ORACLE']; $catalogVersions
; testOracleFeedJob; customFeedCronJob; false; 2018; ORACLE; $allVersions
That way the header macro is separated from the value macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.