1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.expando.service.impl;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.security.permission.ActionKeys;
28  import com.liferay.portal.service.permission.PortletPermissionUtil;
29  import com.liferay.portal.util.PortletKeys;
30  import com.liferay.portlet.expando.model.ExpandoColumn;
31  import com.liferay.portlet.expando.service.base.ExpandoColumnServiceBaseImpl;
32  import com.liferay.portlet.expando.service.permission.ExpandoColumnPermission;
33  
34  /**
35   * <a href="ExpandoColumnServiceImpl.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   */
39  public class ExpandoColumnServiceImpl extends ExpandoColumnServiceBaseImpl {
40  
41      public ExpandoColumn addColumn(long tableId, String name, int type)
42          throws PortalException, SystemException {
43  
44          PortletPermissionUtil.check(
45              getPermissionChecker(), PortletKeys.EXPANDO,
46              ActionKeys.ADD_EXPANDO);
47  
48          return expandoColumnLocalService.addColumn(tableId, name, type);
49      }
50  
51      public ExpandoColumn addColumn(
52              long tableId, String name, int type, Object defaultData)
53          throws PortalException, SystemException {
54  
55          PortletPermissionUtil.check(
56              getPermissionChecker(), PortletKeys.EXPANDO,
57              ActionKeys.ADD_EXPANDO);
58  
59          return expandoColumnLocalService.addColumn(
60              tableId, name, type, defaultData);
61      }
62  
63      public void deleteColumn(long columnId)
64          throws PortalException, SystemException {
65  
66          ExpandoColumnPermission.check(
67              getPermissionChecker(), columnId, ActionKeys.DELETE);
68  
69          expandoColumnLocalService.deleteColumn(columnId);
70      }
71  
72      public ExpandoColumn updateColumn(long columnId, String name, int type)
73          throws PortalException, SystemException {
74  
75          ExpandoColumnPermission.check(
76              getPermissionChecker(), columnId, ActionKeys.UPDATE);
77  
78          return expandoColumnLocalService.updateColumn(columnId, name, type);
79      }
80  
81      public ExpandoColumn updateColumn(
82              long columnId, String name, int type, Object defaultData)
83          throws PortalException, SystemException {
84  
85          ExpandoColumnPermission.check(
86              getPermissionChecker(), columnId, ActionKeys.UPDATE);
87  
88          return expandoColumnLocalService.updateColumn(
89              columnId, name, type, defaultData);
90      }
91  
92      public ExpandoColumn updateTypeSettings(long columnId, String typeSettings)
93          throws PortalException, SystemException {
94  
95          ExpandoColumnPermission.check(
96              getPermissionChecker(), columnId, ActionKeys.UPDATE);
97  
98          return expandoColumnLocalService.updateTypeSettings(
99              columnId, typeSettings);
100     }
101 
102 }