1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.softwarecatalog.model.impl;
16  
17  import com.liferay.portal.kernel.exception.SystemException;
18  import com.liferay.portlet.softwarecatalog.model.SCLicense;
19  import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
20  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
21  import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
22  import com.liferay.portlet.softwarecatalog.service.SCLicenseLocalServiceUtil;
23  import com.liferay.portlet.softwarecatalog.service.SCProductScreenshotLocalServiceUtil;
24  import com.liferay.portlet.softwarecatalog.service.SCProductVersionLocalServiceUtil;
25  
26  import java.util.List;
27  
28  /**
29   * <a href="SCProductEntryImpl.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Brian Wing Shun Chan
32   */
33  public class SCProductEntryImpl
34      extends SCProductEntryModelImpl implements SCProductEntry {
35  
36      public SCProductEntryImpl() {
37      }
38  
39      public SCProductVersion getLatestVersion() throws SystemException {
40          List<SCProductVersion> results =
41              SCProductVersionLocalServiceUtil.getProductVersions(
42                  getProductEntryId(), 0, 1);
43  
44          SCProductVersion lastVersion = null;
45  
46          if (results.size() > 0) {
47              lastVersion = results.get(0);
48          }
49  
50          return lastVersion;
51      }
52  
53      public List<SCLicense> getLicenses() throws SystemException {
54          return SCLicenseLocalServiceUtil.getProductEntryLicenses(
55              getProductEntryId());
56      }
57  
58      public List<SCProductScreenshot> getScreenshots() throws SystemException {
59          return SCProductScreenshotLocalServiceUtil.getProductScreenshots(
60              getProductEntryId());
61      }
62  
63  }