class JDBCConnection implements ObjectStoreConnection {

    @Override
    public boolean insertGroupMember(String domainName, String groupName, GroupMember groupMember,
                                     String admin, String auditRef) {

        final String caller = "insertGroupMember";

        int domainId = getDomainId(domainName);
        if (domainId == 0) {
            throw notFoundError(caller, ZMSConsts.OBJECT_DOMAIN, domainName);
        }
        int groupId = getGroupId(domainId, groupName);
        if (groupId == 0) {
            throw notFoundError(caller, ZMSConsts.OBJECT_GROUP, ZMSUtils.groupResourceName(domainName, groupName));
        }
        String principal = groupMember.getMemberName();
        if (!validatePrincipalDomain(principal)) {
            throw notFoundError(caller, ZMSConsts.OBJECT_DOMAIN, principal);
        }
        int principalId = getPrincipalId(principal);
        if (principalId == 0) {
            principalId = insertPrincipal(principal);
            if (principalId == 0) {
                throw internalServerError(caller, "Unable to insert principal: " + principal);
            }
        }

        // need to check if entry already exists

        boolean pendingRequest = (groupMember.getApproved() == Boolean.FALSE);
        boolean groupMemberExists = groupMemberExists(groupId, principalId, pendingRequest, caller);

        // process the request based on the type of the request
        // either pending request or standard insert

        boolean result;
        if (pendingRequest) {
            result = insertPendingGroupMember(groupId, principalId, groupMember, admin,
                    auditRef, groupMemberExists, caller);
        } else {
            result = insertStandardGroupMember(groupId, principalId, groupMember, admin,
                    principal, auditRef, groupMemberExists, false, caller);
        }
        return result;
    }

    public  JDBCConnection(Connection con, boolean autoCommit);

}