это мой код:
public void onValidate(final Object o, final InterceptorContext ctx) throws InterceptorException
{
if (o instanceof ProductModel)
{
final ProductModel product = (ProductModel) o;
if (!ctx.isNew(product))
{
if (StringUtils.isEmpty(product.getCode()))
{
throw new InterceptorException("The Code must not be empty!");
}
if (StringUtils.isEmpty(product.getManufacturerName().toString()))
{
throw new InterceptorException("The ManufacturerName must not be empty!");
}
if (ctx.isModified(product, ProductModel.MANUFACTURERPRODUCTID)
|| ctx.isModified(product, ProductModel.MANUFACTURERNAME))
{
final boolean b = ProductLookupService.getProductforManufacturerName(product.getManufacturerName().toString());
...
}
Мне нужно имя enum ManufacturerName, чтобы сравнить его с другой строкой, но мой генерируемый getManufacturerName возвращает мне только код. Какие у меня варианты? Вот -item.xml и мой сгенерированный метод get:
<enumtype code="ManufacturerName" generate="true" autocreate="true" dynamic="true"/>
<itemtype code="Product" generate="false" autocreate="false">
<attributes>
<attribute type="ManufacturerName" qualifier="manufacturerName" generate="true">
<description> </description>
<persistence type="property" />
</attribute>
...
</attributes>
и
/**
* <i>Generated method</i> - Getter of the <code>Product.ManufacturerName</code> attribute defined at extension <code>myextension</code>.
* @return the manufacturerName
*/
@Accessor(qualifier = "manufacturerName", type = Accessor.Type.GETTER)
public ManufacturerName getManufacturerName()
{
return getPersistenceContext().getPropertyValue(MANUFACTURERNAME);
}
Еще раз спасибо!