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.model.impl;
16  
17  import com.liferay.portal.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  }