NotCondition.java revision 8af80418ba1ec431c8027fa9668e5678658d3611
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: NotCondition.java,v 1.1 2009/08/19 05:40:33 veiming Exp $
*/
/**
* This class wrapped on an Entitlement Condition object to provide boolean
* NOT.
* Membership of <code>NotCondition</code> is satisfied in the user is not a
* member of the nested <code>EntitlementCondition</code>.
*/
public class NotCondition extends EntitlementConditionAdaptor {
private EntitlementCondition eCondition;
private String pConditionName;
/**
* Constructs <code>NotCondition</code>
*/
public NotCondition() {
}
/**
* Constructs NotCondition
*
* @param eCondition wrapped <code>EntitlementCondition</code>(s)
*/
this.eCondition = eCondition;
}
/**
* Constructs <code>NotCondition</code>.
*
* @param eConditions wrapped <code>EntitlementCondition</code>(s)
* @param pConditionName subject name as used in OpenSSO policy,
* this is releavant only when UserECondition was created from
* OpenSSO policy Condition
*/
public NotCondition(
) {
this.eCondition = eConditions;
this.pConditionName = pConditionName;
}
/**
* Sets state of the object
*
* @param state State of the object encoded as string
*/
try {
if (memberCondition != null) {
}
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (ClassNotFoundException ex) {
} catch (JSONException ex) {
}
}
/**
* Returns state of the object.
*
* @return state of the object encoded as string.
*/
return toString();
}
/**
* Returns <code>ConditionDecision</code> of
* <code>EntitlementCondition</code> evaluation
*
* @param realm Realm name.
* @param subject EntitlementCondition who is under evaluation.
* @param resourceName Resource name.
* @param environment Environment parameters.
* @return <code>ConditionDecision</code> of
* <code>EntitlementCondition</code> evaluation
* @throws EntitlementException if error occurs.
*/
public ConditionDecision evaluate(
) throws EntitlementException {
if (eCondition == null) {
}
}
/**
* Sets the nested <code>EntitlementCondition</code>(s).
*
* @param eCondition the nested <code>EntitlementCondition</code>(s)
*/
this.eCondition = eCondition;
}
/**
* Returns the nested <code>EntitlementCondition</code>(s).
*
* @return the nested <code>EntitlementCondition</code>(s).
*/
public EntitlementCondition getECondition() {
return eCondition;
}
/**
* Sets OpenSSO policy Condition name
* @param pConditionName subject name as used in OpenSSO policy,
* this is releavant only when UserECondition was created from
* OpenSSO policy Condition
*/
this.pConditionName = pConditionName;
}
/**
* Returns OpenSSO policy Condition name
* @return subject name as used in OpenSSO policy,
* this is releavant only when UserECondition was created from
* OpenSSO policy Condition
*/
public String getPConditionName() {
return pConditionName;
}
/**
* Returns JSONObject mapping of the object
* @return JSONObject mapping of the object
* @throws org.json.JSONException if can not map to JSONObject
*/
if (eCondition != null) {
}
return jo;
}
/**
* Returns string representation of the object
* @return string representation of the object
*/
try {
} catch (JSONException e) {
}
return s;
}
/**
* Returns <code>true</code> if the passed in object is equal to this object
* @param obj object to check for equality
* @return <code>true</code> if the passed in object is equal to this object
*/
return false;
}
return false;
}
if (eCondition == null) {
return false;
}
} else {
return false;
}
}
if (pConditionName == null) {
return false;
}
} else {
return false;
}
}
return true;
}
/**
* Returns hash code of the object
* @return hash code of the object
*/
public int hashCode() {
if (eCondition != null) {
}
if (pConditionName != null) {
}
return code;
}
}