Package org.apache.isis.runtimes.dflt.remoting.common.exchange

Examples of org.apache.isis.runtimes.dflt.remoting.common.exchange.SetAssociationRequest


                    // silently ignore; shouldn't happen
                } else {
                    ObjectData[] updates;
                    if (!associatedSpec.isValueOrIsAggregated()) {
                        final IdentityData associateReference = encoder.encodeIdentityData(associateAdapter);
                        final SetAssociationRequest request = new SetAssociationRequest(getAuthenticationSession(), name, targetReference, associateReference);
                        final SetAssociationResponse response = serverFacade.setAssociation(request);
                        updates = response.getUpdates();
                    } else {
                        final EncodableObjectData val = encoder.encodeAsValue(associateAdapter);
                        final SetValueRequest request = new SetValueRequest(getAuthenticationSession(), name, targetReference, val);
View Full Code Here


    public void add(final ObjectAdapter inObject, final ObjectAdapter referencedAdapter) {
        if (inObject.isPersistent()) {
            try {
                final IdentityData targetReference = encoderDecoder.encodeIdentityData(inObject);
                final IdentityData associateReference = encoderDecoder.encodeIdentityData(referencedAdapter);
                final SetAssociationRequest request = new SetAssociationRequest(getAuthenticationSession(), name, targetReference, associateReference);
                final SetAssociationResponse response = serverFacade.setAssociation(request);
                final ObjectData[] updates = response.getUpdates();
                encoderDecoder.decode(updates);
            } catch (final ConcurrencyException e) {
                throw ProxyUtil.concurrencyException(e);
View Full Code Here

    }

    @Test
    public void testSetAssociation() {
        IsisContext.getTransactionManager().startTransaction();
        final SetAssociationRequest request = new SetAssociationRequest(authenticationSession, "director", movieData, personData);
        final SetAssociationResponse response = server.setAssociation(request);
        final ObjectData[] updates = response.getUpdates();
        IsisContext.getTransactionManager().endTransaction();

        nameField.assertField(movieAdapter, personAdapter.getObject());
View Full Code Here

    @Test
    public void testSetAssociationFailsWithNonCurrentTarget() {
        // version should be different, causing concurrency exception
        movieAdapter.setOptimisticLock(new TestProxyVersion(6));
        try {
            final SetAssociationRequest request = new SetAssociationRequest(authenticationSession, "director", movieData, personData);
            server.setAssociation(request);
            fail();
        } catch (final ConcurrencyException expected) {
        }
    }
View Full Code Here

    @Test
    public void testSetAssociationFailsWhenInvisible() {
        nameField.setUpIsVisible(false);
        try {
            final SetAssociationRequest request = new SetAssociationRequest(authenticationSession, "director", movieData, personData);
            server.setAssociation(request);
            fail();
        } catch (final IsisException expected) {
            assertEquals("can't modify field as not visible or editable", expected.getMessage());
        }
View Full Code Here

    @Test
    public void testSetAssociationFailsWhenUnavailable() {
        nameField.setUpIsUnusableFor(movieAdapter);
        try {
            final SetAssociationRequest request = new SetAssociationRequest(authenticationSession, "director", movieData, personData);
            server.setAssociation(request);
            fail();
        } catch (final IsisException expected) {
            assertEquals("can't modify field as not visible or editable", expected.getMessage());
        }
View Full Code Here

    @Test
    public void testSetAssociationFailsWithNonCurrentAssociate() {
        // version should be different, causing concurrency exception
        personAdapter.setOptimisticLock(new TestProxyVersion(6));
        try {
            final SetAssociationRequest request = new SetAssociationRequest(authenticationSession, "director", movieData, personData);
            server.setAssociation(request);
            fail();
        } catch (final ConcurrencyException expected) {
        }
    }
View Full Code Here

                    // silently ignore; shouldn't happen
                } else {
                    ObjectData[] updates;
                    if (!associatedSpec.isValueOrIsAggregated()) {
                        final IdentityData associateReference = encoder.encodeIdentityData(associateAdapter);
                        final SetAssociationRequest request =
                            new SetAssociationRequest(getAuthenticationSession(), name, targetReference,
                                associateReference);
                        final SetAssociationResponse response = serverFacade.setAssociation(request);
                        updates = response.getUpdates();
                    } else {
                        final EncodableObjectData val = encoder.encodeAsValue(associateAdapter);
View Full Code Here

    public void add(final ObjectAdapter inObject, final ObjectAdapter referencedAdapter) {
        if (inObject.isPersistent()) {
            try {
                final IdentityData targetReference = encoderDecoder.encodeIdentityData(inObject);
                final IdentityData associateReference = encoderDecoder.encodeIdentityData(referencedAdapter);
                final SetAssociationRequest request =
                    new SetAssociationRequest(getAuthenticationSession(), name, targetReference, associateReference);
                final SetAssociationResponse response = serverFacade.setAssociation(request);
                final ObjectData[] updates = response.getUpdates();
                encoderDecoder.decode(updates);
            } catch (final ConcurrencyException e) {
                throw ProxyUtil.concurrencyException(e);
View Full Code Here

    }

    @Test
    public void testSetAssociation() {
        IsisContext.getTransactionManager().startTransaction();
        final SetAssociationRequest request =
            new SetAssociationRequest(authenticationSession, "director", movieData, personData);
        final SetAssociationResponse response = server.setAssociation(request);
        final ObjectData[] updates = response.getUpdates();
        IsisContext.getTransactionManager().endTransaction();

        nameField.assertField(movieAdapter, personAdapter.getObject());
View Full Code Here

TOP

Related Classes of org.apache.isis.runtimes.dflt.remoting.common.exchange.SetAssociationRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.