Package org.chromattic.core

Examples of org.chromattic.core.DomainSession


  @Override
  public void set(ObjectContext context, Object parent) throws Throwable {
    if (parent == null) {
      context.remove();
    } else {
      DomainSession session = context.getSession();
      ObjectContext parentContext = session.unwrap(parent);
      parentContext.addChild(relatedName, context);
    }
  }
View Full Code Here


        }
      }
    }

    //
    DomainSession session = parentCtx.getSession();

    //
    ObjectContext addedCtx = session.unwrap(addedElement);
    Status status = addedCtx.getStatus();

    //
    if (status == Status.TRANSIENT) {
      parentCtx.addChild(addedCtx);
    } else if (status == Status.PERSISTENT) {
      Object insertedParent = addedCtx.getParent();
      ObjectContext addedParentCtx = session.unwrap(insertedParent);

      //
      if (addedParentCtx != parentCtx) {
        throw new UnsupportedOperationException("Not yet supported but that should be a node move operation");
      }
    } else {
      throw new IllegalArgumentException();
    }

    //
    if (nextElement == null) {
      parentCtx.orderBefore(addedCtx, null);
    } else {
      ObjectContext nextCtx = session.unwrap(nextElement);
      parentCtx.orderBefore(addedCtx, nextCtx);
    }
  }
View Full Code Here

    // Get the removed element
    E removedElement = get(index);

    // Get the session
    DomainSession session = parentCtx.getSession();

    // Unwrap the removed element
    ObjectContext removedCtx = session.unwrap(removedElement);

    // Remove the element
    session.remove(removedCtx);

    //
    return removedElement;
  }
View Full Code Here

    // Get the removed element
    E removedElement = get(index);

    // Get the session
    DomainSession session = parentCtx.getSession();

    // Unwrap the removed element
    ObjectContext removedCtx = session.unwrap(removedElement);

    // Unwrap the added element
    ObjectContext ctx = session.unwrap(addedElement);

    // Add as child
    parentCtx.addChild(ctx);

    // Order before the removed element
    parentCtx.orderBefore(ctx, removedCtx);

    // Remove the element
    session.remove(removedCtx);

    //
    return removedElement;
  }
View Full Code Here

TOP

Related Classes of org.chromattic.core.DomainSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.