001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019
020package org.apache.isis.core.metamodel.interactions;
021
022import org.apache.isis.core.metamodel.consent.Allow;
023import org.apache.isis.core.metamodel.consent.Consent;
024import org.apache.isis.core.metamodel.consent.InteractionAdvisor;
025import org.apache.isis.core.metamodel.consent.Veto;
026import org.apache.isis.core.metamodel.facetapi.Facet;
027import org.apache.isis.core.metamodel.facetapi.FacetHolder;
028
029/**
030 * Used by {@link Consent} (specifically the main implementations {@link Allow}
031 * and {@link Veto}), with the idea being that the only things that can create
032 * {@link Consent} objects are {@link Facet}s.
033 * 
034 * <p>
035 * TODO: note, this is a work-in-progress, because the DnD viewer in particular
036 * creates its own {@link Allow}s and {@link Veto}s. The constructors that it
037 * uses have been deprecated to flag that the DnD logic should move into
038 * {@link Facet}s that implement this interface.
039 * 
040 * @author Dan Haywood
041 * 
042 */
043public interface InteractionAdvisorFacet extends InteractionAdvisor, Facet {
044
045    /**
046     * For testing purposes only.
047     */
048    public static InteractionAdvisorFacet NOOP = new InteractionAdvisorFacet() {
049        @Override
050        public boolean alwaysReplace() {
051            return false;
052        }
053
054        @Override
055        public Class<? extends Facet> facetType() {
056            return null;
057        }
058
059        @Override
060        public FacetHolder getFacetHolder() {
061            return null;
062        }
063
064        @Override
065        public boolean isNoop() {
066            return true;
067        }
068
069        @Override
070        public void setFacetHolder(final FacetHolder facetHolder) {
071        }
072
073        @Override
074        public Facet getUnderlyingFacet() {
075            return null;
076        }
077
078        @Override
079        public void setUnderlyingFacet(final Facet underlyingFacet) {
080            throw new UnsupportedOperationException();
081        }
082
083        @Override
084        public boolean isDerived() {
085            return false;
086        }
087
088    };
089
090}