PeerOrgReferral.java revision 8af80418ba1ec431c8027fa9668e5678658d3611
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: PeerOrgReferral.java,v 1.3 2008/06/25 05:43:51 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.sm.OrganizationConfigManager;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/** Class to facilitate policy referrals to peer
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * organizations
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class PeerOrgReferral extends OrgReferral {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster = Debug.getInstance(PolicyManager.POLICY_DEBUG_NAME);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private final static String PEER_ORG_REFERRAL = "PeerOrgReferral";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /** No argument constructor */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**Gets the name of the ReferralType
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return name of the ReferralType representing this referral
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets the valid values for this referral
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param token SSOToken
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return <code>ValidValues</code> object
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @exception SSOException if <code>SSOToken></code> is not valid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @exception PolicyException if unable to get the list of valid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public ValidValues getValidValues(SSOToken token)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**Gets the valid values for this referral
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * matching a pattern
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param token SSOToken
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param pattern a pattern to match against the value
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return <code>ValidValues</code> object
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @exception SSOException if <code>SSOToken></code> is not valid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @exception PolicyException if unable to get the list of valid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public ValidValues getValidValues(SSOToken token, String pattern)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("PeerOrgReferral.getValidValues():entering");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ( (orgSet == null) || (orgSet.isEmpty()) ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.error("PeerOrgReferral.getValidValues(): "
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster + " Organization name not set");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw new PolicyException(ResBundleUtils.rbName,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster = new OrganizationConfigManager(token, orgName);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String fullOrgName = orgConfigManager.getOrganizationName();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("PeerOrgReferral.getValidValues():fullOrgName="
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster = orgConfigManager.getParentOrgConfigManager();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String fullParentOrgName = parentOrgConfig.getOrganizationName();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Set subOrgNames = parentOrgConfig.getSubOrganizationNames(pattern,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster false); //get only first level children
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster && (subOrgNames != null) && !subOrgNames.isEmpty()) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String subOrgName = (String)subOrgsIter.next();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster parentOrgConfig.getSubOrgConfigManager(subOrgName);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("PeerOrgReferral.getValidValues():returning="
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.error("Can not get valid values for referral "
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw new PolicyException(ResBundleUtils.rbName,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "can_not_get_values_for_referral", objs, smse);