1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.expando.service.impl;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.SystemException;
19  import com.liferay.portal.security.permission.ActionKeys;
20  import com.liferay.portal.service.permission.PortletPermissionUtil;
21  import com.liferay.portal.util.PortletKeys;
22  import com.liferay.portlet.expando.model.ExpandoColumn;
23  import com.liferay.portlet.expando.service.base.ExpandoColumnServiceBaseImpl;
24  import com.liferay.portlet.expando.service.permission.ExpandoColumnPermission;
25  
26  /**
27   * <a href="ExpandoColumnServiceImpl.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class ExpandoColumnServiceImpl extends ExpandoColumnServiceBaseImpl {
32  
33      public ExpandoColumn addColumn(long tableId, String name, int type)
34          throws PortalException, SystemException {
35  
36          PortletPermissionUtil.check(
37              getPermissionChecker(), PortletKeys.EXPANDO,
38              ActionKeys.ADD_EXPANDO);
39  
40          return expandoColumnLocalService.addColumn(tableId, name, type);
41      }
42  
43      public ExpandoColumn addColumn(
44              long tableId, String name, int type, Object defaultData)
45          throws PortalException, SystemException {
46  
47          PortletPermissionUtil.check(
48              getPermissionChecker(), PortletKeys.EXPANDO,
49              ActionKeys.ADD_EXPANDO);
50  
51          return expandoColumnLocalService.addColumn(
52              tableId, name, type, defaultData);
53      }
54  
55      public void deleteColumn(long columnId)
56          throws PortalException, SystemException {
57  
58          ExpandoColumnPermission.check(
59              getPermissionChecker(), columnId, ActionKeys.DELETE);
60  
61          expandoColumnLocalService.deleteColumn(columnId);
62      }
63  
64      public ExpandoColumn updateColumn(long columnId, String name, int type)
65          throws PortalException, SystemException {
66  
67          ExpandoColumnPermission.check(
68              getPermissionChecker(), columnId, ActionKeys.UPDATE);
69  
70          return expandoColumnLocalService.updateColumn(columnId, name, type);
71      }
72  
73      public ExpandoColumn updateColumn(
74              long columnId, String name, int type, Object defaultData)
75          throws PortalException, SystemException {
76  
77          ExpandoColumnPermission.check(
78              getPermissionChecker(), columnId, ActionKeys.UPDATE);
79  
80          return expandoColumnLocalService.updateColumn(
81              columnId, name, type, defaultData);
82      }
83  
84      public ExpandoColumn updateTypeSettings(long columnId, String typeSettings)
85          throws PortalException, SystemException {
86  
87          ExpandoColumnPermission.check(
88              getPermissionChecker(), columnId, ActionKeys.UPDATE);
89  
90          return expandoColumnLocalService.updateTypeSettings(
91              columnId, typeSettings);
92      }
93  
94  }