public void execute(final Workspace workspace, final View view, final Location at) { collection.changeState(ResolveState.GHOST); } });
public void changeState(ResolveState newState) { wrappedCollection.changeState(newState); }
protected void makePersistent(final NakedCollection collection, final PersistedObjectAdder persistor) { LOG.info("persist " + collection); if (collection.getResolveState() == ResolveState.GHOST) { collection.changeState(ResolveState.RESOLVING); collection.changeState(ResolveState.RESOLVED); } else if (collection.getResolveState() == ResolveState.TRANSIENT) { collection.changeState(ResolveState.RESOLVED); } Enumeration elements = collection.elements(); while (elements.hasMoreElements()) { persist((NakedObject) elements.nextElement(), persistor); } }
protected void makePersistent(final NakedCollection collection, final PersistedObjectAdder persistor) { LOG.info("persist " + collection); if (collection.getResolveState() == ResolveState.TRANSIENT) { collection.changeState(ResolveState.RESOLVED); } Enumeration elements = collection.elements(); while (elements.hasMoreElements()) { makePersistent((NakedObject) elements.nextElement(), persistor); } }
private NakedCollection createAdapter( final NakedObject parent, final String fieldName, final NakedObjectSpecification specification, final Object collection, InternalCollectionKey key) { NakedCollection adapter; adapter = NakedObjectsContext.getReflector().createCollectionAdapter(collection, specification); if (parent.getResolveState().isPersistent()) { /* * don't log "collection" as this may cause it to resolve e.g. when using Hibernate, as toString * lists all objects inside the collection */ LOG.debug("creating adapter for persistent collection: " + fieldName); adapter.changeState(ResolveState.GHOST); // TODO loadEvent will create adapter for proxy, but collection is a // different matter // if adapter exists for collection it will be set to resolved in the loadEvent, but we // can't create the new adapter at that point as we can't get the field. so make sure // state is correct here. if (Hibernate.isInitialized(collection)) { adapter.changeState(ResolveState.RESOLVING); adapter.changeState(ResolveState.RESOLVED); } } else { LOG.debug("creating adapter for transient collection: " + collection); adapter.changeState(ResolveState.TRANSIENT); } return adapter; }
private void makePersistent(final NakedCollection collection, final PersistedObjectAdder persistor) { if (collection.getResolveState().isPersistent() || collection.persistable() == Persistable.TRANSIENT) { return; } LOG.info("persist " + collection); if (collection.getResolveState() == ResolveState.TRANSIENT) { collection.changeState(ResolveState.RESOLVED); } NakedObjectsContext.getObjectLoader().madePersistent(collection); Enumeration elements = collection.elements(); while (elements.hasMoreElements()) { makePersistent((NakedObject) elements.nextElement(), persistor); } }
private void makePersistent(final NakedCollection collection, final PersistedObjectAdder persistor) { if (collection.getResolveState().isPersistent() || collection.persistable() == Persistable.TRANSIENT) { return; } LOG.info("persist " + collection); if (collection.getResolveState() == ResolveState.TRANSIENT) { collection.changeState(ResolveState.RESOLVED); } NakedObjectsContext.getObjectLoader().madePersistent(collection); Enumeration elements = collection.elements(); while (elements.hasMoreElements()) { makePersistent((NakedObject) elements.nextElement(), persistor); } }