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.portal.service.impl;
16  
17  import com.liferay.portal.NoSuchListTypeException;
18  import com.liferay.portal.PortalException;
19  import com.liferay.portal.SystemException;
20  import com.liferay.portal.model.ClassName;
21  import com.liferay.portal.model.ListType;
22  import com.liferay.portal.service.base.ListTypeServiceBaseImpl;
23  
24  import java.util.List;
25  
26  /**
27   * <a href="ListTypeServiceImpl.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class ListTypeServiceImpl extends ListTypeServiceBaseImpl {
32  
33      public ListType getListType(int listTypeId)
34          throws PortalException, SystemException {
35  
36          return listTypePersistence.findByPrimaryKey(listTypeId);
37      }
38  
39      public List<ListType> getListTypes(String type) throws SystemException {
40          return listTypePersistence.findByType(type);
41      }
42  
43      public void validate(int listTypeId, String type)
44          throws PortalException, SystemException {
45  
46          ListType listType = listTypePersistence.fetchByPrimaryKey(listTypeId);
47  
48          if ((listType == null) || !listType.getType().equals(type)) {
49              NoSuchListTypeException nslte = new NoSuchListTypeException();
50  
51              nslte.setType(type);
52  
53              throw nslte;
54          }
55      }
56  
57      public void validate(int listTypeId, long classNameId, String type)
58          throws PortalException, SystemException {
59  
60          ClassName className = classNameLocalService.getClassName(classNameId);
61  
62          validate(listTypeId, className.getValue() + type);
63      }
64  
65  }