1   /**
2    * Copyright (c) 2000-2010 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   *
12   *
13   */
14  
15  package com.liferay.portlet.softwarecatalog.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
20  import com.liferay.portlet.softwarecatalog.service.base.SCProductScreenshotLocalServiceBaseImpl;
21  
22  import java.util.List;
23  
24  /**
25   * <a href="SCProductScreenshotLocalServiceImpl.java.html"><b><i>View Source</i>
26   * </b></a>
27   *
28   * @author Brian Wing Shun Chan
29   */
30  public class SCProductScreenshotLocalServiceImpl
31      extends SCProductScreenshotLocalServiceBaseImpl {
32  
33      public void deleteProductScreenshot(SCProductScreenshot productScreenshot)
34          throws PortalException, SystemException {
35  
36          // Product screenshot
37  
38          scProductScreenshotPersistence.remove(productScreenshot);
39  
40          // Images
41  
42          imageLocalService.deleteImage(productScreenshot.getThumbnailId());
43          imageLocalService.deleteImage(productScreenshot.getFullImageId());
44      }
45  
46      public void deleteProductScreenshots(long productEntryId)
47          throws PortalException, SystemException {
48  
49          List<SCProductScreenshot> productScreenshots =
50              scProductScreenshotPersistence.findByProductEntryId(productEntryId);
51  
52          for (SCProductScreenshot productScreenshot : productScreenshots) {
53              deleteProductScreenshot(productScreenshot);
54          }
55      }
56  
57      public SCProductScreenshot getProductScreenshot(
58              long productEntryId, int priority)
59          throws PortalException, SystemException {
60  
61          return scProductScreenshotPersistence.findByP_P(
62              productEntryId, priority);
63      }
64  
65      public SCProductScreenshot getProductScreenshotByFullImageId(
66              long fullImageId)
67          throws PortalException, SystemException {
68  
69          return scProductScreenshotPersistence.findByFullImageId(fullImageId);
70      }
71  
72      public SCProductScreenshot getProductScreenshotByThumbnailId(
73              long thumbnailId)
74          throws PortalException, SystemException {
75  
76          return scProductScreenshotPersistence.findByThumbnailId(thumbnailId);
77      }
78  
79      public List<SCProductScreenshot> getProductScreenshots(long productEntryId)
80          throws SystemException {
81  
82          return scProductScreenshotPersistence.findByProductEntryId(
83              productEntryId);
84      }
85  
86  }