Package com.javaeye.jert.action.admin.database

Source Code of com.javaeye.jert.action.admin.database.BaseDatabaseAction

package com.javaeye.jert.action.admin.database;

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

import com.javaeye.jert.action.admin.BaseAdminAction;
import com.javaeye.jert.domain.Database;
import com.javaeye.jert.service.DatabaseService;

/**
* @author Quake Wang
* @since 2004-12-19
* @version $Revision: 1.4 $
*/
public class BaseDatabaseAction extends BaseAdminAction {
    private Long databaseId;
    private List databaseSamples;

    protected DatabaseService databaseService;
    protected Database database;

    public void setDatabaseId(Long databaseId) {
        this.databaseId = databaseId;
        this.database = databaseService.getDatabase(databaseId);
    }

    public Long getDatabaseId() {
        return databaseId;
    }

    public DatabaseService getDatabaseService() {
        return databaseService;
    }

    public void setDatabaseService(DatabaseService databaseService) {
        this.databaseService = databaseService;
    }

    public Database getDatabase() {
        return database;
    }

    public void setDatabase(Database database) {
        this.database = database;
    }

    public List getDatabaseSamples() {
        loadSamples();
        return databaseSamples;
    }

    private void loadSamples() {
        if (databaseSamples != null) return;
        int count = Integer.parseInt(getText("databaseSamplesCount"));
        databaseSamples = new ArrayList(count);
        for (int i = 0; i < count; i++) {
            Database db = new Database();
            db.setName(getText("databaseSample." + i + ".name"));
            db.setDriver(getText("databaseSample." + i + ".driver"));
            db.setUrl(getText("databaseSample." + i + ".url"));
            databaseSamples.add(db);
        }
    }

    public void setDatabaseSamples(List databaseSamples) {
        this.databaseSamples = databaseSamples;
    }
}
TOP

Related Classes of com.javaeye.jert.action.admin.database.BaseDatabaseAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.