head	1.10;
access;
symbols;
locks; strict;
comment	@# @;


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

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

1.8
date	2001.06.15.21.23.35;	author leonardr;	state Exp;
branches;
next	1.7;

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

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

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

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

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

1.2
date	2001.05.02.06.57.45;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2001.05.02.06.49.25;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.10
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.om;

import java.util.*;


import org.apache.torque.util.Criteria;

import org.tigris.helm.DoesNotExist;
import org.tigris.helm.om.*;
import org.tigris.helm.tool.PeerTool;

/**
 * Customization of generated BaseAttributePeer class.
 *
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 */
public class AttributePeer extends BaseAttributePeer
{
    /**
     * Returns the value of a specified host attribute.
     */
    public static String getHostAttribute(String name)
        throws DoesNotExist, Exception
    {
        Criteria c = new Criteria(3)
            .add(AttributePeer.NAME, name)
            .addJoin(AttributePeer.ATTRIBUTE_ID, 
                     AttributeValuePeer.ATTRIBUTE_ID)
            .add(AttributeValuePeer.ENTITY_ID, 
                 ProjectPeer.getHost().getID());
        AttributeValue a = (AttributeValue)
            PeerTool.getFirstBO(AttributeValuePeer.doSelect(c), 
                                "Host attribute " + name);
        return a.getValue();
    }

    /**
     * Returns a list of all the possible attributes for the specified
     * entity type.
     */
    public static List getAttributes(String entityType)
        throws Exception
    {
        Criteria c = new Criteria(1)
            .add(AttributePeer.ENTITY_TYPE, entityType);
        return doSelect(c);
    }    

    /**
     * Fetches an attribute by human-readable description.
     */
    public static Attribute getInstanceByDescription(String description)
        throws DoesNotExist, Exception
    {
        return (Attribute)PeerTool.getFirstBO
            (doSelect(new Criteria(1).add(DESCRIPTION, description)),
             "Attribute with description " + description);
    }
}
@


1.9
log
@Huge patch of the day: Got rid of redundant HELM_DOMAIN table. The project representation of the domain and the host is now the canonical one. Host and Domain now subclass ProjectGroup. The canonical representation of a project's membership in a domain group is now the corresponding mapping in HELM_PROJECT_PROJECTGROUP. Schema changes: No more HELM_DOMAIN table (obviously); no more DOMAIN_ID in HELM_PROJECT; HELM_USER and HELM_VC_VIEW now have foreign keys in HELM_PROJECT instead of HELM_DOMAIN.
@
text
@a50 2
import org.apache.turbine.om.SimpleKey;
import org.apache.turbine.om.NumberKey;
d52 1
a52 1
import org.apache.turbine.util.db.Criteria;
@


1.8
log
@TableTrackingBufferCache now watches the attribute containing its fractional size, rather than the fractional size itself.
@
text
@d79 1
a79 1
                 ProjectPeer.getHostProject().getID());
@


1.7
log
@Rearranged attribute constants and added generic host attribute-editing interface to AdminUtils.
@
text
@d77 3
a79 5
                     AttributeValuePeer.ATTRIBUTE_ID);
        //.add(AttributeValuePeer.ENTITY_ID, 
        //ProjectPeer.getHostProject().getID());
        //I comment this out because the ProjectPeer cache initializer
        //uses this method.
@


1.6
log
@Added code to handle the default fractional size of TableTrackingBufferCaches as host attributes.
@
text
@d56 1
a67 17
    public static final String REQUESTABLE_ATTRIBUTE = "requestable";
    public static final String DENOTES_OWNERSHIP_ATTRIBUTE = 
        "denotesOwnership";
    public static final String GRANT_ON_PROJECT_CREATION_ATTRIBUTE = 
        "grantOnProjectCreation";
    public static final String BLOCK_RECURSION_INTO_PRIVATE_PROJECTS_ATTRIBUTE
        = "blockRecursionIntoPrivateProjects";

    public static final String MAX_UPLOAD_SIZE
        = "maxUploadSize";

    public static final String FRACTIONAL_USER_CACHE_SIZE
        = "fractionalUserCacheSize";

    public static final String FRACTIONAL_PROJECT_CACHE_SIZE
        = "fractionalProjectCacheSize";

d69 1
a69 2
     * Returns a list of all the possible attributes for the specified
     * entity type.
d72 1
a72 1
        throws Exception
d99 11
@


1.5
log
@A Heartbreaking Patch of Staggering Genius: adds capacity (but no interface) for deeply nested projects, categories, and project groups. As a side effect, gets rid of the hacky special 'all public projects in domain' group. There are probably bugs in this, and some of those bugs are probably security holes, so watch out.
@
text
@d75 30
@


1.4
log
@Allow attribute retrieval by attribute entity type.
@
text
@d72 2
@


1.3
log
@Corrected header JavaDoc.
@
text
@d74 2
a75 1
     * Returns a list of all the possible role attributes.
d77 1
a77 1
    public static List getAttributes()
d80 3
a82 1
        return doSelect(HelmPeer.NO_CRITERIA);
@


1.2
log
@Replaced Role-specific tables w/ more general purpose versions.  Did a little clean up in light of that.
@
text
@d60 1
a60 1
 * Extension of generated Peer BaseRoleAttributePeer
@


1.1
log
@Replaced Role-specific tables w/ more general purpose versions.
@
text
@a56 1

d63 1
d65 1
a65 1
public class RoleAttributePeer extends BaseRoleAttributePeer
a66 1

d79 1
a79 1
        return doSelect(new Criteria(0));
@

