All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nakedobjects.nos.remote.command.ClearAssociation Maven / Gradle / Ivy

There is a newer version: 3.0.3
Show newest version
package org.nakedobjects.nos.remote.command;

import org.nakedobjects.noa.security.Session;
import org.nakedobjects.noa.util.ByteDecoder;
import org.nakedobjects.noa.util.ByteEncoder;
import org.nakedobjects.nof.reflect.remote.data.Distribution;
import org.nakedobjects.nof.reflect.remote.data.IdentityData;
import org.nakedobjects.nof.reflect.remote.data.ObjectData;


public class ClearAssociation extends AbstractRequest {
    private static final long serialVersionUID = 1L;
    private final String fieldIdentifier;
    private final IdentityData target;
    private final IdentityData associate;

    public ClearAssociation(final Session session, final String fieldIdentifier, final IdentityData target, final IdentityData associate) {
        super(session);
        this.fieldIdentifier = fieldIdentifier;
        this.target = target;
        this.associate = associate;
    }
    
    public ClearAssociation(ByteDecoder decoder) {
        super(decoder);
        fieldIdentifier = decoder.getString();
        target = (IdentityData) decoder.getObject();
        associate = (IdentityData) decoder.getObject();
    }

    protected void doEncode(final ByteEncoder encoder) {
        encoder.add(fieldIdentifier);
        encoder.add(target);
        encoder.add(associate);
    }

    public void execute(final Distribution distribution) {
        response = distribution.clearAssociation(session, fieldIdentifier, target, associate);
    }

    public ObjectData[] getChanges() {
        return (ObjectData[]) response;
    }
}
// Copyright (c) Naked Objects Group Ltd.




© 2015 - 2025 Weber Informatics LLC | Privacy Policy