001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved 005 * 006 * The contents of this file are subject to the terms 007 * of the Common Development and Distribution License 008 * (the License). You may not use this file except in 009 * compliance with the License. 010 * 011 * You can obtain a copy of the License at 012 * https://opensso.dev.java.net/public/CDDLv1.0.html or 013 * opensso/legal/CDDLv1.0.txt 014 * See the License for the specific language governing 015 * permission and limitations under the License. 016 * 017 * When distributing Covered Code, include this CDDL 018 * Header Notice in each file and include the License file 019 * at opensso/legal/CDDLv1.0.txt. 020 * If applicable, add the following below the CDDL Header, 021 * with the fields enclosed by brackets [] replaced by 022 * your own identifying information: 023 * "Portions Copyrighted [year] [name of copyright owner]" 024 * 025 * $Id: ConditionDecision.java,v 1.2 2008/06/25 05:43:43 qcheng Exp $ 026 * 027 * Portions Copyrighted 2014 ForgeRock AS. 028 */ 029 030 031 032package com.sun.identity.policy; 033 034import java.util.Map; 035import java.util.HashMap; 036 037/** 038 * The <code>ConditionDecision</code> class represents the result of 039 * the evaluation of a condition. 040 * 041 * @supported.all.api 042 * @deprecated since 12.0.0 043 */ 044@Deprecated 045public class ConditionDecision { 046 047 private boolean allowed; 048 private Map advices = new HashMap(); 049 private long timeToLive = Long.MAX_VALUE; 050 051 /** No argument constructor */ 052 public ConditionDecision() { 053 } 054 055 /** Constructs <code>ConditionDecision</code> given the boolean result of 056 * a condition evaluation 057 * 058 * @param allowed boolean result of a condition evaluation 059 */ 060 public ConditionDecision(boolean allowed) { 061 this.allowed = allowed; 062 } 063 064 /** Constructs <code>ConditionDecision</code> given the boolean result of 065 * a condition evaluation and advices 066 * 067 * @param allowed boolean result of a condition evaluation 068 * @param advices A <code>Map</code> representing advices associated with 069 * this <code>ConditionDecision</code>. 070 * The advice name is the key to the Map. The 071 * value is a <code>Set</code> of advice message Strings corresponding 072 * to the advice name. 073 * The advice name examples are 074 * SessionCondition.SESSION_CONDITION_ADVICE 075 * AuthSchemeCondition.AUTH_SCHEME_CONDITION_ADVICE 076 */ 077 public ConditionDecision(boolean allowed, Map advices) { 078 this.allowed = allowed; 079 this.advices = advices; 080 } 081 082 /** Constructs <code>ConditionDecision</code> given the boolean result of 083 * a condition evaluation and time to live 084 * 085 * @param allowed boolean result of a condition evaluation 086 * @param timeToLive GMT time in milliseconds since epoch when 087 * this object is to be treated as expired. 088 */ 089 public ConditionDecision(boolean allowed, long timeToLive) { 090 this.allowed = allowed; 091 this.timeToLive = timeToLive; 092 } 093 094 /** Constructs <code>ConditionDecision</code> given the boolean result of 095 * a condition evaluation, time to live and advices 096 * 097 * @param allowed boolean result of a condition evaluation 098 * @param timeToLive GMT time in milliseconds since epoch when 099 * this object is to be treated as expired. 100 * @param advices advices associated with this action decision. 101 * The advice name is the key to the Map. The 102 * value is a set of advice message Strings corresponding to the 103 * advice name. 104 * The advice name examples are 105 * SessionCondition.SESSION_CONDITION_ADVICE 106 * AuthSchemeCondition.AUTH_SCHEME_CONDITION_ADVICE 107 */ 108 public ConditionDecision(boolean allowed, long timeToLive, Map advices) { 109 this.allowed = allowed; 110 this.timeToLive = timeToLive; 111 this.advices = advices; 112 } 113 114 /** Sets boolean result of condition evaluation 115 * 116 * @param allowed boolean result of condition evaluation 117 */ 118 public void setAllowed(boolean allowed) { 119 this.allowed = allowed; 120 } 121 122 /** Gets boolean result of condition evaluation 123 * 124 * @return result of condition evaluation 125 */ 126 public boolean isAllowed() { 127 return allowed; 128 } 129 130 /** Sets advices associated with this object 131 * 132 * @param advices A <code>Map</code> representing advices associated with 133 * this object. 134 * The advice name is the key to the Map. The 135 * value is a <code>Set</code> of advice message Strings corresponding 136 * to the advice name. 137 * The advice name examples are 138 * SessionCondition.SESSION_CONDITION_ADVICE 139 * AuthSchemeCondition.AUTH_SCHEME_CONDITION_ADVICE 140 */ 141 public void setAdvices(Map advices) { 142 this.advices = advices; 143 } 144 145 /** Gets advices associated with this object 146 * 147 * @return advices associated with this object. 148 * The advice name is the key to the <code>Map</code>. The 149 * value is a <code>Set</code> of advice message Strings corresponding 150 * to the advice name. 151 */ 152 public Map getAdvices() { 153 return advices; 154 } 155 156 /** Sets <code>timeToLive</code> associated with this object 157 * 158 * @param timeToLive GMT time in milliseconds since epoch when 159 * this object is to be treated as expired. 160 */ 161 public void setTimeToLive(long timeToLive) { 162 this.timeToLive = timeToLive; 163 } 164 165 /** Gets <code>timeToLive</code> associated with this object 166 * 167 * @return GMT time in milliseconds since epoch when 168 * this object is to be treated as expired. 169 */ 170 public long getTimeToLive() { 171 return timeToLive; 172 } 173}