1
14
15 package com.liferay.portal.service.impl;
16
17 import com.liferay.portal.NoSuchListTypeException;
18 import com.liferay.portal.kernel.exception.PortalException;
19 import com.liferay.portal.kernel.exception.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
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 }