001package org.apache.fulcrum.security.torque.peer;
002/*
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *   http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 */
020import java.sql.Connection;
021
022import org.apache.fulcrum.security.entity.Group;
023import org.apache.fulcrum.security.entity.Role;
024import org.apache.fulcrum.security.entity.User;
025import org.apache.torque.TorqueException;
026
027/**
028 * This interface allows to retrieve user, group, role relationships either from custom or the default OM in 
029 * 
030 * It should be implemented by appopriate om classes (interface may be set in schema).
031 * 
032 * @author gk
033 * @Id $Id$
034 *
035 */
036public interface TurbineUserGroupRoleModelPeerMapper
037{
038
039    /**
040     * Returns the associated TurbineUser object.
041     * If it was not retrieved before, the object is retrieved from
042     * the database
043     *
044     * @return the associated TurbineUser object
045     * @throws TorqueException  if any database error occurs when reading from the database fails.
046     */
047    User getTurbineUser()
048        throws TorqueException;
049
050    /**
051     * Return the associated TurbineUser object
052     * If it was not retrieved before, the object is retrieved from
053     * the database using the passed connection
054     *
055     * @param connection the connection used to retrieve the associated object
056     *        from the database, if it was not retrieved before
057     * @return the associated TurbineUser object
058     * @throws TorqueException  if any database error occurs
059     */
060    User getTurbineUser( Connection connection )
061        throws TorqueException;
062
063    /**
064     * Returns the associated TurbineGroup object.
065     * If it was not retrieved before, the object is retrieved from
066     * the database
067     *
068     * @return the associated TurbineGroup object
069     * @throws TorqueException  if any database error occurs when reading from the database fails.
070     */
071    Group getTurbineGroup()
072        throws TorqueException;
073
074    /**
075     * Return the associated TurbineGroup object
076     * If it was not retrieved before, the object is retrieved from
077     * the database using the passed connection
078     *
079     * @param connection the connection used to retrieve the associated object
080     *        from the database, if it was not retrieved before
081     * @return the associated TurbineGroup object
082     * @throws TorqueException  if any database error occurs
083     */
084    Group getTurbineGroup( Connection connection )
085        throws TorqueException;
086
087    /**
088     * Returns the associated TurbineRole object.
089     * If it was not retrieved before, the object is retrieved from
090     * the database
091     *
092     * @return the associated TurbineRole object
093     * @throws TorqueException  if any database error occurs when reading from the database fails.
094     */
095    Role getTurbineRole()
096        throws TorqueException;
097
098    /**
099     * Return the associated TurbineRole object
100     * If it was not retrieved before, the object is retrieved from
101     * the database using the passed connection
102     *
103     * @param connection the connection used to retrieve the associated object
104     *        from the database, if it was not retrieved before
105     * @return the associated TurbineRole object
106     * @throws TorqueException  if any database error occurs
107     */
108    Role getTurbineRole( Connection connection )
109        throws TorqueException;
110
111}