Example #1
0
 public final void remove(ComplexDocument document) {
   String alias;
   if (document == null) return;
   alias = cmodel.getModelItemName(document.getModel().getName());
   if (alias == null) throw new RuntimeException("Invalid object model.");
   items.get(alias).documents.remove(document.getKey());
 }
Example #2
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));
 }
Example #3
0
  public final void add(ComplexDocument document) {
    String alias;
    Object key;
    ComplexModelItem citem;
    ComplexDocumentItems cdocitems;

    if (document == null) return;
    alias = cmodel.getModelItemName(document.getModel().getName());
    if (alias == null) throw new RuntimeException("Invalid object model.");
    citem = cmodel.getItems().get(alias);
    key = (citem.index == null) ? document.getKey() : document.getHeader().get(citem.index);
    cdocitems = items.get(alias);
    if (key == null) key = cdocitems.documents.size();
    cdocitems.documents.put(key, document);
  }
Example #4
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);
  }