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