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

org.nakedobjects.metamodel.spec.feature.OneToOneAssociation Maven / Gradle / Ivy

There is a newer version: 4.0-beta-1
Show newest version
package org.nakedobjects.metamodel.spec.feature;

import org.nakedobjects.metamodel.adapter.NakedObject;
import org.nakedobjects.metamodel.authentication.AuthenticationSession;
import org.nakedobjects.metamodel.consent.Consent;
import org.nakedobjects.metamodel.consent.InteractionInvocationMethod;
import org.nakedobjects.metamodel.interactions.AccessContext;
import org.nakedobjects.metamodel.interactions.InteractionContext;
import org.nakedobjects.metamodel.interactions.PropertyAccessContext;
import org.nakedobjects.metamodel.interactions.ValidityContext;


/**
 * Provides reflective access to a field on a domain object that is used to reference another domain object.
 */
public interface OneToOneAssociation extends NakedObjectAssociation, OneToOneFeature, MutableCurrentHolder {

    /**
     * Initialise this field in the specified object with the specified reference - this call should only
     * affect the specified object, and not any related objects. It should also not be distributed. This is
     * strictly for re-initialising the object and not specifying an association, which is only done once.
     */
    void initAssociation(NakedObject inObject, NakedObject associate);

    /**
     * Creates an {@link InteractionContext} that represents access to this property.
     */
    public PropertyAccessContext createAccessInteractionContext(
            AuthenticationSession session,
            InteractionInvocationMethod interactionMethod,
            NakedObject targetNakedObject);

    /**
     * Creates an {@link InteractionContext} that represents validation of a proposed new value for the
     * property.
     * 
     * 

* Typically it is easier to just call {@link #isAssociationValid(NakedObject, NakedObject)} or * {@link #isAssociationValidResult(NakedObject, NakedObject)}; this is provided as API for symmetry with * interactions (such as {@link AccessContext} accesses) have no corresponding vetoing methods. */ public ValidityContext createValidateInteractionContext( AuthenticationSession session, InteractionInvocationMethod interactionMethod, NakedObject targetNakedObject, NakedObject proposedValue); /** * Determines if the specified reference is valid for setting this field in the specified object, * represented as a {@link Consent}. */ Consent isAssociationValid(NakedObject inObject, NakedObject associate); /** * Set up the association represented by this field in the specified object with the specified reference - * this call sets up the logical state of the object and might affect other objects that share this * association (such as back-links or bidirectional association). To initialise a recreated object to this * logical state the initAssociation method should be used on each of the objects. * * @see #initAssociation(NakedObject, NakedObject) */ void setAssociation(NakedObject inObject, NakedObject associate); /** * Clear this reference field (make it null) in the specified object, and remove any * association back-link. * * @see #setAssociation(NakedObject, NakedObject) */ void clearAssociation(NakedObject inObject); } // Copyright (c) Naked Objects Group Ltd.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy