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.consent; 021 022public interface Consent { 023 024 /** 025 * Returns true if this object is giving permission. 026 */ 027 boolean isAllowed(); 028 029 /** 030 * Returns true if this object is NOT giving permission. 031 */ 032 boolean isVetoed(); 033 034 /** 035 * Why consent is being vetoed. 036 * 037 * <p> 038 * Will be non-<tt>null</tt> and non-empty if vetoed. Will be <tt>null</tt> 039 * (<i>not</i> the empty string) if this is consent is is allowed. 040 * 041 * <p> 042 * Will correspond to the {@link InteractionResult#getReason() reason} in 043 * the contained {@link #getInteractionResult() InteractionResult} (if one 044 * was specified). 045 */ 046 String getReason(); 047 048 /** 049 * Description of the interaction that this consent represents. 050 * 051 * <p> 052 * May be <tt>null</tt>. 053 */ 054 String getDescription(); 055 056 /** 057 * Allows the description of the interaction to which this consent relates 058 * to be specified or refined. 059 * 060 * @param description 061 * @return this consent 062 */ 063 Consent setDescription(String description); 064 065 /** 066 * The {@link InteractionResult} that created this {@link Consent}. 067 * 068 * @return - may be <tt>null</tt> if created as a legacy {@link Consent}. 069 * 070 */ 071 public InteractionResult getInteractionResult(); 072 073}