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.kernel.atom;
016    
017    import java.io.InputStream;
018    
019    import java.util.Date;
020    import java.util.List;
021    
022    /**
023     * @author Igor Spasic
024     */
025    public interface AtomCollectionAdapter<E> {
026    
027            public static final int SC_BAD_CONTENT = 422;
028    
029            public static final int SC_BAD_REQUEST = 400;
030    
031            public static final int SC_CONFLICT = 409;
032    
033            public static final int SC_CREATED = 201;
034    
035            public static final int SC_FORBIDDEN = 403;
036    
037            public static final int SC_INTERNAL_SERVER_ERROR = 500;
038    
039            public static final int SC_NOT_FOUND = 404;
040    
041            public static final int SC_NOT_MODIFIED = 304;
042    
043            public static final int SC_OK = 200;
044    
045            public static final int SC_UNAUTHORIZED = 401;
046    
047            public void deleteEntry(
048                            String resourceName, AtomRequestContext atomRequestContext)
049                    throws AtomException;
050    
051            public String getCollectionName();
052    
053            public E getEntry(
054                            String resourceName, AtomRequestContext atomRequestContext)
055                    throws AtomException;
056    
057            public List<String> getEntryAuthors(E entry);
058    
059            public AtomEntryContent getEntryContent(
060                    E entry, AtomRequestContext atomRequestContext);
061    
062            public String getEntryId(E entry);
063    
064            public String getEntrySummary(E entry);
065    
066            public String getEntryTitle(E entry);
067    
068            public Date getEntryUpdated(E entry);
069    
070            public Iterable<E> getFeedEntries(AtomRequestContext atomRequestContext)
071                    throws AtomException;
072    
073            public String getFeedTitle(AtomRequestContext atomRequestContext);
074    
075            public String getMediaContentType(E entry);
076    
077            public String getMediaName(E entry) throws AtomException;
078    
079            public InputStream getMediaStream(E entry) throws AtomException;
080    
081            public E postEntry(
082                            String title, String summary, String content, Date date,
083                            AtomRequestContext atomRequestContext)
084                    throws AtomException;
085    
086            public E postMedia(
087                            String mimeType, String slug, InputStream inputStream,
088                            AtomRequestContext atomRequestContext)
089                    throws AtomException;
090    
091            public void putEntry(
092                            E entry, String title, String summary, String content, Date date,
093                            AtomRequestContext atomRequestContext)
094                    throws AtomException;
095    
096            public void putMedia(
097                            E entry, String mimeType, String slug, InputStream inputStream,
098                            AtomRequestContext atomRequestContext)
099                    throws AtomException;
100    
101    }