1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.expando.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.security.permission.ActionKeys;
20  import com.liferay.portlet.expando.model.ExpandoColumn;
21  import com.liferay.portlet.expando.model.ExpandoValue;
22  import com.liferay.portlet.expando.service.base.ExpandoValueServiceBaseImpl;
23  import com.liferay.portlet.expando.service.permission.ExpandoColumnPermission;
24  
25  import java.io.Serializable;
26  
27  /**
28   * <a href="ExpandoValueServiceImpl.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   */
32  public class ExpandoValueServiceImpl extends ExpandoValueServiceBaseImpl {
33  
34      public ExpandoValue addValue(
35              String className, String tableName, String columnName, long classPK,
36              Object data)
37          throws PortalException, SystemException {
38  
39          ExpandoColumn column = expandoColumnLocalService.getColumn(
40              className, tableName, columnName);
41  
42          ExpandoColumnPermission.check(
43              getPermissionChecker(), column, ActionKeys.UPDATE);
44  
45          return expandoValueLocalService.addValue(
46              className, tableName, columnName, classPK, data);
47      }
48  
49      public Serializable getData(
50              String className, String tableName, String columnName, long classPK)
51          throws PortalException, SystemException {
52  
53          ExpandoColumn column = expandoColumnLocalService.getColumn(
54              className, tableName, columnName);
55  
56          if (ExpandoColumnPermission.contains(
57                  getPermissionChecker(), column, ActionKeys.VIEW)) {
58  
59              return expandoValueLocalService.getData(
60                  className, tableName, columnName, classPK);
61          }
62          else {
63              return null;
64          }
65      }
66  
67  }