private Movie getMovie(final NakedObject inObject) { return (Movie) inObject.getObject(); }
private Movie getMovie(final NakedObject inObject) { return (Movie) inObject.getObject(); }
public Consent canDrop(Content sourceContent) { if (object.getObject() instanceof Perspective) { return Allow.DEFAULT; } else { return super.canDrop(sourceContent); } }
public void execute(final ExecutionContext context) { useExistingHibernateTransaction(); LOG.debug(" destroy object - actual delete " + object); HibernateUtil.getCurrentSession().delete(object.getObject()); }
public Object nullSafeGet(final ResultSet rs, final String[] names, final Object owner) throws HibernateException, SQLException { String id = rs.getString(names[0]); if (rs.wasNull()) return null; Oid oid = new HibernateOid(id,id,id); NakedObject adapter = NakedObjectsContext.getObjectLoader().getAdapterFor(oid); if (adapter == null) { throw new HibernateException("Unknown DomainModelResource: id="+id); } return adapter.getObject(); }
public void execute(final ExecutionContext context) { useExistingHibernateTransaction(); LOG.debug(" save object - actual update " + object); Object toUpdate; if (Features.isAggregated(object.getSpecification())) { final NakedObject parent = object.getSpecification().getAggregate(object); LOG.debug("change to internal collection being persisted through parent"); toUpdate = parent.getObject(); } else { toUpdate = object.getObject(); } HibernateUtil.getCurrentSession().update(toUpdate); }
public NakedObject getObject(final Oid oid, final NakedObjectSpecification hint) throws ObjectNotFoundException, ObjectPersistenceException { NakedObject object = decorated.getObject(oid, hint); log("Get object for " + oid + " (of type " + hint.getShortName() + ")", object.getObject()); return object; }
public void initValue(final NakedObject inObject, final NakedValue val) { Assert.assertTrue(inObject.getObject() instanceof TestPojo); setValue(inObject, val); }
public NakedValue getValue(final NakedObject inObject) { Assert.assertTrue(inObject.getObject() instanceof TestPojo); int value = ((TestPojo) inObject).getValue(); return new IntAdapter(new Integer(value)); }
public final NakedValue getValue(NakedObject inObject) { String name = getValue(((Perspective) inObject.getObject())); if (name == null) { // return new StringAdapter(); return NakedObjectsContext.getObjectLoader().createValueInstance(stringSpec); } else { return NakedObjectsContext.getObjectLoader().createAdapterForValue(name); } }
public NakedObject getAssociation(final NakedObject inObject) { Assert.assertTrue(inObject.getObject() instanceof TestPojo); Object reference = ((TestPojo) inObject).getReference(); DummyNakedObject nakedObject = new DummyNakedObject(); nakedObject.setupObject(reference); return nakedObject; }
public void testInitValue() { association.initValue(nakedObject, new IntAdapter(new Integer(12))); assertEquals(12, ((TestPojo) nakedObject.getObject()).getValue()); }
public void clearAssociation(final NakedObject inObject, final NakedObject associate) { if (getMovie(inObject).getDirector() != associate.getObject()) { throw new NakedObjectRuntimeException("clear value not set to " + getMovie(inObject).getDirector() + " but was " + associate.getObject()); } getMovie(inObject).setDirector(null); }
public void testRecreateTransientAdapter() { Oid oid = new TestProxyOid(13, false); Object object = new TestPojo(); NakedObject adapter = objectLoader.recreateAdapter(oid, object); assertEquals(oid, adapter.getOid()); assertEquals(object, adapter.getObject()); assertEquals(ResolveState.TRANSIENT, adapter.getResolveState()); assertEquals(null, adapter.getVersion()); }
public void testRecreatePersistentAdapter() { Oid oid = new TestProxyOid(15, true); Object object = new TestPojo(); NakedObject adapter = objectLoader.recreateAdapter(oid, object); assertEquals(oid, adapter.getOid()); assertEquals(object, adapter.getObject()); assertEquals(ResolveState.GHOST, adapter.getResolveState()); assertEquals(null, adapter.getVersion()); }