LDAPStoreWizardPage.java revision e7a19bb22c6d6d6a8731cfde7e4b96124e1d4e3b
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/**
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk *
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk *
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The contents of this file are subject to the terms
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * of the Common Development and Distribution License
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * (the License). You may not use this file except in
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * compliance with the License.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk *
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * You can obtain a copy of the License at
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * https://opensso.dev.java.net/public/CDDLv1.0.html or
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * opensso/legal/CDDLv1.0.txt
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * See the License for the specific language governing
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * permission and limitations under the License.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk *
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * When distributing Covered Code, include this CDDL
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Header Notice in each file and include the License file
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * at opensso/legal/CDDLv1.0.txt.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * If applicable, add the following below the CDDL Header,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * with the fields enclosed by brackets [] replaced by
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * your own identifying information:
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * "Portions Copyrighted [year] [name of copyright owner]"
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk *
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * $Id: LDAPStoreWizardPage.java,v 1.7 2008/06/25 05:42:42 qcheng Exp $
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk *
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Portions Copyrighted 2011-2014 ForgeRock AS.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkpackage com.sun.identity.config.wizard;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport com.sun.identity.config.pojos.LDAPStore;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport com.sun.identity.config.util.ProtectedPage;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.apache.click.control.ActionLink;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/*
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * LDAPStoreWizardPage is the base for Step 3.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkpublic class LDAPStoreWizardPage extends ProtectedPage {
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public LDAPStore store = null;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public ActionLink clearLink =
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk new ActionLink("clearStore", this, "clearStore");
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk private String type = "config";
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk private String typeTitle = "Configuration";
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk private String storeSessionName = "customConfigStore";
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk private int pageNum = 3;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public LDAPStoreWizardPage() {
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk }
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public String getType() {
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk return type;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk }
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public void setType( String type ) {
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk this.type = type;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk }
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public String getTypeTitle() {
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk return typeTitle;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk }
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public void setTypeTitle( String typeTitle ) {
this.typeTitle = typeTitle;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum( int pageNum ) {
this.pageNum = pageNum;
}
public String getStoreSessionName() {
return storeSessionName;
}
public void setStoreSessionName( String storeSessionName ) {
this.storeSessionName = storeSessionName;
}
public void onInit() {
addModel("type", getType());
addModel("typeTitle", getTypeTitle());
addModel("pageNum", Integer.valueOf( getPageNum()));
store = getConfig();
addModel("usingCustomStore", Boolean.valueOf( store != null));
store = ensureConfig();
addModel("store", store);
super.onInit();
}
public boolean clearStore() {
getContext().removeSessionAttribute( getStoreSessionName());
setPath(null);
return false;
}
protected LDAPStore getConfig() {
return (LDAPStore)getContext().getSessionAttribute(getStoreSessionName());
}
protected LDAPStore ensureConfig() {
LDAPStore store = getConfig();
if ( store == null ) {
store = new LDAPStore();
}
return store;
}
protected void save(LDAPStore config) {
getContext().setSessionAttribute(getStoreSessionName(), config);
}
}