The property
element identifies which properties of repository items or beans should be included in the response. By default, only properties that are explicitly listed are included.
The property
element contains the following attributes:
Attribute | Description |
---|---|
| The name that the property will use when sending the response. |
| The name of the property that is read from the Java servlet bean or repository. If no target is supplied, the value of the |
| The Nucleus path of a component that implements the |
| If this property is set to |
| Applies a filter by ID that matches the class of the repository item type of the property value. Note that the |
Working with Property Customizers
You can transform properties using the property-customizer
attribute. For example you could mask a credit card number by creating a maskedCreditCardNumber
property:
<property name="maskedCreditCardNumber" property-customizer="/atg/rest/ filtering/customizers/CreditCardNumberPropertyCustomizer" />
You can also retrieve other properties using this syntax.
If the target attribute does not start with a $
, it will be evaluated as a DynamicBean.getPropertyValue()
if the object is a DynamicBean
. Both item-descriptor
and bean
elements can use this syntax. Note that you can add to any properties that are returned by default using XML combination.
You can use the RepositoryItemPropertyCustomzier
to retrieve repository items or properties of a repository item in a bean filter by looking up the item by ID. The following example retrieves a specific property by specifying the property
attribute:
<property name="total" property-customizer="atg/dynamo/service/filter/bean/ RepositoryPropertyCustomizer" target="properties.orderId"> <attribute name="repository" value="/atg/commerce/order/OrderRepository" /> <attribute name="item-descriptor" value="order" /> <attribute name="property" value="priceInfo.amount" /> </property>
To retrieve the entire repository item, do not specify a property
attribute:
<property name="order" property-customizer="atg/dynamo/service/filter/bean/ RepositoryPropertyCustomizer" target="properties.orderId"> <attribute name="repository" value="/atg/commerce/order/OrderRepository" /> <attribute name="item-descriptor" value="order" /> </property>
The DottedPropertyNamePropertyCustomizer
can be used when you are working with properties that have a dot in their name, such as profile.firstName
. For example:
<property name="firstName" property-customizer="/atg/dynamo/service/filter/bean/ DotterPropertyNamePropertyCustomizer" target="properties.'profile.firstname'" />