001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence.impl;
016    
017    import com.liferay.portal.kernel.exception.SystemException;
018    import com.liferay.portal.kernel.util.OrderByComparator;
019    import com.liferay.portal.model.BaseModel;
020    
021    import java.util.List;
022    
023    /**
024     * @author Shuyang Zhou
025     */
026    public interface TableMapper<L extends BaseModel<L>, R extends BaseModel<R>> {
027    
028            public boolean addTableMapping(long leftPrimaryKey, long rightPrimaryKey)
029                    throws SystemException;
030    
031            public boolean containsTableMapping(
032                            long leftPrimaryKey, long rightPrimaryKey)
033                    throws SystemException;
034    
035            public int deleteLeftPrimaryKeyTableMappings(long leftPrimaryKey)
036                    throws SystemException;
037    
038            public int deleteRightPrimaryKeyTableMappings(long rightPrimaryKey)
039                    throws SystemException;
040    
041            public boolean deleteTableMapping(long leftPrimaryKey, long rightPrimaryKey)
042                    throws SystemException;
043    
044            public void destroy();
045    
046            public List<L> getLeftBaseModels(
047                            long rightPrimaryKey, int start, int end, OrderByComparator obc)
048                    throws SystemException;
049    
050            public long[] getLeftPrimaryKeys(long rightPrimaryKey)
051                    throws SystemException;
052    
053            public TableMapper<R, L> getReverseTableMapper();
054    
055            public List<R> getRightBaseModels(
056                            long leftPrimaryKey, int start, int end, OrderByComparator obc)
057                    throws SystemException;
058    
059            public long[] getRightPrimaryKeys(long leftPrimaryKey)
060                    throws SystemException;
061    
062            public boolean matches(String leftColumnName, String rightColumnName);
063    
064    }