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.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<Fields> orderByComparator)
054                    throws StorageException;
055    
056            public List<Fields> getFieldsList(
057                            long ddmStructureId, long[] classPKs, List<String> fieldNames,
058                            OrderByComparator<Fields> orderByComparator)
059                    throws StorageException;
060    
061            public List<Fields> getFieldsList(
062                            long ddmStructureId, long[] classPKs,
063                            OrderByComparator<Fields> 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 String getStorageType();
074    
075            public List<Fields> query(
076                            long ddmStructureId, List<String> fieldNames, Condition condition,
077                            OrderByComparator<Fields> orderByComparator)
078                    throws StorageException;
079    
080            public int queryCount(long ddmStructureId, Condition condition)
081                    throws StorageException;
082    
083            public void update(
084                            long classPK, Fields fields, boolean mergeFields,
085                            ServiceContext serviceContext)
086                    throws StorageException;
087    
088            public void update(
089                            long classPK, Fields fields, ServiceContext serviceContext)
090                    throws StorageException;
091    
092    }