1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.softwarecatalog.service.impl;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
25  import com.liferay.portlet.softwarecatalog.service.base.SCProductScreenshotLocalServiceBaseImpl;
26  
27  import java.util.List;
28  
29  /**
30   * <a href="SCProductScreenshotLocalServiceImpl.java.html"><b><i>View Source</i>
31   * </b></a>
32   *
33   * @author Brian Wing Shun Chan
34   *
35   */
36  public class SCProductScreenshotLocalServiceImpl
37      extends SCProductScreenshotLocalServiceBaseImpl {
38  
39      public void deleteProductScreenshot(SCProductScreenshot productScreenshot)
40          throws PortalException, SystemException {
41  
42          imageLocalService.deleteImage(productScreenshot.getThumbnailId());
43          imageLocalService.deleteImage(productScreenshot.getFullImageId());
44  
45          scProductScreenshotPersistence.remove(productScreenshot);
46      }
47  
48      public void deleteProductScreenshots(long productEntryId)
49          throws PortalException, SystemException {
50  
51          List<SCProductScreenshot> productScreenshots =
52              scProductScreenshotPersistence.findByProductEntryId(productEntryId);
53  
54          for (SCProductScreenshot productScreenshot : productScreenshots) {
55              deleteProductScreenshot(productScreenshot);
56          }
57      }
58  
59      public SCProductScreenshot getProductScreenshot(
60              long productEntryId, int priority)
61          throws PortalException, SystemException {
62  
63          return scProductScreenshotPersistence.findByP_P(
64              productEntryId, priority);
65      }
66  
67      public List<SCProductScreenshot> getProductScreenshots(long productEntryId)
68          throws SystemException {
69  
70          return scProductScreenshotPersistence.findByProductEntryId(
71              productEntryId);
72      }
73  
74      public SCProductScreenshot getProductScreenshotByFullImageId(
75              long fullImageId)
76          throws PortalException, SystemException {
77  
78          return scProductScreenshotPersistence.findByFullImageId(fullImageId);
79      }
80  
81      public SCProductScreenshot getProductScreenshotByThumbnailId(
82              long thumbnailId)
83          throws PortalException, SystemException {
84  
85          return scProductScreenshotPersistence.findByThumbnailId(thumbnailId);
86      }
87  
88  }