8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2009 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: BackwardCompSupport.java,v 1.1 2009/09/05 01:30:45 veiming Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Portions Copyrighted [2011] [ForgeRock AS]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.common.admin.AdminInterfaceUtils;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static final String DEBUG_NAME = "common";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private Map mapIdTypeToServiceName = new HashMap();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private Map mapIdTypeToSchemaType = new HashMap();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private Map mapIdTypeToSubSchemaName = new HashMap();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToServiceName.put(IdType.USER.getName(),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "iPlanetAMUserService");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToSchemaType.put(IdType.USER.getName(), "user");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToServiceName.put(IdType.AGENT.getName(),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "iPlanetAMAgentService");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToSchemaType.put(IdType.AGENT.getName(), "user");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToServiceName.put(IdType.GROUP.getName(),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "iPlanetAMEntrySpecificService");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToSubSchemaName.put(IdType.GROUP.getName(), "Group");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToServiceName.put(IdType.ROLE.getName(),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "iPlanetAMEntrySpecificService");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToSubSchemaName.put(IdType.ROLE.getName(), "Role");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToServiceName.put(IdType.FILTEREDROLE.getName(),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "iPlanetAMEntrySpecificService");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster mapIdTypeToSubSchemaName.put(IdType.FILTEREDROLE.getName(),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "FilteredRole");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster namingAttribute = AdminInterfaceUtils.getNamingAttribute(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Since naming attribute cannot be obtained for IdRepo
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // hardcode to "uid"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public static BackwardCompSupport getInstance() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (String)mapIdTypeToServiceName.get(idType);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (String)mapIdTypeToSchemaType.get(idType);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public String getSubSchemaName(String idType) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (String)mapIdTypeToSubSchemaName.get(idType);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void beforeDisplay(String idType, Set attributeSchemas) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (idType.equalsIgnoreCase(IdType.USER.getName())) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private void beforeDisplayUser(Set attributeSchemas) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (Iterator iter = attributeSchemas.iterator(); iter.hasNext(); ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster AttributeSchema as = (AttributeSchema)iter.next();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (name.equals(namingAttribute) || name.equals("ChangePassword")) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (idType.equalsIgnoreCase(IdType.USER.getName())) {