this.categoryAddedEvent.fire(new ShopCategoryAddedEvent(updatedCategory));
// Unset all older values
- this.setCategoryTitle(""); //NOI18N
- this.setParentCategory(null);
+ this.clear();
} catch (final CategoryTitleAlreadyUsedException | CannotAddCategoryException ex) {
// Continue to throw
throw new FaceletException(ex);
this.parentCategory = parentCategory;
}
+ /**
+ * Clears this bean (example: when category has been added)
+ */
+ private void clear () {
+ this.setCategoryTitle(""); //NOI18N
+ this.setParentCategory(null);
+ }
+
}
this.addedProductEvent.fire(new ShopProductAddedEvent(updatedProduct));
// Set all to null
- this.setProductAvailability(Boolean.FALSE);
- this.setProductCategory(null);
- this.setProductPrice(null);
- this.setProductTitle(null);
+ this.clear();
} catch (final ProductTitleAlreadyUsedException | CannotAddProductException ex) {
// Continue to throw
throw new FaceletException(ex);
this.productTitle = productTitle;
}
+ /**
+ * Clears this bean (example: product has been added)
+ */
+ private void clear () {
+ this.setProductAvailability(Boolean.FALSE);
+ this.setProductCategory(null);
+ this.setProductPrice(null);
+ this.setProductTitle(null);
+ }
+
}