head	1.26;
access;
symbols
	TIGRIS_0_9_2_4:1.21
	TIGRIS_0_9_2_3:1.21
	HELM_PEER_PORT_BRANCH:1.25.0.2
	TURBINE_PEER:1.25
	TIGRIS_0_9_2_1:1.25
	TIGRIS_0_9_2:1.21.0.2
	TIGRIS_0_9_0:1.12.0.2
	TIGRIS_0_8_4:1.8.0.2;
locks; strict;
comment	@# @;


1.26
date	2001.02.21.02.19.01;	author dlr;	state dead;
branches;
next	1.25;

1.25
date	2001.01.26.18.29.02;	author edk;	state Exp;
branches
	1.25.2.1;
next	1.24;

1.24
date	2001.01.26.05.24.05;	author edk;	state dead;
branches;
next	1.23;

1.23
date	2001.01.24.23.50.08;	author leonardr;	state Exp;
branches;
next	1.22;

1.22
date	2001.01.24.20.42.48;	author dlr;	state Exp;
branches;
next	1.21;

1.21
date	2001.01.09.19.03.59;	author leonardr;	state Exp;
branches;
next	1.20;

1.20
date	2001.01.05.23.16.47;	author leonardr;	state Exp;
branches;
next	1.19;

1.19
date	2001.01.05.21.42.38;	author leonardr;	state Exp;
branches;
next	1.18;

1.18
date	2001.01.05.00.13.13;	author kmaples;	state Exp;
branches;
next	1.17;

1.17
date	2001.01.03.22.09.21;	author leonardr;	state Exp;
branches;
next	1.16;

1.16
date	2000.12.30.01.03.32;	author leonardr;	state Exp;
branches;
next	1.15;

1.15
date	2000.12.29.02.37.46;	author dlr;	state Exp;
branches;
next	1.14;

1.14
date	2000.12.23.00.48.18;	author dlr;	state Exp;
branches;
next	1.13;

1.13
date	2000.12.22.03.02.59;	author dlr;	state Exp;
branches;
next	1.12;

1.12
date	2000.12.18.19.15.54;	author leonardr;	state Exp;
branches;
next	1.11;

1.11
date	2000.12.05.23.28.58;	author leonardr;	state Exp;
branches;
next	1.10;

1.10
date	2000.12.04.20.01.42;	author leonardr;	state Exp;
branches;
next	1.9;

1.9
date	2000.12.04.17.53.52;	author leonardr;	state Exp;
branches;
next	1.8;

1.8
date	2000.12.02.01.45.41;	author leonardr;	state Exp;
branches
	1.8.2.1;
next	1.7;

1.7
date	2000.11.30.23.56.41;	author leonardr;	state Exp;
branches;
next	1.6;

1.6
date	2000.11.29.23.57.50;	author leonardr;	state Exp;
branches;
next	1.5;

1.5
date	2000.11.29.21.05.00;	author leonardr;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.29.20.58.59;	author leonardr;	state Exp;
branches;
next	1.3;

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

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

1.1
date	2000.11.20.20.07.32;	author leonardr;	state Exp;
branches;
next	;

1.8.2.1
date	2000.12.05.06.34.17;	author jrobbins;	state Exp;
branches;
next	;

1.25.2.1
date	2001.01.28.01.02.17;	author dlr;	state dead;
branches;
next	;


desc
@@


1.26
log
@Moved to om package by Peer port.
@
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 COLLABNET 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.domain;

import java.util.*;
import java.sql.*;

import org.webmacro.util.*;

import com.workingdogs.village.*;

import org.joist.database.JoistDatabaseException;
import org.joist.database.DataManager;

import org.tigris.helm.DoesNotExist;
import org.tigris.helm.AlreadyExists;
import org.tigris.helm.security.AccessControlList;
import org.tigris.helm.security.ACLException;
import org.tigris.helm.database.*;
import org.tigris.helm.project.*;
import org.tigris.helm.tool.*;

public class ProjectGroup extends Project
{
    private static Log log = new Log("prjGrp", "ProjectGroup");

    ////////////////////////////////////////////////////////////////////
    // Constructors.
    ////////////////////////////////////////////////////////////////////

    public ProjectGroup(Connection c, DataManager dMgr, Record r)
        throws DoesNotExist, DataSetException
    {
        super(c, dMgr, r);
    }
    
    public ProjectGroup(Connection c, DataManager dMgr, String pID)
        throws DataSetException, SQLException, DoesNotExist
    {
        super(c, dMgr, pID);
    }

    public ProjectGroup(Connection c, DataManager dMgr, 
                        AccessControlList acl, String domainID,
                        boolean category, String name, 
                        String shortDescription, String longDescription)
        throws DataSetException, SQLException, JoistDatabaseException,
               DoesNotExist, AlreadyExists, ACLException
    {
        this(c, dMgr, acl, domainID, category, name, shortDescription, 
             longDescription, null);
    }

    public ProjectGroup(Connection c, DataManager dMgr, 
                        AccessControlList acl, String domainID,
                        boolean category, String name, 
                        String shortDescription, String longDescription, 
                        ArrayList initialMembers)
        throws DataSetException, SQLException, JoistDatabaseException,
               DoesNotExist, AlreadyExists, ACLException
    {
        super(c, dMgr);
        acl.assertPermissionForDomain("ProjectGroup - Add", domainID);
        //Get profile and license. (?)        
        ProjectProfile profile = null;
        if (category)
        {
            profile = new CategoryProfile(); 
        } else {
            profile = new GroupProfile(); 
        }
        String license = null;
        this.rec = pMgr.addProject(conn, profile, domainID, name, license, 
                                   shortDescription, longDescription, null, 
                                   "", null, acl.getUserID(), acl.getUserID());

        //Add the group to external applications.
        TigrisUpdate.addProject(conn, dMgr, acl.getUserID(), this);

        //Add the project to the appropriate groups.
        ProjectGroup.addToHostGroup(conn, dMgr, this);
        ProjectGroup.addToDomainGroup(conn, dMgr, this, getDomainID());

        //Add the initial members.
        if (initialMembers != null)
        {
            for (Iterator i = initialMembers.iterator(); i.hasNext();)
            {
                Project p= (Project)i.next();
                addProject(acl, p);
            }        
        }
    }


    ////////////////////////////////////////////////////////////////////
    // Static methods for obtaining special groups.
    ////////////////////////////////////////////////////////////////////
    
    public static ProjectGroup getHostProjectGroup(Connection connection,
                                                   DataManager dMgr)
        throws SQLException, DataSetException, DoesNotExist
    {
        ProjectManager pMgr = (ProjectManager) dMgr.getManager
            ("org.tigris.helm.database.ProjectManager");
        return new ProjectGroup(connection, dMgr, 
                                pMgr.getHostProjectID());
    }

    public static ProjectGroup getDomainProjectGroup(Connection connection,
                                                     DataManager dMgr,
                                                     String domainID)
        throws SQLException, DataSetException, DoesNotExist
    {
        ProjectManager pMgr = (ProjectManager) dMgr.getManager
            ("org.tigris.helm.database.ProjectManager");
        return new ProjectGroup(connection, dMgr, 
                                pMgr.getDomainProjectID(domainID));
    }

    public static ProjectGroup getPublicDomainProjectGroup
        (Connection connection, DataManager dMgr, String domainID)
        throws SQLException, DataSetException, DoesNotExist
    {
        ProjectManager pMgr = (ProjectManager) dMgr.getManager
            ("org.tigris.helm.database.ProjectManager");
        return new ProjectGroup(connection, dMgr, 
                                pMgr.getPublicDomainProjectID(domainID));
    }

    public static void addToHostGroup
        (Connection connection, DataManager dMgr, Project toAdd)
        throws SQLException, DataSetException, DoesNotExist,
               JoistDatabaseException
    {
        getHostProjectGroup(connection, dMgr)
            .addProjectNoPerms(toAdd);
    }

    public static void addToDomainGroup
        (Connection connection, DataManager dMgr, Project toAdd,
         String domainID)
        throws SQLException, DataSetException, DoesNotExist,
               JoistDatabaseException
    {
        getDomainProjectGroup(connection, dMgr, domainID)
            .addProjectNoPerms(toAdd);
    }

    public static void addToPublicGroup
        (Connection connection, DataManager dMgr, Project toAdd,
         String domainID)
        throws SQLException, DataSetException, DoesNotExist,
               JoistDatabaseException
    {
        getPublicDomainProjectGroup(connection, dMgr, domainID)
            .addProjectNoPerms(toAdd);
    }
    
    public static void removeFromPublicGroup
        (Connection connection, DataManager dMgr, Project toRemove,
         String domainID)
        throws SQLException, DataSetException, DoesNotExist,
               JoistDatabaseException
    {
        getPublicDomainProjectGroup(connection, dMgr, domainID)
            .removeProjectNoPerms(toRemove);
    }

    ////////////////////////////////////////////////////////////////////
    // Read-write methods.
    ////////////////////////////////////////////////////////////////////

    public void addProject(AccessControlList acl, Project project)
        throws SQLException, DataSetException, JoistDatabaseException,
               ACLException, DoesNotExist
    {
        acl.assertPermissionForProject("ProjectGroup Member - Add", getID());
        addProjectNoPerms(project);
    }

    public void removeProject(AccessControlList acl, Project project)
        throws SQLException, DataSetException, JoistDatabaseException,
               ACLException, DoesNotExist
    {
        acl.assertPermissionForProject("ProjectGroup Member - Delete", 
                                       getID());
        removeProjectNoPerms(project);
    }            

    protected void addProjectNoPerms(Project project)
        throws SQLException, DataSetException, JoistDatabaseException,
               DoesNotExist
    {
        IssueTrackingAccountDescriptor before = 
            new IssueTrackingAccountDescriptor(project);
        prjGrpMgr.addProjectToGroup(conn, project.getID(), getID());
        AccessControlList.buildProjectGroups(conn, dMgr);
        IssueTrackingAccountDescriptor after = 
            new IssueTrackingAccountDescriptor(project);
        before.syncTo(conn, dMgr, after);
    }

    //FIXME: Argh! This should be protected, but Project needs it and
    //is in a different package.
    public void removeProjectNoPerms(Project project)
        throws SQLException, DataSetException, JoistDatabaseException,
               DoesNotExist
    {
        log.info("Removing project " + project.getName() + " from group " + getName());
        IssueTrackingAccountDescriptor before = new IssueTrackingAccountDescriptor(project);
        prjGrpMgr.removeProjectFromGroup(conn, project.getID(), getID());
        AccessControlList.buildProjectGroups(conn, dMgr);
        IssueTrackingAccountDescriptor after = new IssueTrackingAccountDescriptor(project);
        before.syncTo(conn, dMgr, after);
    }

    public void delete(AccessControlList acl)
        throws SQLException, DataSetException, JoistDatabaseException,
               DoesNotExist, ACLException               
    {
        acl.assertPermissionForDomain("ProjectGroup - Delete", getDomainID());
        //Remove all members of the group.
        DataSet projectSet = prjGrpMgr.getProjectsForGroup(conn, getID());
        for (int i=0; i < projectSet.size(); i++)
        {
            String projectID = projectSet.getRecord(i)
                .getValue(ProjectProjectGroupManager.PROJECT_ID).asString();
            Project remove = new Project(conn, dMgr, projectID);
            removeProjectNoPerms(remove);
        }
        //Delete the project like any other project.
        super.delete(acl);
    }

    public void updateInfo(AccessControlList acl, String shortDescription,
                           String longDescription)
        throws ACLException, DataSetException, SQLException,
               JoistDatabaseException
    {
        acl.assertPermissionForDomain("ProjectGroup - Edit", getDomainID());
        try 
        {
            pMgr.updateProjectInfo
                (conn, getID(), null, shortDescription, longDescription, null,
                 null, null);
            setRecord(pMgr.getProjectForID(conn, getID()));
        } catch (DoesNotExist ignore) {} //Can't happen--we just used it.    
    }

    ////////////////////////////////////////////////////////////////////
    // Read-only methods.
    ////////////////////////////////////////////////////////////////////
    
    public List getProjects(AccessControlList acl)
        throws DataSetException, SQLException, JoistDatabaseException,
               DoesNotExist
    {
        List projects = expand();

        return AccessControlledDatabaseFilter.getViewableProjects
            (acl, projects);
    }
    
    public List expand()
	throws DataSetException, SQLException
    {
        List projects = new ArrayList();        
        DataSet projectSet = prjGrpMgr.getProjectsForGroup(conn, getID());
        for (int i = 0; i < projectSet.size(); i++)
        {
            Record r = projectSet.getRecord(i);
	    String id = r.getValue(ProjectProjectGroupManager.PROJECT_ID)
                .asString();
	    try {
                Project p = new Project(conn, dMgr, id);
                if (!p.isHost() && !p.isDomain())
                {
                    projects.add(p);
                }
	    } catch (DoesNotExist ignore) {}
        }
	return projects;
    }

    public int getNumberOfProjects(AccessControlList acl)
        throws DataSetException, SQLException, JoistDatabaseException,
               DoesNotExist
    {
        return getProjects(acl).size();
    }
}

@


1.25
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@@


1.25.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@@


1.24
log
@revert this stuff to its state as of 2001/01/24 12:42:00 GMT -- with
the following exceptions, which have some different modifications so
they'll work with changes which have happened in joist:

ProjectNewsEdit.java
SkinManager.java
SkinStyleElementValueManager.java
StyleElementManager.java
StyleManager.java

it compiles.  i dunno if it works, though.
@
text
@d75 2
a76 2
    public ProjectGroup(DataManager dMgr, Record r)
        throws DoesNotExist, DBException
d78 1
a78 1
        super(dMgr, r);
d81 2
a82 2
    public ProjectGroup(DataManager dMgr, String pID)
        throws DoesNotExist, DBException
d84 1
a84 1
        super(dMgr, pID);
d87 3
a89 2
    public ProjectGroup(DataManager dMgr, AccessControlList acl,
                        String domainID, boolean category, String name, 
d91 2
a92 1
        throws ACLException, AlreadyExists, DoesNotExist, DBException
d94 1
a94 1
        this(dMgr, acl, domainID, category, name, shortDescription, 
d98 3
a100 2
    public ProjectGroup(DataManager dMgr, AccessControlList acl,
                        String domainID, boolean category, String name, 
d103 2
a104 1
        throws ACLException, AlreadyExists, DoesNotExist, DBException
d106 1
a106 1
        super(dMgr);
d117 1
a117 1
        this.rec = pMgr.addProject(profile, domainID, name, license, 
d122 1
a122 1
        TigrisUpdate.addProject(dMgr, acl.getUserID(), this);
d125 2
a126 2
        ProjectGroup.addToHostGroup(dMgr, this);
        ProjectGroup.addToDomainGroup(dMgr, this, getDomainID());
d144 3
a146 2
    public static ProjectGroup getHostProjectGroup(DataManager dMgr)
        throws DoesNotExist, DBException
d150 2
a151 1
        return new ProjectGroup(dMgr, pMgr.getHostProjectID());
d154 2
a155 1
    public static ProjectGroup getDomainProjectGroup(DataManager dMgr,
d157 1
a157 1
        throws DoesNotExist, DBException
d161 2
a162 1
        return new ProjectGroup(dMgr, pMgr.getDomainProjectID(domainID));
d165 3
a167 3
    public static ProjectGroup getPublicDomainProjectGroup(DataManager dMgr,
                                                           String domainID)
        throws DoesNotExist, DBException
d171 2
a172 1
        return new ProjectGroup(dMgr, pMgr.getPublicDomainProjectID(domainID));
d175 4
a178 2
    public static void addToHostGroup(DataManager dMgr, Project toAdd)
        throws DoesNotExist, DBException
d180 2
a181 1
        getHostProjectGroup(dMgr).addProjectNoPerms(toAdd);
d184 5
a188 3
    public static void addToDomainGroup(DataManager dMgr, Project toAdd,
                                        String domainID)
        throws DoesNotExist, DBException
d190 2
a191 1
        getDomainProjectGroup(dMgr, domainID).addProjectNoPerms(toAdd);
d194 5
a198 3
    public static void addToPublicGroup(DataManager dMgr, Project toAdd,
                                        String domainID)
        throws DoesNotExist, DBException
d200 2
a201 1
        getPublicDomainProjectGroup(dMgr, domainID).addProjectNoPerms(toAdd);
d204 5
a208 3
    public static void removeFromPublicGroup(DataManager dMgr,
                                             Project toRemove, String domainID)
        throws DoesNotExist, DBException
d210 1
a210 1
        getPublicDomainProjectGroup(dMgr, domainID)
d219 2
a220 1
        throws ACLException, DoesNotExist, DBException
d227 2
a228 1
        throws ACLException, DoesNotExist, DBException
d236 2
a237 1
        throws DoesNotExist, DBException
d241 2
a242 2
        prjGrpMgr.addProjectToGroup(project.getID(), getID());
        AccessControlList.buildProjectGroups(dMgr);
d245 1
a245 1
        before.syncTo(dMgr, after);
d251 2
a252 1
        throws DoesNotExist, DBException
d254 6
a259 9
        log.info("Removing project " + project.getName() + " from group " +
                 getName());
        IssueTrackingAccountDescriptor before =
            new IssueTrackingAccountDescriptor(project);
        prjGrpMgr.removeProjectFromGroup(project.getID(), getID());
        AccessControlList.buildProjectGroups(dMgr);
        IssueTrackingAccountDescriptor after =
            new IssueTrackingAccountDescriptor(project);
        before.syncTo(dMgr, after);
d263 2
a264 1
        throws ACLException, DoesNotExist, DBException               
d268 1
a268 1
        DataSet projectSet = prjGrpMgr.getProjectsForGroup(getID());
d273 1
a273 1
            Project remove = new Project(dMgr, projectID);
d282 2
a283 1
        throws ACLException, DBException
d288 4
a291 3
            pMgr.updateProjectInfo(getID(), null, shortDescription,
                                   longDescription, null, null, null);
            setRecord(pMgr.getProjectForID(getID()));
d300 2
a301 1
        throws DoesNotExist, DBException
d310 1
a310 1
	throws DBException
d313 1
a313 1
        DataSet projectSet = prjGrpMgr.getProjectsForGroup(getID());
d320 1
a320 1
                Project p = new Project(dMgr, id);
d331 2
a332 1
        throws DoesNotExist, DBException
d337 1
@


1.23
log
@* Removed all references to JDBC connections.  Connections are now pulled
  directly from the connection pool.
* Made use of DBException.
- dlr@@collab.net
@
text
@@


1.22
log
@Making use of DBException.
@
text
@d75 1
a75 1
    public ProjectGroup(Connection c, DataManager dMgr, Record r)
d78 1
a78 1
        super(c, dMgr, r);
d81 1
a81 1
    public ProjectGroup(Connection c, DataManager dMgr, String pID)
d84 1
a84 1
        super(c, dMgr, pID);
d87 2
a88 3
    public ProjectGroup(Connection c, DataManager dMgr, 
                        AccessControlList acl, String domainID,
                        boolean category, String name, 
d92 1
a92 1
        this(c, dMgr, acl, domainID, category, name, shortDescription, 
d96 2
a97 3
    public ProjectGroup(Connection c, DataManager dMgr, 
                        AccessControlList acl, String domainID,
                        boolean category, String name, 
d102 1
a102 1
        super(c, dMgr);
d113 1
a113 1
        this.rec = pMgr.addProject(conn, profile, domainID, name, license, 
d118 1
a118 1
        TigrisUpdate.addProject(conn, dMgr, acl.getUserID(), this);
d121 2
a122 2
        ProjectGroup.addToHostGroup(conn, dMgr, this);
        ProjectGroup.addToDomainGroup(conn, dMgr, this, getDomainID());
d140 1
a140 2
    public static ProjectGroup getHostProjectGroup(Connection connection,
                                                   DataManager dMgr)
d145 1
a145 2
        return new ProjectGroup(connection, dMgr, 
                                pMgr.getHostProjectID());
d148 1
a148 2
    public static ProjectGroup getDomainProjectGroup(Connection connection,
                                                     DataManager dMgr,
d154 1
a154 2
        return new ProjectGroup(connection, dMgr, 
                                pMgr.getDomainProjectID(domainID));
d157 2
a158 2
    public static ProjectGroup getPublicDomainProjectGroup
        (Connection connection, DataManager dMgr, String domainID)
d163 1
a163 2
        return new ProjectGroup(connection, dMgr, 
                                pMgr.getPublicDomainProjectID(domainID));
d166 1
a166 2
    public static void addToHostGroup
        (Connection connection, DataManager dMgr, Project toAdd)
d169 1
a169 2
        getHostProjectGroup(connection, dMgr)
            .addProjectNoPerms(toAdd);
d172 2
a173 3
    public static void addToDomainGroup
        (Connection connection, DataManager dMgr, Project toAdd,
         String domainID)
d176 1
a176 2
        getDomainProjectGroup(connection, dMgr, domainID)
            .addProjectNoPerms(toAdd);
d179 2
a180 3
    public static void addToPublicGroup
        (Connection connection, DataManager dMgr, Project toAdd,
         String domainID)
d183 1
a183 2
        getPublicDomainProjectGroup(connection, dMgr, domainID)
            .addProjectNoPerms(toAdd);
d186 2
a187 3
    public static void removeFromPublicGroup
        (Connection connection, DataManager dMgr, Project toRemove,
         String domainID)
d190 1
a190 1
        getPublicDomainProjectGroup(connection, dMgr, domainID)
d218 2
a219 2
        prjGrpMgr.addProjectToGroup(conn, project.getID(), getID());
        AccessControlList.buildProjectGroups(conn, dMgr);
d222 1
a222 1
        before.syncTo(conn, dMgr, after);
d234 5
a238 4
        prjGrpMgr.removeProjectFromGroup(conn, project.getID(), getID());
        AccessControlList.buildProjectGroups(conn, dMgr);
        IssueTrackingAccountDescriptor after = new IssueTrackingAccountDescriptor(project);
        before.syncTo(conn, dMgr, after);
d246 1
a246 1
        DataSet projectSet = prjGrpMgr.getProjectsForGroup(conn, getID());
d251 1
a251 1
            Project remove = new Project(conn, dMgr, projectID);
d265 3
a267 4
            pMgr.updateProjectInfo
                (conn, getID(), null, shortDescription, longDescription, null,
                 null, null);
            setRecord(pMgr.getProjectForID(conn, getID()));
d288 1
a288 1
        DataSet projectSet = prjGrpMgr.getProjectsForGroup(conn, getID());
d295 1
a295 1
                Project p = new Project(conn, dMgr, id);
@


1.21
log
@Fixes related to IssueTrackingRebuild.
@
text
@d76 1
a76 1
        throws DoesNotExist, DataSetException
d82 1
a82 1
        throws DataSetException, SQLException, DoesNotExist
d91 1
a91 2
        throws DataSetException, SQLException, JoistDatabaseException,
               DoesNotExist, AlreadyExists, ACLException
d102 1
a102 2
        throws DataSetException, SQLException, JoistDatabaseException,
               DoesNotExist, AlreadyExists, ACLException
d144 1
a144 1
        throws SQLException, DataSetException, DoesNotExist
d155 1
a155 1
        throws SQLException, DataSetException, DoesNotExist
d165 1
a165 1
        throws SQLException, DataSetException, DoesNotExist
d175 1
a175 2
        throws SQLException, DataSetException, DoesNotExist,
               JoistDatabaseException
d184 1
a184 2
        throws SQLException, DataSetException, DoesNotExist,
               JoistDatabaseException
d193 1
a193 2
        throws SQLException, DataSetException, DoesNotExist,
               JoistDatabaseException
d202 1
a202 2
        throws SQLException, DataSetException, DoesNotExist,
               JoistDatabaseException
d213 1
a213 2
        throws SQLException, DataSetException, JoistDatabaseException,
               ACLException, DoesNotExist
d220 1
a220 2
        throws SQLException, DataSetException, JoistDatabaseException,
               ACLException, DoesNotExist
d228 1
a228 2
        throws SQLException, DataSetException, JoistDatabaseException,
               DoesNotExist
d242 1
a242 2
        throws SQLException, DataSetException, JoistDatabaseException,
               DoesNotExist
d244 4
a247 2
        log.info("Removing project " + project.getName() + " from group " + getName());
        IssueTrackingAccountDescriptor before = new IssueTrackingAccountDescriptor(project);
d255 1
a255 2
        throws SQLException, DataSetException, JoistDatabaseException,
               DoesNotExist, ACLException               
d273 1
a273 2
        throws ACLException, DataSetException, SQLException,
               JoistDatabaseException
d290 1
a290 2
        throws DataSetException, SQLException, JoistDatabaseException,
               DoesNotExist
d299 1
a299 1
	throws DataSetException, SQLException
d320 1
a320 2
        throws DataSetException, SQLException, JoistDatabaseException,
               DoesNotExist
a324 1

@


1.20
log
@Removed debug information past its sell-by date.
@
text
@d304 1
d317 2
a318 1
	    String id = r.getValue(ProjectProjectGroupManager.PROJECT_ID).asString();
d320 5
a324 1
		projects.add(new Project(conn, dMgr, id));
@


1.19
log
@Big patch bringing the smart script runner online.
@
text
@a316 1
            log.info("Found project " + id);
@


1.18
log
@Big patch implementing a pilot test of the smart 'determine which scripts to run' system.
@
text
@d65 1
a65 2
import org.tigris.helm.tool.AccessControlledDatabaseFilter;
import org.tigris.helm.tool.TigrisUpdate;
d239 2
d243 3
a245 1
        runScripts(project, "Add");
d255 1
d258 2
a259 1
        runScripts(project, "Delete");
a294 38
    public void runScripts(Project baseProject, String mode)
        throws SQLException, DataSetException, JoistDatabaseException,
               DoesNotExist
    {
        ArrayList affectedUsers = new ArrayList();
        ArrayList affectedProjects = new ArrayList();

        UserRoleProjectManager urpMgr = (UserRoleProjectManager)
            dMgr.getManager("org.tigris.helm.database.UserRoleProjectManager");
        
        log.info("!!! Running scripts in " + mode + " mode.");
        //Only the base project is affected.
        affectedProjects.add(baseProject);
        log.info("!!! Project " + baseProject.getName() + " is affected.");
        log.info("!!! GroupProject: " + getName());

        //All users with a role in the composite project are affected.
        DataSet users = urpMgr.getUsersForProject(conn, getID(), Boolean.TRUE);
        for (int i = 0; i < users.size(); i++)
        {
            User user = new User(conn, dMgr, users.getRecord(i));
            log.info("!!! User " + user.getName() + " is affected.");
            affectedUsers.add(user);
        }
        
        if (affectedUsers.size() > 0 && affectedProjects.size() > 0)
        {
            if (mode.equals("Add"))
            {
                TigrisUpdate.findNewMembers(conn, dMgr, null,
                                            affectedUsers, affectedProjects);
            } else {
                TigrisUpdate.findExMembers(conn, dMgr, null,
                                           affectedUsers, affectedProjects);
            }
        }
    }

d311 1
a311 1
        List projects = new ArrayList();
d317 1
@


1.17
log
@Categories can now be created through the ProjectGroup interface.
@
text
@d336 9
a344 1
        ArrayList projects = new ArrayList();
a345 1
        
d348 5
a352 3
            String projectID = projectSet.getRecord(i)
                .getValue(ProjectProjectGroupManager.PROJECT_ID).asString();
            projects.add(new Project(conn, dMgr, projectID));
d354 1
a354 2
        return AccessControlledDatabaseFilter.getViewableProjects
            (acl, projects);
d356 1
a356 1
    
@


1.16
log
@More pagination changes--allow paginated lists to filter out items already in a group.
@
text
@d64 1
a64 3
import org.tigris.helm.project.Project;
import org.tigris.helm.project.ProjectProfile;
import org.tigris.helm.project.GroupProfile;
d90 2
a91 2
                        String name, String shortDescription, 
                        String longDescription)
d95 2
a96 2
        this(c, dMgr, acl, domainID, name, shortDescription, longDescription,
             null);
d101 3
a103 2
                        String name, String shortDescription, 
                        String longDescription, ArrayList initialMembers)
d109 8
a116 2
        //Get profile and license. (?)
        ProjectProfile profile = new GroupProfile();
@


1.15
log
@Updated to support new HELM_PROJECT.USE_INDEX field (may make use of new DBFlag class to do so).
@
text
@a349 1

@


1.14
log
@Removed unnecessary getCache() implementations in BusinessObject subclasses and migrated to a factory method for User's primary database key ctor.
@
text
@d114 2
a115 2
                                   shortDescription, longDescription, "", null,
                                   acl.getUserID(), acl.getUserID());
d279 2
a280 1
                (conn, getID(), null, shortDescription, longDescription, null, null);
@


1.13
log
@Propogated object cache interface.
@
text
@a134 5
    protected Dictionary getCache ()
    {
        return null;
    }

@


1.12
log
@Project groups now have summary and description like regular projects.
@
text
@d135 6
@


1.11
log
@Added a check so that business objects cannot be created with records from the wrong table. Also added some new business objects.
@
text
@d92 2
a93 1
                        String name, String description)
d97 2
a98 1
        this(c, dMgr, acl, domainID, name, description, null);
d103 2
a104 2
                        String name, String description, 
                        ArrayList initialMembers)
d114 2
a115 2
                                   description, "", "", null, acl.getUserID(), 
                                  acl.getUserID());
d269 2
a270 1
    public void updateInfo(AccessControlList acl, String description)
d278 1
a278 1
                (conn, getID(), null, description, null, null, null);
a346 5
    }

    public String getDescription() throws DataSetException
    {
        return super.getShortDescription();
@


1.10
log
@ProjectGroupDelete should work now (as should project deletion in general)
@
text
@d79 1
a79 1
        throws DoesNotExist
@


1.9
log
@Corrected method names and calls.
@
text
@d249 18
@


1.8
log
@Changes to fix horrible mistakes in removing projects from project groups, among other things.
@
text
@d321 1
a321 1
    public int getNumberOfUsers(AccessControlList acl)
d325 1
a325 1
        return getUsers().size();
@


1.8.2.1
log
@merged in changes from HEAD
@
text
@a248 18
    public void delete(AccessControlList acl)
        throws SQLException, DataSetException, JoistDatabaseException,
               DoesNotExist, ACLException               
    {
        acl.assertPermissionForDomain("ProjectGroup - Delete", getDomainID());
        //Remove all members of the group.
        DataSet projectSet = prjGrpMgr.getProjectsForGroup(conn, getID());
        for (int i=0; i < projectSet.size(); i++)
        {
            String projectID = projectSet.getRecord(i)
                .getValue(ProjectProjectGroupManager.PROJECT_ID).asString();
            Project remove = new Project(conn, dMgr, projectID);
            removeProjectNoPerms(remove);
        }
        //Delete the project like any other project.
        super.delete(acl);
    }

d321 1
a321 1
    public int getNumberOfProjects(AccessControlList acl)
d325 1
a325 1
        return getProjects(acl).size();
@


1.7
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
@d243 1
@


1.6
log
@Added project group edit and delete.
@
text
@d115 2
a116 4
        //TODO: Add the group to external applications.
        String domainName = domMgr.getDomainName(domainID);
        TigrisUpdate.addProject(domainName, name, getID(), null, 
                                description);        
d290 2
a291 1
                TigrisUpdate.findNewMembers(affectedUsers, affectedProjects);
d293 2
a294 1
                TigrisUpdate.findExMembers(affectedUsers, affectedProjects);
@


1.5
log
@Bugfixes for project groups.
@
text
@d250 13
d309 7
d317 1
a317 1
            (conn, dMgr, acl, projectSet);
d320 1
a320 1
    public int getNumberOfProjects(AccessControlList acl)
d324 1
a324 3
        DataSet projectSet = prjGrpMgr.getProjectsForGroup(conn, getID());
        return AccessControlledDatabaseFilter.getViewableProjects
            (conn, dMgr, acl, projectSet).size();
@


1.4
log
@ProjectGroup Add servlet implemented.
@
text
@d121 2
a122 3
        prjGrpMgr.addProjectToGroup(conn, getID(), pMgr.getHostProjectID());
        prjGrpMgr.addProjectToGroup(conn, getID(), 
                                    pMgr.getDomainProjectID(domainID));
d307 5
@


1.3
log
@All project group activity now goes through the ProjectGroup object.
@
text
@d17 1
a17 1
 * software developed by Collab.Net (http://www.Collab.Net/)."
d27 1
a27 1
 * permission of Collab.Net.
d32 1
a32 1
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
d96 10
d125 9
@


1.2
log
@Changed permissions for groups.
@
text
@d142 49
d200 1
a200 1
        prjGrpMgr.addProjectToGroup(conn, project.getID(), getID());
d209 18
d228 39
a266 1
    }            
@


1.1
log
@Initial run at ProjectGroup business object.
@
text
@d97 1
a97 1
        acl.assertPermissionForDomain("Group - Add", domainID);
d150 1
a150 1
        acl.assertPermissionForProject("Group Member - Add", getID());
d158 2
a159 1
        acl.assertPermissionForProject("Group Member - Delete", getID());
@

