/** * Throw an exception indicating that the current action can't be * performed on a detached object. */ private OpenJPAException newDetachedException(Object obj, String operation) { throw new UserException(_loc.get("bad-detached-op", operation, Exceptions.toString(obj))).setFailedObject(obj); }
/** * Throw an exception indicating that the current action can't be * performed on a detached object. */ private OpenJPAException newDetachedException(Object obj, String operation) { throw new UserException(_loc.get("bad-detached-op", operation, Exceptions.toString(obj))).setFailedObject(obj); }
/** * Throw an exception indicating that the current action can't be * performed on a detached object. */ private OpenJPAException newDetachedException(Object obj, String operation) { throw new UserException(_loc.get("bad-detached-op", operation, Exceptions.toString(obj))).setFailedObject(obj); }
/** * Throw an exception indicating that the current action can't be * performed on a detached object. */ private OpenJPAException newDetachedException(Object obj, String operation) { throw new UserException(_loc.get("bad-detached-op", operation, Exceptions.toString(obj))).setFailedObject(obj); }
/** * Throw an exception indicating that the current action can't be * performed on a detached object. */ private OpenJPAException newDetachedException(Object obj, String operation) { throw new UserException(_loc.get("bad-detached-op", operation, Exceptions.toString(obj))).setFailedObject(obj); }
/** * Throw an exception if the given object is not managed; otherwise * return its state manager. */ StateManagerImpl assertManaged(Object obj) { StateManagerImpl sm = _broker.getStateManagerImpl(obj, true); if (sm == null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject (obj); return sm; } }
/** * Throw an exception if the given object is not managed; otherwise * return its state manager. */ StateManagerImpl assertManaged(Object obj) { StateManagerImpl sm = _broker.getStateManagerImpl(obj, true); if (sm == null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject (obj); return sm; } }
/** * Throw an exception if the given object is not managed; otherwise * return its state manager. */ StateManagerImpl assertManaged(Object obj) { StateManagerImpl sm = _broker.getStateManagerImpl(obj, true); if (sm == null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject (obj); return sm; } }
/** * Throw an exception if the given object is not managed; otherwise * return its state manager. */ StateManagerImpl assertManaged(Object obj) { StateManagerImpl sm = _broker.getStateManagerImpl(obj, true); if (sm == null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject (obj); return sm; } }
/** * Throw an exception if the given object is not managed; otherwise * return its state manager. */ StateManagerImpl assertManaged(Object obj) { StateManagerImpl sm = _broker.getStateManagerImpl(obj, true); if (sm == null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject (obj); return sm; } }
public void dirty(String field) { FieldMetaData fmd = _meta.getField(field); if (fmd == null) throw translate(new UserException(_loc.get("no-field", field, ImplHelper.getManagedInstance(_pc).getClass())) .setFailedObject(getManagedInstance())); dirty(fmd.getIndex(), null, true); }
public void dirty(String field) { FieldMetaData fmd = _meta.getField(field); if (fmd == null) throw translate(new UserException(_loc.get("no-field", field, ImplHelper.getManagedInstance(_pc).getClass())) .setFailedObject(getManagedInstance())); dirty(fmd.getIndex(), null, true); }
public void dirty(String field) { FieldMetaData fmd = _meta.getField(field); if (fmd == null) throw translate(new UserException(_loc.get("no-field", field, ImplHelper.getManagedInstance(_pc).getClass())) .setFailedObject(getManagedInstance())); dirty(fmd.getIndex(), null, true); }
public void dirty(String field) { FieldMetaData fmd = _meta.getField(field); if (fmd == null) throw translate(new UserException(_loc.get("no-field", field, ImplHelper.getManagedInstance(_pc).getClass())) .setFailedObject(getManagedInstance())); dirty(fmd.getIndex(), null, true); }
public void dirty(String field) { FieldMetaData fmd = _meta.getField(field); if (fmd == null) throw translate(new UserException(_loc.get("no-field", field, ImplHelper.getManagedInstance(_pc).getClass())) .setFailedObject(getManagedInstance())); dirty(fmd.getIndex(), null, true); }
/** * Return the state manager for the given instance, or null. * * @param assertThisContext if true, thow an exception if the given * object is managed by another broker */ protected StateManagerImpl getStateManagerImpl(Object obj, boolean assertThisContext) { if (ImplHelper.isManageable(obj)) { PersistenceCapable pc = ImplHelper.toPersistenceCapable(obj, _conf); BrokerImpl pcBroker = (BrokerImpl)pc.pcGetGenericContext(); if (pcBroker == this || isFromWriteBehindCallback()) return (StateManagerImpl) pc.pcGetStateManager(); if (assertThisContext && pcBroker != null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject(obj); } return null; }
/** * Return the state manager for the given instance, or null. * * @param assertThisContext if true, thow an exception if the given * object is managed by another broker */ protected StateManagerImpl getStateManagerImpl(Object obj, boolean assertThisContext) { if (ImplHelper.isManageable(obj)) { PersistenceCapable pc = ImplHelper.toPersistenceCapable(obj, _conf); if (pc.pcGetGenericContext() == this) return (StateManagerImpl) pc.pcGetStateManager(); if (assertThisContext && pc.pcGetGenericContext() != null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject(obj); } return null; }
/** * Return the state manager for the given instance, or null. * * @param assertThisContext if true, thow an exception if the given * object is managed by another broker */ protected StateManagerImpl getStateManagerImpl(Object obj, boolean assertThisContext) { if (ImplHelper.isManageable(obj)) { PersistenceCapable pc = ImplHelper.toPersistenceCapable(obj, _conf); BrokerImpl pcBroker = (BrokerImpl)pc.pcGetGenericContext(); if (pcBroker == this || isFromWriteBehindCallback()) return (StateManagerImpl) pc.pcGetStateManager(); if (assertThisContext && pcBroker != null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject(obj); } return null; }
/** * Return the state manager for the given instance, or null. * * @param assertThisContext if true, thow an exception if the given * object is managed by another broker */ protected StateManagerImpl getStateManagerImpl(Object obj, boolean assertThisContext) { if (ImplHelper.isManageable(obj)) { PersistenceCapable pc = ImplHelper.toPersistenceCapable(obj, _conf); BrokerImpl pcBroker = (BrokerImpl)pc.pcGetGenericContext(); if (pcBroker == this || isFromWriteBehindCallback()) return (StateManagerImpl) pc.pcGetStateManager(); if (assertThisContext && pcBroker != null) throw new UserException(_loc.get("not-managed", Exceptions.toString(obj))).setFailedObject(obj); } return null; }
/** * Return a managed, possibly hollow reference for the given detached * object. */ protected Object getReference(AttachManager manager, Object toAttach, OpenJPAStateManager sm, ValueMetaData vmd) { if (toAttach == null) return null; if (manager.getBroker().isNew(toAttach) || manager.getBroker().isPersistent(toAttach)) { return toAttach; } else if (manager.getBroker().isDetached(toAttach)) { Object oid = manager.getDetachedObjectId(toAttach); if (oid != null) return manager.getBroker().find(oid, false, null); } throw new UserException(_loc.get("cant-cascade-attach", vmd)) .setFailedObject(toAttach); }