Ejemplo n.º 1
0
 public final void remove(ExtendedObject object) {
   String alias;
   DocumentModel model;
   if (object == null) return;
   model = object.getModel();
   alias = cmodel.getModelItemName(model.getName());
   if (alias == null) throw new RuntimeException("Invalid object model.");
   items.get(alias).objects.remove(getKey(cmodel, model, object, alias));
 }
Ejemplo n.º 2
0
  /**
   * Adds an item to the document
   *
   * @param object extended object
   */
  public final void add(ExtendedObject object) {
    String alias;
    Object key;
    DocumentModel model;
    ComplexModelItem citem;
    ComplexDocumentItems cdocitems;

    if (object == null) return;
    model = object.getModel();
    alias = cmodel.getModelItemName(model.getName());
    if (alias == null) throw new RuntimeException("Invalid object model.");
    citem = cmodel.getItems().get(alias);
    key = (citem.index == null) ? getKey(cmodel, model, object, alias) : object.get(citem.index);
    cdocitems = items.get(alias);
    if (key == null) key = cdocitems.objects.size();
    items.get(alias).objects.put(key, object);
  }