001    /**
002     * Copyright (c) 2000-present 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.util.OrderByComparator;
018    import com.liferay.portal.model.BaseModel;
019    
020    import java.util.List;
021    
022    /**
023     * @author Shuyang Zhou
024     */
025    public interface TableMapper<L extends BaseModel<L>, R extends BaseModel<R>> {
026    
027            public boolean addTableMapping(
028                    long companyId, long leftPrimaryKey, long rightPrimaryKey);
029    
030            public boolean containsTableMapping(
031                    long leftPrimaryKey, long rightPrimaryKey);
032    
033            public int deleteLeftPrimaryKeyTableMappings(long leftPrimaryKey);
034    
035            public int deleteRightPrimaryKeyTableMappings(long rightPrimaryKey);
036    
037            public boolean deleteTableMapping(
038                    long leftPrimaryKey, long rightPrimaryKey);
039    
040            public void destroy();
041    
042            public List<L> getLeftBaseModels(
043                    long rightPrimaryKey, int start, int end, OrderByComparator<L> obc);
044    
045            public long[] getLeftPrimaryKeys(long rightPrimaryKey);
046    
047            public TableMapper<R, L> getReverseTableMapper();
048    
049            public List<R> getRightBaseModels(
050                    long leftPrimaryKey, int start, int end, OrderByComparator<R> obc);
051    
052            public long[] getRightPrimaryKeys(long leftPrimaryKey);
053    
054            public boolean matches(String leftColumnName, String rightColumnName);
055    
056    }