예제 #1
0
  public void setName(String name) {
    if (name == bean.getName()) return;
    if (name != null && name.equals(bean.getName())) return;

    ensureUpdateable(bean);
    bean.setName(name);
  }
예제 #2
0
  public void setDescription(String description) {
    if (description == bean.getDescription()) return;
    if (description != null && description.equals(bean.getDescription())) return;

    ensureUpdateable(bean);
    bean.setDescription(description);
  }
예제 #3
0
  public Product createProduct() {
    ObjexObj newProduct = getInternalContainer().newObject(this, bean, "Product");

    ensureUpdateable(bean);
    List<String> prods = bean.getProducts();
    if (prods == null) prods = new ArrayList<String>();
    prods.add(newProduct.getId().toString());
    bean.setProducts(prods);

    return newProduct.getBehaviour(Product.class);
  }
예제 #4
0
  public Category createCategory() {
    ObjexObj newCat = getInternalContainer().newObject(this, bean, "Category");

    ensureUpdateable(bean);
    List<String> cats = bean.getCategories();
    if (cats == null) cats = new ArrayList<String>();
    cats.add(newCat.getId().toString());
    bean.setCategories(cats);

    return newCat.getBehaviour(Category.class);
  }
예제 #5
0
  public void acceptReader(ObjexStateReader reader) {
    String name = bean.getName();
    String newName = reader.read("name", name, java.lang.String.class, ObjexFieldType.OBJECT, true);
    if (name != newName) setName(newName);

    String description = bean.getDescription();
    String newDescription =
        reader.read(
            "description", description, java.lang.String.class, ObjexFieldType.OBJECT, true);
    if (description != newDescription) setDescription(newDescription);

    List<String> products = bean.getProducts();
    List<String> newProducts =
        reader.readReferenceList("products", products, ObjexFieldType.OWNED_REFERENCE, true);
    if (products != newProducts) setProducts(newProducts);

    List<String> categories = bean.getCategories();
    List<String> newCategories =
        reader.readReferenceList("categories", categories, ObjexFieldType.OWNED_REFERENCE, true);
    if (categories != newCategories) setCategories(newCategories);
  }
예제 #6
0
 @XmlAttribute
 public String getDescription() {
   return bean.getDescription();
 }
예제 #7
0
 @XmlAttribute
 public String getName() {
   return bean.getName();
 }
예제 #8
0
 public void setProducts(List<String> products) {
   ensureUpdateable(bean);
   bean.setProducts(products);
 }
예제 #9
0
 @XmlElement(type = ProductImpl.class)
 public List<Product> getProducts() {
   return getContainer().getObjectList(bean.getProducts(), Product.class);
 }
예제 #10
0
 public List<String> getProductRefs() {
   return bean.getProducts();
 }
예제 #11
0
 public void setCategories(List<String> categories) {
   ensureUpdateable(bean);
   bean.setCategories(categories);
 }
예제 #12
0
 @XmlElement(type = XmlObjexObj.class)
 public List<Category> getCategories() {
   return getContainer().getObjectList(bean.getCategories(), Category.class);
 }
예제 #13
0
 public List<String> getCategoryRefs() {
   return bean.getCategories();
 }