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, DDMFormValues ddmFormValues,
034                            ServiceContext serviceContext)
035                    throws StorageException;
036    
037            public long create(
038                            long companyId, long ddmStructureId, Fields fields,
039                            ServiceContext serviceContext)
040                    throws StorageException;
041    
042            public void deleteByClass(long classPK) throws StorageException;
043    
044            public void deleteByDDMStructure(long ddmStructureId)
045                    throws StorageException;
046    
047            public DDMFormValues getDDMFormValues(long classPK) throws StorageException;
048    
049            public Fields getFields(long classPK) throws StorageException;
050    
051            public Fields getFields(long classPK, List<String> fieldNames)
052                    throws StorageException;
053    
054            public List<Fields> getFieldsList(
055                            long ddmStructureId, List<String> fieldNames)
056                    throws StorageException;
057    
058            public List<Fields> getFieldsList(
059                            long ddmStructureId, List<String> fieldNames,
060                            OrderByComparator<Fields> orderByComparator)
061                    throws StorageException;
062    
063            public List<Fields> getFieldsList(
064                            long ddmStructureId, long[] classPKs, List<String> fieldNames,
065                            OrderByComparator<Fields> orderByComparator)
066                    throws StorageException;
067    
068            public List<Fields> getFieldsList(
069                            long ddmStructureId, long[] classPKs,
070                            OrderByComparator<Fields> orderByComparator)
071                    throws StorageException;
072    
073            public Map<Long, Fields> getFieldsMap(long ddmStructureId, long[] classPKs)
074                    throws StorageException;
075    
076            public Map<Long, Fields> getFieldsMap(
077                            long ddmStructureId, long[] classPKs, List<String> fieldNames)
078                    throws StorageException;
079    
080            public String getStorageType();
081    
082            public List<Fields> query(
083                            long ddmStructureId, List<String> fieldNames, Condition condition,
084                            OrderByComparator<Fields> orderByComparator)
085                    throws StorageException;
086    
087            public int queryCount(long ddmStructureId, Condition condition)
088                    throws StorageException;
089    
090            public void update(
091                            long classPK, DDMFormValues ddmFormValues,
092                            ServiceContext serviceContext)
093                    throws StorageException;
094    
095            public void update(
096                            long classPK, Fields fields, boolean mergeFields,
097                            ServiceContext serviceContext)
098                    throws StorageException;
099    
100            public void update(
101                            long classPK, Fields fields, ServiceContext serviceContext)
102                    throws StorageException;
103    
104    }