Exemplo n.º 1
0
 private final Object getKey(
     ComplexModel cmodel, DocumentModel model, ExtendedObject object, String alias) {
   ComplexModelItem citem = cmodel.getItems().get(alias);
   if (citem.index != null) return object.get(citem.index);
   for (DocumentModelKey modelkey : model.getKeys())
     return object.get(modelkey.getModelItemName());
   return null;
 }
Exemplo 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);
  }
Exemplo n.º 3
0
 /** @return */
 @SuppressWarnings("unchecked")
 public final <T> T getKey() {
   for (DocumentModelKey key : cmodel.getHeader().getKeys())
     return (T) header.get(key.getModelItemName());
   return null;
 }