head	1.13;
access;
symbols
	TIGRIS_1_1_0RC2:1.9
	TIGRIS_1_1_0RC1:1.9
	TIGRIS_1_1:1.9.0.4
	TIGRIS_1_0_8:1.9
	TIGRIS_1_0_8RC3:1.9
	TIGRIS_1_0_8RC2:1.9
	TIGRIS_1_0_8RC1:1.9
	TIGRIS_1_0_7:1.9
	TIGRIS_1_0_7RC3:1.9
	TIGRIS_1_0_7RC2:1.9
	TIGRIS_1_0_7RC1:1.9
	TIGRIS_1_0_6:1.9
	TIGRIS_1_0_6RC5:1.9
	TIGRIS_1_0_6RC4:1.9
	TIGRIS_1_0_6RC3:1.9
	TIGRIS_1_0_6RC2:1.9
	TIGRIS_1_0_6RC1:1.9
	TIGRIS_1_0_5:1.9
	TIGRIS_1_0_5RC6:1.9
	TIGRIS_1_0_5RC5:1.9
	TIGRIS_1_0_5RC4:1.9
	TIGRIS_1_0_5RC3:1.9
	TIGRIS_1_0_5RC2:1.9
	TIGRIS_1_0_5RC1:1.9
	TIGRIS_1_0_4:1.9
	TIGRIS_1_0_3:1.9
	TIGRIS_1_0_2:1.9
	TIGRIS_1_0_1:1.9
	TIGRIS_1_0:1.9.0.6
	TIGRIS_1_0_0:1.9
	TIGRIS_1_0_0_RC1:1.9.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.2
	TIGRIS_0_9_2_3:1.2
	HELM_PEER_PORT_BRANCH:1.1.1.1
	TURBINE_PEER:1.5
	TIGRIS_0_9_2_1:1.5
	TIGRIS_0_9_2:1.2.0.2
	TIGRIS_0_9_0:1.1.0.2;
locks; strict;
comment	@# @;


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

1.12
date	2001.07.19.19.54.06;	author dlr;	state Exp;
branches;
next	1.11;

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

1.10
date	2001.05.23.01.50.21;	author dlr;	state Exp;
branches;
next	1.9;

1.9
date	2001.03.07.01.53.28;	author lucas;	state Exp;
branches;
next	1.8;

1.8
date	2001.02.24.04.04.52;	author dlr;	state Exp;
branches;
next	1.7;

1.7
date	2001.02.21.01.08.26;	author dlr;	state Exp;
branches;
next	1.6;

1.6
date	2001.02.09.01.19.12;	author dlr;	state Exp;
branches;
next	1.5;

1.5
date	2001.01.26.18.29.11;	author edk;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2001.01.26.05.24.08;	author edk;	state dead;
branches;
next	1.3;

1.3
date	2001.01.24.20.42.50;	author dlr;	state Exp;
branches;
next	1.2;

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

1.1
date	2000.12.13.19.07.48;	author leonardr;	state Exp;
branches
	1.1.1.1;
next	;

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

1.5.2.1
date	2001.01.28.01.02.19;	author dlr;	state dead;
branches;
next	1.5.2.2;

1.5.2.2
date	2001.02.09.02.39.38;	author dlr;	state Exp;
branches;
next	1.5.2.3;

1.5.2.3
date	2001.02.09.18.26.16;	author leonardr;	state Exp;
branches;
next	1.5.2.4;

1.5.2.4
date	2001.02.15.20.50.45;	author leonardr;	state Exp;
branches;
next	1.5.2.5;

1.5.2.5
date	2001.02.16.03.01.35;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.13
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@/* =============================================================
 * Copyright (c) 2000-2001 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.tool.audit;

import java.util.*;
import java.io.*;

import org.apache.turbine.util.Log;
import org.apache.commons.util.exception.NestableException;
import org.apache.torque.util.Criteria;

import org.tigris.helm.*;
import org.tigris.helm.om.*;
import org.tigris.helm.domain.*;
import org.tigris.helm.security.AccessControlList;
import org.tigris.helm.tool.paginate.*;

/**
 * Audit log.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: AuditLog.java,v 1.12 2001/07/19 19:54:06 dlr Exp $
 */
public abstract class AuditLog
{
    /**
     * Returns a paginatable list of audit log entries.
     */
    public static PeerBackedList getLog(Integer itemsPerPage, Criteria filter,
                                        AccessControlList acl)
        throws Exception
    {
        return new PeerBackedList(acl, AuditLogEntryPeer.class, itemsPerPage,
                                  null, filter);
    }

    public static AuditLogEntry logEvent
        (User triggeringUser, String description)
        throws Exception
    {
        return AuditLogEntry.add(AuditLogEntry.HOST_TYPE, "0", triggeringUser,
                                 description);
    }

    public static AuditLogEntry logEvent
        (User triggeringUser, Domain domain, String description)
        throws Exception
    {
        return AuditLogEntry.add
            (AuditLogEntry.DOMAIN_TYPE, domain.getID(), triggeringUser,
             description);
    }

    public static AuditLogEntry logEvent
        (User triggeringUser, Project project, String description)
        throws Exception
    {
        return AuditLogEntry.add
            (AuditLogEntry.PROJECT_TYPE, project.getID(), triggeringUser,
             description);
    }
}
@


1.12
log
@Removed Joist references.
@
text
@d53 2
a54 3
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.db.Criteria;
import org.apache.turbine.om.*;
d67 1
a67 1
 * @@version $Id: AuditLog.java,v 1.11 2001/06/12 23:10:43 leonardr Exp $
@


1.11
log
@PeerBackedList performance boost and refactoring. This may be more complicated than it needs to be; rather than getting ever-increasing proportions of the table, it might be faster in most cases to get the whole table, so long as you stop processing results when the list is full enough.
@
text
@a48 1
import java.sql.*;
a53 1
import org.apache.turbine.util.TurbineException;
a56 2
import org.joist.database.*;

d68 1
a68 1
 * @@version $Id: AuditLog.java,v 1.10 2001/05/23 01:50:21 dlr Exp $
@


1.10
log
@Ported Helm from WebMacro to Velocity.
@
text
@d72 1
a72 1
 * @@version $Id: AuditLog.java,v 1.9 2001/03/07 01:53:28 lucas Exp $
d83 2
a84 16
        // TODO: Integrate ACL into PeerBackedList constructor.
        //return new PeerBackedList(AuditLogEntryPeer.class, itemsPerPage,
        //                          null, filter, acl);
        PeerBackedList l = new PeerBackedList
            (AuditLogEntryPeer.class, itemsPerPage, null, filter);
        List toRemove = new ArrayList();
        for (Iterator i = l.iterator(); i.hasNext();)
        {
            AuditLogEntry e = (AuditLogEntry)i.next();
            if (!e.isViewableBy(acl))
            {
                toRemove.add(e);
            }
        }
        l.removeAll(toRemove);
        return l;
@


1.9
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d54 2
d72 1
a72 1
 * @@version $Id: AuditLog.java,v 1.8 2001/02/24 04:04:52 dlr Exp $
@


1.8
log
@Sync'd with latest Turbine changes.  Mostly this consists of the use of the new SimpleKey class to handle primary database keys.
@
text
@a60 2
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d70 1
a70 1
 * @@version $Id: AuditLog.java,v 1.7 2001/02/21 01:08:26 dlr Exp $
@


1.7
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d55 1
a55 1
import org.apache.turbine.om.BaseObject;
d72 1
a72 1
 * @@version $Id: AuditLog.java,v 1.5.2.5 2001/02/16 03:01:35 dlr Exp $
@


1.6
log
@Corected header.
@
text
@d2 1
a2 1
 * Copyright (c) 2000 CollabNet.  All rights reserved.
d53 3
a55 1
import org.webmacro.util.Log;
a56 1
import com.workingdogs.village.*;
d58 5
a62 3
import org.tigris.helm.business.*;
import org.tigris.helm.DoesNotExist;
import org.tigris.helm.database.AuditLogEntryManager;
a63 1
import org.tigris.helm.project.Project;
d67 8
a74 1
public abstract class AuditLog extends Object
d76 24
a99 1
    private AuditLogEntryManager tMgr;
d101 3
a103 8
    public static Log log = new Log("AuditLog", "Audit Log");

    public static final boolean debug = true;

    public static PaginatableAuditLogEntryList getLog
        (Connection conn, DataManager dMgr, Integer itemsPerPage,
         Criterion criterion, AccessControlList acl, Domain domain)
        throws SQLException, DataSetException
d105 2
a106 7
        AuditLogEntryManager aleMgr = (AuditLogEntryManager)dMgr.getManager 
            ("org.tigris.helm.database.AuditLogEntryManager");
        
        String query = aleMgr.getAuditLogEntriesQuery();

        return new PaginatableAuditLogEntryList
            (conn, dMgr, itemsPerPage, query, criterion, acl);
d109 3
a111 5

    public static AuditLogEntry logItem
        (Connection conn, DataManager dMgr, User triggeringUser,
         BusinessObject affected, String description)
        throws SQLException, DataSetException
d113 3
a115 2
        return logItem(conn, dMgr, triggeringUser.getID(), affected,
                       description);
d118 3
a120 5
    public static AuditLogEntry logItem(Connection conn, DataManager dMgr,
                                        String triggeringUserID,
                                        BusinessObject affected,
                                        String description)
        throws SQLException, DataSetException
d122 3
a124 9
        String type = AuditLogEntryManager.HOST_TYPE;
        String id = affected.getID();
        if (affected instanceof Domain)
            type = AuditLogEntryManager.DOMAIN_TYPE;
        else if (affected instanceof Project)
            type = AuditLogEntryManager.PROJECT_TYPE;
        AuditLogEntry entry = new AuditLogEntry
            (conn, dMgr, type, id, triggeringUserID, description);
        return entry;
a126 1

@


1.5
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d1 2
a2 1
/* ============================================================= * Copyright (c) 2000 CollabNet.  All rights reserved.
@


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


1.5.2.2
log
@Part way ported audit log.
@
text
@d1 1
a1 2
/* =============================================================
 * Copyright (c) 2000 CollabNet.  All rights reserved.
d52 1
a52 3
import org.apache.turbine.util.Log;
import org.apache.turbine.util.db.Criteria;
import org.apache.turbine.om.BaseObject;
d54 1
d56 3
a58 4

import org.tigris.helm.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
d60 1
d64 1
a64 8
/**
 * Audit log.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: $
 */
public abstract class AuditLog
d66 10
a75 6
    /**
     * TODO
     */
    public static PeerBackedList getLog(Integer itemsPerPage, Criteria filter,
                                        AccessControlList acl, Domain domain)
        throws Exception
d77 7
a83 5
        // TODO: Integrate ACL.
        //return new PeerBackedList(AuditLogEntryPeer.class, itemsPerPage,
        //                          null, filter, acl);
        return new PeerBackedList(AuditLogEntryPeer.class, itemsPerPage, null,
                                  filter);
d86 5
a90 6
    /**
     * TODO
     */
    public static AuditLogEntry logItem(User triggeringUser,
                                        BaseObject affected,
                                        String description)
d92 2
a93 1
        return logItem(triggeringUser.getID(), affected, description);
d96 3
a98 5
    /**
     * Logs an entry.
     */
    public static AuditLogEntry logItem(String triggeringUserID,
                                        BaseObject affected,
d100 1
d102 9
a110 9
        String type = AuditLogEntry.HOST_TYPE;
        if (affected instanceof Domain) {
            type = AuditLogEntry.DOMAIN_TYPE;
        }
        else if (affected instanceof Project) {
            type = AuditLogEntry.PROJECT_TYPE;
        }
        return AuditLogEntryPeer.getInstance(type, affected, triggeringUserID,
                                             description);
d113 1
@


1.5.2.3
log
@Ported audit log functionality.
@
text
@d71 1
a71 1
 * @@version $Id: AuditLog.java,v 1.5.2.2 2001/02/09 02:39:38 dlr Exp $
d76 1
a76 1
     * Returns a paginatable list of audit log entries.
d79 1
a79 1
                                        AccessControlList acl)
d82 1
a82 1
        // TODO: Integrate ACL into PeerBackedList constructor.
d85 2
a86 13
        PeerBackedList l = new PeerBackedList
            (AuditLogEntryPeer.class, itemsPerPage, null, filter);
        List toRemove = new ArrayList();
        for (Iterator i = l.iterator(); i.hasNext();)
        {
            AuditLogEntry e = (AuditLogEntry)i.next();
            if (!e.isViewableBy(acl))
            {
                toRemove.add(e);
            }
        }
        l.removeAll(toRemove);
        return l;
d89 6
a94 3
    public static AuditLogEntry logEvent
        (User triggeringUser, String description)
        throws Exception
d96 1
a96 2
        return AuditLogEntry.add(AuditLogEntry.HOST_TYPE, "0", triggeringUser,
                                 description);
d99 6
a104 3
    public static AuditLogEntry logEvent
        (User triggeringUser, Domain domain, String description)
        throws Exception
d106 9
a114 12
        return AuditLogEntry.add
            (AuditLogEntry.DOMAIN_TYPE, domain.getID(), triggeringUser,
             description);
    }

    public static AuditLogEntry logEvent
        (User triggeringUser, Project project, String description)
        throws Exception
    {
        return AuditLogEntry.add
            (AuditLogEntry.PROJECT_TYPE, project.getID(), triggeringUser,
             description);
@


1.5.2.4
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d71 1
a71 1
 * @@version $Id: AuditLog.java,v 1.5.2.3 2001/02/09 18:26:16 leonardr Exp $
@


1.5.2.5
log
@Added new imports necessitated by Torque.
@
text
@a61 1
import org.tigris.helm.om.base.*;
d71 1
a71 1
 * @@version $Id: AuditLog.java,v 1.5.2.4 2001/02/15 20:50:45 leonardr Exp $
@


1.4
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
@a55 1
import org.tigris.helm.database.DBException;
d87 4
a90 5
    public static AuditLogEntry logItem (Connection conn, DataManager dMgr,
                                         User triggeringUser,
                                         BusinessObject affected,
                                         String description)
        throws DBException
d100 1
a100 1
        throws DBException
@


1.3
log
@Making use of DBException.
@
text
@@


1.2
log
@Many, many pagination changes.
@
text
@d56 1
d88 5
a92 4
    public static AuditLogEntry logItem
        (Connection conn, DataManager dMgr, User triggeringUser,
         BusinessObject affected, String description)
        throws SQLException, DataSetException
d102 1
a102 1
        throws SQLException, DataSetException
@


1.1
log
@Moved AuditLog to its own directory, where it will be joined by servlets.
@
text
@d62 1
d72 3
a74 2
    public static List getLog(Connection conn, DataManager dMgr,
                              AccessControlList acl, Domain domain)
d80 4
a83 12
        ArrayList entries = new ArrayList();
        DataSet entrySet = aleMgr.getAuditLogEntriesForDomain(conn, domain.getID());
        for (int i = 0 ; i < entrySet.size() ; i++)
        {
            Record record = entrySet.getRecord(i);
            AuditLogEntry e = new AuditLogEntry(conn, dMgr, record);
            if (e.isViewable(acl))
            {
                entries.add(e);
            }
        }        
        return entries;
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d1 1
a1 2
/* =============================================================
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d52 1
a52 3
import org.apache.turbine.util.Log;
import org.apache.turbine.util.db.Criteria;
import org.apache.turbine.om.BaseObject;
d54 1
d56 3
a58 5

import org.tigris.helm.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d60 1
a61 1
import org.tigris.helm.tool.paginate.*;
d63 1
a63 8
/**
 * Audit log.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: AuditLog.java,v 1.5.2.5 2001/02/16 03:01:35 dlr Exp $
 */
public abstract class AuditLog
d65 9
a73 6
    /**
     * Returns a paginatable list of audit log entries.
     */
    public static PeerBackedList getLog(Integer itemsPerPage, Criteria filter,
                                        AccessControlList acl)
        throws Exception
d75 6
a80 7
        // TODO: Integrate ACL into PeerBackedList constructor.
        //return new PeerBackedList(AuditLogEntryPeer.class, itemsPerPage,
        //                          null, filter, acl);
        PeerBackedList l = new PeerBackedList
            (AuditLogEntryPeer.class, itemsPerPage, null, filter);
        List toRemove = new ArrayList();
        for (Iterator i = l.iterator(); i.hasNext();)
d82 3
a84 2
            AuditLogEntry e = (AuditLogEntry)i.next();
            if (!e.isViewableBy(acl))
d86 1
a86 1
                toRemove.add(e);
d88 2
a89 3
        }
        l.removeAll(toRemove);
        return l;
a91 7
    public static AuditLogEntry logEvent
        (User triggeringUser, String description)
        throws Exception
    {
        return AuditLogEntry.add(AuditLogEntry.HOST_TYPE, "0", triggeringUser,
                                 description);
    }
d93 4
a96 3
    public static AuditLogEntry logEvent
        (User triggeringUser, Domain domain, String description)
        throws Exception
d98 2
a99 3
        return AuditLogEntry.add
            (AuditLogEntry.DOMAIN_TYPE, domain.getID(), triggeringUser,
             description);
d102 5
a106 3
    public static AuditLogEntry logEvent
        (User triggeringUser, Project project, String description)
        throws Exception
d108 9
a116 3
        return AuditLogEntry.add
            (AuditLogEntry.PROJECT_TYPE, project.getID(), triggeringUser,
             description);
d119 1
@


