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.portal.service.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.model.OrgLabor;
20  import com.liferay.portal.security.permission.ActionKeys;
21  import com.liferay.portal.service.base.OrgLaborServiceBaseImpl;
22  import com.liferay.portal.service.permission.OrganizationPermissionUtil;
23  
24  import java.util.List;
25  
26  /**
27   * <a href="OrgLaborServiceImpl.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class OrgLaborServiceImpl extends OrgLaborServiceBaseImpl {
32  
33      public OrgLabor addOrgLabor(
34              long organizationId, int typeId, int sunOpen, int sunClose,
35              int monOpen, int monClose, int tueOpen, int tueClose, int wedOpen,
36              int wedClose, int thuOpen, int thuClose, int friOpen, int friClose,
37              int satOpen, int satClose)
38          throws PortalException, SystemException {
39  
40          OrganizationPermissionUtil.check(
41              getPermissionChecker(), organizationId, ActionKeys.UPDATE);
42  
43          return orgLaborLocalService.addOrgLabor(
44              organizationId, typeId, sunOpen, sunClose, monOpen, monClose,
45              tueOpen, tueClose, wedOpen, wedClose, thuOpen, thuClose, friOpen,
46              friClose, satOpen, satClose);
47      }
48  
49      public void deleteOrgLabor(long orgLaborId)
50          throws PortalException, SystemException {
51  
52          OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
53  
54          OrganizationPermissionUtil.check(
55              getPermissionChecker(), orgLabor.getOrganizationId(),
56              ActionKeys.UPDATE);
57  
58          orgLaborLocalService.deleteOrgLabor(orgLaborId);
59      }
60  
61      public OrgLabor getOrgLabor(long orgLaborId)
62          throws PortalException, SystemException {
63  
64          OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
65  
66          OrganizationPermissionUtil.check(
67              getPermissionChecker(), orgLabor.getOrganizationId(),
68              ActionKeys.VIEW);
69  
70          return orgLabor;
71      }
72  
73      public List<OrgLabor> getOrgLabors(long organizationId)
74          throws PortalException, SystemException {
75  
76          OrganizationPermissionUtil.check(
77              getPermissionChecker(), organizationId, ActionKeys.VIEW);
78  
79          return orgLaborLocalService.getOrgLabors(organizationId);
80      }
81  
82      public OrgLabor updateOrgLabor(
83              long orgLaborId, int typeId, int sunOpen, int sunClose, int monOpen,
84              int monClose, int tueOpen, int tueClose, int wedOpen, int wedClose,
85              int thuOpen, int thuClose, int friOpen, int friClose, int satOpen,
86              int satClose)
87          throws PortalException, SystemException {
88  
89          OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
90  
91          OrganizationPermissionUtil.check(
92              getPermissionChecker(), orgLabor.getOrganizationId(),
93              ActionKeys.UPDATE);
94  
95          return orgLaborLocalService.updateOrgLabor(
96              orgLaborId, typeId ,sunOpen, sunClose, monOpen, monClose, tueOpen,
97              tueClose, wedOpen, wedClose, thuOpen, thuClose, friOpen, friClose,
98              satOpen, satClose);
99      }
100 
101 }