1
22
23 package com.liferay.portal.service.impl;
24
25 import com.liferay.portal.NoSuchListTypeException;
26 import com.liferay.portal.PortalException;
27 import com.liferay.portal.SystemException;
28 import com.liferay.portal.model.ClassName;
29 import com.liferay.portal.model.ListType;
30 import com.liferay.portal.service.base.ListTypeServiceBaseImpl;
31
32 import java.util.List;
33
34
40 public class ListTypeServiceImpl extends ListTypeServiceBaseImpl {
41
42 public ListType getListType(int listTypeId)
43 throws PortalException, SystemException {
44
45 return listTypePersistence.findByPrimaryKey(listTypeId);
46 }
47
48 public List<ListType> getListTypes(String type) throws SystemException {
49 return listTypePersistence.findByType(type);
50 }
51
52 public void validate(int listTypeId, String type)
53 throws PortalException, SystemException {
54
55 ListType listType = listTypePersistence.fetchByPrimaryKey(listTypeId);
56
57 if ((listType == null) || !listType.getType().equals(type)) {
58 NoSuchListTypeException nslte = new NoSuchListTypeException();
59
60 nslte.setType(type);
61
62 throw nslte;
63 }
64 }
65
66 public void validate(int listTypeId, long classNameId, String type)
67 throws PortalException, SystemException {
68
69 ClassName className = classNameLocalService.getClassName(classNameId);
70
71 validate(listTypeId, className.getValue() + type);
72 }
73
74 }