head	1.5;
access;
symbols
	TIGRIS_0_8_4:1.2.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.5
date	2000.12.14.00.31.49;	author dlr;	state dead;
branches;
next	1.4;

1.4
date	2000.12.13.22.33.27;	author dlr;	state Exp;
branches;
next	1.3;

1.3
date	2000.12.05.23.53.30;	author leonardr;	state Exp;
branches;
next	1.2;

1.2
date	2000.11.30.23.56.41;	author leonardr;	state Exp;
branches;
next	1.1;

1.1
date	2000.11.12.21.15.51;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.15.51;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.5
log
@No longer used.
@
text
@/* ================================================================
 * Copyright (c) 2000 CollabNet.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by CollabNet (http://www.Collab.Net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */

package org.tigris.helm.project;

import java.sql.*;

import org.webmacro.util.*;

import com.workingdogs.village.*;

import org.joist.util.*;
import org.joist.database.TableManager;
import org.joist.database.DataManager;
import org.joist.database.JoistDatabaseException;

import org.tigris.helm.DoesNotExist;
import org.tigris.helm.tool.TigrisUpdate;
import org.tigris.helm.tool.UpdateException;
import org.tigris.helm.database.ProjectManager;
import org.tigris.helm.database.DomainManager;
import org.tigris.helm.database.ModuleManager;
import org.tigris.helm.domain.BusinessObject;


/**
 * A simple descriptor of a Module.
 *
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: Module.java,v 1.4 2000/12/13 22:33:27 dlr Exp $
 */
public class Module extends BusinessObject
{
    private ProjectManager projectMgr;

    private DomainManager domMgr;

    private ModuleManager moduleMgr;


    ////////////////////////////////////////////////////////////////////
    // Constructors
    ////////////////////////////////////////////////////////////////////

    public Module(Connection conn, DataManager dMgr,
                  String projectID, String moduleName, 
                  String description, boolean isWeb)
        throws SQLException, DataSetException, JoistDatabaseException,
               UpdateException, DoesNotExist
    {
        super(conn, dMgr);

        Integer moduleID = null;
        Record proj = projectMgr.getProjectForID(conn, projectID);
        String domainName = domMgr.getDomainName
            (proj.getValue(ProjectManager.PROJECT_DOMAIN_ID).asString());
        String projectName = 
            proj.getValue(ProjectManager.PROJECT_NAME).asString();

        // Add the module to the database.
        setRecord(moduleMgr.updateModule(conn, null, projectID, 
                                         moduleName, description, isWeb));
        Project p = new Project(conn, dMgr, projectID);
        TigrisUpdate.addModule(conn, dMgr, null, p, moduleName, description, 
                               (isWeb ? "1" : "0"));
    }

    protected void createManagers ()
    {
        projectMgr = (ProjectManager)
            dMgr.getManager("org.tigris.helm.database.ProjectManager");
	domMgr = (DomainManager)
	    dMgr.getManager("org.tigris.helm.database.DomainManager");
        moduleMgr = (ModuleManager)
	    dMgr.getManager("org.tigris.helm.database.ModuleManager");
    }

    ////////////////////////////////////////////////////////////////////
    // Read-only methods.
    ////////////////////////////////////////////////////////////////////

    protected final String getTableName() { return ModuleManager.TABLE_NAME; }

    public String getID() throws DataSetException
    {
        return rec.getValue (ModuleManager.MODULE_ID).toString ();
    }

    public String getProjectID()  throws DataSetException
    {
        return rec.getValue (ModuleManager.PROJECT_ID).toString ();
    }

    public String getName() throws DataSetException
    {
        return rec.getValue(ModuleManager.MODULE_NAME).toString ();
    }

    public String getDescription() throws DataSetException
    {
        return rec.getValue(ModuleManager.MODULE_DESCRIPTION).toString ();
    }

    public Boolean isWeb() throws DataSetException
    {
        return getBooleanValue(rec.getValue(ModuleManager.MODULE_IS_WEB)
                               .toString());
    }
}
@


1.4
log
@minor cleanup
@
text
@d73 1
a73 1
 * @@version $Id: Module.java,v 1.3 2000/12/05 23:53:30 leonardr Exp $
@


1.3
log
@Enabled security check of records passed into business objects.
@
text
@d69 1
a69 1
/*
d71 1
d73 1
a73 1
 * @@version $Id: Module.java,v 1.2 2000/11/30 23:56:41 leonardr Exp $
a74 1

a76 2
    protected final String getTableName() { return ModuleManager.TABLE_NAME; }

d125 2
d139 1
a139 1
        return rec.getValue (ModuleManager.MODULE_NAME).toString ();
d144 1
a144 1
        return rec.getValue (ModuleManager.MODULE_DESCRIPTION).toString ();
d147 4
a150 4
    public boolean isWeb() throws DataSetException
    { 
        String isWeb = rec.getValue(ModuleManager.MODULE_IS_WEB).toString();
        return isWeb.equals("1");
a151 1

@


1.2
log
@Mega patch which makes script data persistent and which provides a general framework for tasks to be run (which will be used by anzu eventually)
@
text
@d72 1
a72 1
 * @@version $Id: Module.java,v 1.1.1.1 2000/11/12 21:15:51 dlr Exp $
d77 2
@


1.1
log
@Initial revision
@
text
@d72 1
a72 1
 * @@version $Id: Module.java,v 1.5 2000/11/10 01:50:37 dlr Exp $
d106 2
a107 2
        
        TigrisUpdate.addModule(dMgr, conn, projectID, moduleName, description, 
@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@@
