/* * resource descriptor */ component output="false" extends="restfulcf.framework.core.Resource" hint="resource descriptor" { // string properties property name="path" type="string" default=""; property name="productName" type="string" default=""; property name="pageTitle" type="string" default=""; property name="descriptionTitle" type="string" default=""; property name="descriptionFull" type="string" default=""; property name="boxshot" type="string" default=""; property name="boxshotThumbnail" type="string" default=""; property name="boxshotMedium" type="string" default=""; property name="boxshotSmall" type="string" default=""; property name="upsellDescription" type="string" default=""; property name="productContactNumber" type="string" default=""; property name="template" type="string" default=""; property name="configuratorTemplate" type="string" default=""; // array properties: setting the default to 'arrayNew(1)' here, and swapping with arrayNew(1) on init() property name="marketingLinks" type="array" default="arrayNew(1)"; property name="purchaseOptions" type="array" default="arrayNew(1)"; public store.restful.resources.Product function init(required string path = "", required string productName = "", required string pageTitle = "", required string descriptionTitle = "", required string descriptionFull = "", required string boxshot = "", required string boxshotThumbnail = "", required string boxshotMedium = "", required string boxshotSmall = "", required array purchaseOptions = arrayNew(1), required string upsellDescription = "", required string productContactNumber = "", required string template = "", required string configuratorTemplate = "", required array marketingLinks = arrayNew(1)) { // logic to swap the 'arrayNew(1)' string to a real empty array // this is necessary to preserve the property name in camelCase when serialized to JSON var local = {}; var i = 0; var localProp = ""; local.meta = getMetadata(this); for (i=1; i<=arrayLen(local.meta.properties); i++) { localProp = local.meta.properties[i]; if (isArray(localProp) || isStruct(localProp)) localProp.default = evaluate(localProp.default); } super.init(argumentCollection = arguments); return this; } }