public void execute() { underlyingFacet.add(adapter, referencedAdapter); }}); }
public CollectionAddToFacetWrapProxy( final CollectionAddToFacet underlyingFacet, final ServerFacade connection, final ObjectEncoderDecoder encoderDecoder, final String name) { super(underlyingFacet.getFacetHolder()); this.underlyingFacet = underlyingFacet; this.serverFacade = connection; this.encoderDecoder = encoderDecoder; this.name = name; }
public void add(final NakedObject adapter, final NakedObject referencedAdapter) { if (adapter.isTransient()) { // NOT !adapter.isPersistent(); // (value adapters are neither persistent or transient) underlyingFacet.add(adapter, referencedAdapter); } else { getTransactionManager().executeWithinTransaction( new TransactionalClosureAbstract(){ public void execute() { underlyingFacet.add(adapter, referencedAdapter); }}); } }
public CollectionAddToFacetWrapProxy( final CollectionAddToFacet underlyingFacet, final ServerFacade connection, final ObjectEncoderDecoder encoderDecoder, final String name) { super(underlyingFacet.getFacetHolder()); this.underlyingFacet = underlyingFacet; this.serverFacade = connection; this.encoderDecoder = encoderDecoder; this.name = name; }
public void addElement(final NakedObject ownerAdapter, final NakedObject referencedAdapter) { if (referencedAdapter == null) { throw new IllegalArgumentException("Can't use null to add an item to a collection"); } if (readWrite()) { if (ownerAdapter.isPersistent() && referencedAdapter.isTransient()) { throw new NakedObjectException("can't set a reference to a transient object from a persistent one: " + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString() + " (transient)"); } final CollectionAddToFacet facet = getFacet(CollectionAddToFacet.class); facet.add(ownerAdapter, referencedAdapter); } }
public CollectionAddToFacetWrapTransaction(final CollectionAddToFacet underlyingFacet) { super(underlyingFacet.getFacetHolder()); this.underlyingFacet = underlyingFacet; }
public void addElement(final NakedObject ownerAdapter, final NakedObject referencedAdapter) { if (referencedAdapter == null) { throw new IllegalArgumentException("Can't use null to add an item to a collection"); } if (readWrite()) { if (ownerAdapter.isPersistent() && referencedAdapter.isTransient()) { throw new NakedObjectException("can't set a reference to a transient object from a persistent one: " + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString() + " (transient)"); } final CollectionAddToFacet facet = getFacet(CollectionAddToFacet.class); facet.add(ownerAdapter, referencedAdapter); } }
public void add(final NakedObject inObject, final NakedObject referencedAdapter) { if (inObject.isPersistent()) { try { final IdentityData targetReference = encoderDecoder.encodeIdentityData(inObject); final IdentityData associateReference = encoderDecoder.encodeIdentityData(referencedAdapter); SetAssociationRequest request = new SetAssociationRequest(getAuthenticationSession(), name, targetReference, associateReference); SetAssociationResponse response = serverFacade.setAssociation(request); ObjectData[] updates = response.getUpdates(); encoderDecoder.decode(updates); } catch (final ConcurrencyException e) { throw ProxyUtil.concurrencyException(e); } catch (final NakedObjectException e) { LOG.error("remote exception: " + e.getMessage(), e); throw e; } } else { underlyingFacet.add(inObject, referencedAdapter); } }
public void add(final NakedObject inObject, final NakedObject referencedAdapter) { if (inObject.isPersistent()) { try { final IdentityData targetReference = encoderDecoder.encodeIdentityData(inObject); final IdentityData associateReference = encoderDecoder.encodeIdentityData(referencedAdapter); SetAssociationRequest request = new SetAssociationRequest(getAuthenticationSession(), name, targetReference, associateReference); SetAssociationResponse response = serverFacade.setAssociation(request); ObjectData[] updates = response.getUpdates(); encoderDecoder.decode(updates); } catch (final ConcurrencyException e) { throw ProxyUtil.concurrencyException(e); } catch (final NakedObjectException e) { LOG.error("remote exception: " + e.getMessage(), e); throw e; } } else { underlyingFacet.add(inObject, referencedAdapter); } }