public void execute() { underlyingFacet.remove(adapter, referencedAdapter); }}); }
public void removeElement(final NakedObject ownerAdapter, final NakedObject referencedAdapter) { if (referencedAdapter == null) { throw new IllegalArgumentException("element should not be null"); } if (readWrite()) { final CollectionRemoveFromFacet facet = getFacet(CollectionRemoveFromFacet.class); facet.remove(ownerAdapter, referencedAdapter); } }
public void removeElement(final NakedObject ownerAdapter, final NakedObject referencedAdapter) { if (referencedAdapter == null) { throw new IllegalArgumentException("element should not be null"); } if (readWrite()) { final CollectionRemoveFromFacet facet = getFacet(CollectionRemoveFromFacet.class); facet.remove(ownerAdapter, referencedAdapter); } }
public void remove(final NakedObject adapter, final NakedObject referencedAdapter) { if (adapter.isTransient()) { // NOT !adapter.isPersistent(); // (value adapters are neither persistent or transient) underlyingFacet.remove(adapter, referencedAdapter); } else { getTransactionManager().executeWithinTransaction( new TransactionalClosureAbstract(){ public void execute() { underlyingFacet.remove(adapter, referencedAdapter); }}); } }
/** * Remove an associated object (the element) from the specified NakedObject in the association field * represented by this object. */ public void remove(final NakedObject inObject, final NakedObject associate) { if (inObject.isPersistent()) { LOG.debug("clear association remotely " + inObject + "/" + associate); try { final IdentityData targetReference = encoder.encodeIdentityData(inObject); final IdentityData associateReference = encoder.encodeIdentityData(associate); ClearAssociationRequest request = new ClearAssociationRequest(getAuthenticationSession(), name, targetReference, associateReference); ClearAssociationResponse response = serverFacade.clearAssociation(request); ObjectData[] updates = response.getUpdates(); encoder.decode(updates); } catch (final ConcurrencyException e) { throw ProxyUtil.concurrencyException(e); } catch (final NakedObjectException e) { LOG.error("remote exception: " + e.getMessage(), e); throw e; } } else { LOG.debug("clear association locally " + inObject + "/" + associate); underlyingFacet.remove(inObject, associate); } }
/** * Remove an associated object (the element) from the specified NakedObject in the association field * represented by this object. */ public void remove(final NakedObject inObject, final NakedObject associate) { if (inObject.isPersistent()) { LOG.debug("clear association remotely " + inObject + "/" + associate); try { final IdentityData targetReference = encoder.encodeIdentityData(inObject); final IdentityData associateReference = encoder.encodeIdentityData(associate); ClearAssociationRequest request = new ClearAssociationRequest(getAuthenticationSession(), name, targetReference, associateReference); ClearAssociationResponse response = serverFacade.clearAssociation(request); ObjectData[] updates = response.getUpdates(); encoder.decode(updates); } catch (final ConcurrencyException e) { throw ProxyUtil.concurrencyException(e); } catch (final NakedObjectException e) { LOG.error("remote exception: " + e.getMessage(), e); throw e; } } else { LOG.debug("clear association locally " + inObject + "/" + associate); underlyingFacet.remove(inObject, associate); } }