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.portlet.dynamicdatamapping.storage;
016    
017    import com.liferay.portal.kernel.util.OrderByComparator;
018    import com.liferay.portal.service.ServiceContext;
019    import com.liferay.portlet.dynamicdatamapping.StorageException;
020    import com.liferay.portlet.dynamicdatamapping.storage.query.Condition;
021    
022    import java.util.List;
023    import java.util.Map;
024    
025    /**
026     * @author Eduardo Lundgren
027     * @author Brian Wing Shun Chan
028     * @author Marcellus Tavares
029     */
030    public interface StorageAdapter {
031    
032            public long create(
033                            long companyId, long ddmStructureId, Fields fields,
034                            ServiceContext serviceContext)
035                    throws StorageException;
036    
037            public void deleteByClass(long classPK) throws StorageException;
038    
039            public void deleteByDDMStructure(long ddmStructureId)
040                    throws StorageException;
041    
042            public Fields getFields(long classPK) throws StorageException;
043    
044            public Fields getFields(long classPK, List<String> fieldNames)
045                    throws StorageException;
046    
047            public List<Fields> getFieldsList(
048                            long ddmStructureId, List<String> fieldNames)
049                    throws StorageException;
050    
051            public List<Fields> getFieldsList(
052                            long ddmStructureId, List<String> fieldNames,
053                            OrderByComparator orderByComparator)
054                    throws StorageException;
055    
056            public List<Fields> getFieldsList(
057                            long ddmStructureId, long[] classPKs, List<String> fieldNames,
058                            OrderByComparator orderByComparator)
059                    throws StorageException;
060    
061            public List<Fields> getFieldsList(
062                            long ddmStructureId, long[] classPKs,
063                            OrderByComparator orderByComparator)
064                    throws StorageException;
065    
066            public Map<Long, Fields> getFieldsMap(long ddmStructureId, long[] classPKs)
067                    throws StorageException;
068    
069            public Map<Long, Fields> getFieldsMap(
070                            long ddmStructureId, long[] classPKs, List<String> fieldNames)
071                    throws StorageException;
072    
073            public List<Fields> query(
074                            long ddmStructureId, List<String> fieldNames, Condition condition,
075                            OrderByComparator orderByComparator)
076                    throws StorageException;
077    
078            public int queryCount(long ddmStructureId, Condition condition)
079                    throws StorageException;
080    
081            public void update(
082                            long classPK, Fields fields, boolean mergeFields,
083                            ServiceContext serviceContext)
084                    throws StorageException;
085    
086            public void update(
087                            long classPK, Fields fields, ServiceContext serviceContext)
088                    throws StorageException;
089    
090    }