⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profiledetailsform.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
/*
 *  SSL-Explorer
 *
 *  Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2 of
 *  the License, or (at your option) any later version.
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
			
package com.sslexplorer.properties.wizards.forms;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sslexplorer.core.CoreServlet;
import com.sslexplorer.core.forms.AbstractResourceDetailsWizardForm;
import com.sslexplorer.policyframework.PolicyConstants;
import com.sslexplorer.policyframework.Resource;
import com.sslexplorer.policyframework.ResourceUtil;
import com.sslexplorer.properties.wizards.actions.ProfileDetailsAction;
import com.sslexplorer.security.Constants;
import com.sslexplorer.security.User;
import com.sslexplorer.wizard.AbstractWizardSequence;

public class ProfileDetailsForm extends AbstractResourceDetailsWizardForm {
    private List availableProfiles;
    private int baseOn;

    final static Log log = LogFactory.getLog(ProfileDetailsForm.class);

    // Statics for sequence attributes
    public final static String ATTR_BASE_ON = "baseOn";

    public ProfileDetailsForm() {
        super(true, false, "/WEB-INF/jsp/content/properties/profileWizard/profileDetails.jspf", "resourceName", true, false,
            "profileDetails", "properties", "profileWizard.profileDetails", 1,
            PolicyConstants.PROFILE_RESOURCE_TYPE);
        availableProfiles = new ArrayList();
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.wizard.forms.DefaultWizardForm#init(com.sslexplorer.wizard.AbstractWizardSequence)
     */
    public void init(AbstractWizardSequence sequence, HttpServletRequest request) throws Exception {
        super.init(sequence, request);
        baseOn = ((Integer) sequence.getAttribute(ATTR_BASE_ON, new Integer(0))).intValue();
        availableProfiles.clear();
        try {
            String scope = (String) sequence.getAttribute(ProfileDetailsAction.ATTR_PROFILE_SCOPE, null);
            User user = CoreServlet.getServlet().getLogonController().getUser(request);
            availableProfiles = ResourceUtil.filterResources(user, CoreServlet.getServlet().getPropertyDatabase().getPropertyProfiles(
                Constants.SCOPE_PERSONAL.equals(scope) ? user.getPrincipalName() : "", true
                                ), Constants.SCOPE_PERSONAL.equals(scope) ? false : true);
        } catch (Exception e) {
            log.error("Could not get available profiles.", e);
        }
    }

    /**
     * @return Returns the baseOn.
     */
    public int getBaseOn() {
        return baseOn;
    }

    /**
     * @param baseOn The baseOn to set.
     */
    public void setBaseOn(int baseOn) {
        this.baseOn = baseOn;
    }

    /**
     * @return Returns the availableProfiles.
     */
    public List getAvailableProfiles() {
        return availableProfiles;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.core.forms.AbstractResourceWizardForm#apply(com.sslexplorer.wizard.AbstractWizardSequence)
     */
    public void apply(AbstractWizardSequence sequence) throws Exception {
        super.apply(sequence);
        sequence.putAttribute(ATTR_BASE_ON, new Integer(baseOn));
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.sslexplorer.core.forms.AbstractResourceDetailsWizardForm#getResourceByName(java.lang.String)
     */
    public Resource getResourceByName(String name) throws Exception {
        String scope = (String) getWizardSequence().getAttribute(ProfileDetailsAction.ATTR_PROFILE_SCOPE, null);
        return CoreServlet.getServlet().getPropertyDatabase().getPropertyProfile(
            Constants.SCOPE_GLOBAL.equals(scope) ? null : getWizardSequence().getSession().getUser().getPrincipalName(), name);
    }

    public void parentResourcePermissionChanged(AbstractWizardSequence sequence) {        
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -