001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.impl;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025: import com.liferay.portal.kernel.security.permission.ActionKeys;
026: import com.liferay.portal.model.OrgLabor;
027: import com.liferay.portal.service.base.OrgLaborServiceBaseImpl;
028: import com.liferay.portal.service.permission.OrganizationPermissionUtil;
029:
030: import java.util.List;
031:
032: /**
033: * <a href="OrgLaborServiceImpl.java.html"><b><i>View Source</i></b></a>
034: *
035: * @author Brian Wing Shun Chan
036: *
037: */
038: public class OrgLaborServiceImpl extends OrgLaborServiceBaseImpl {
039:
040: public OrgLabor addOrgLabor(long organizationId, int typeId,
041: int sunOpen, int sunClose, int monOpen, int monClose,
042: int tueOpen, int tueClose, int wedOpen, int wedClose,
043: int thuOpen, int thuClose, int friOpen, int friClose,
044: int satOpen, int satClose) throws PortalException,
045: SystemException {
046:
047: checkPermission(organizationId, ActionKeys.UPDATE);
048:
049: return orgLaborLocalService.addOrgLabor(organizationId, typeId,
050: sunOpen, sunClose, monOpen, monClose, tueOpen,
051: tueClose, wedOpen, wedClose, thuOpen, thuClose,
052: friOpen, friClose, satOpen, satClose);
053: }
054:
055: public void deleteOrgLabor(long orgLaborId) throws PortalException,
056: SystemException {
057:
058: OrgLabor orgLabor = orgLaborPersistence
059: .findByPrimaryKey(orgLaborId);
060:
061: checkPermission(orgLabor.getOrganizationId(), ActionKeys.UPDATE);
062:
063: orgLaborLocalService.deleteOrgLabor(orgLaborId);
064: }
065:
066: public OrgLabor getOrgLabor(long orgLaborId)
067: throws PortalException, SystemException {
068:
069: OrgLabor orgLabor = orgLaborPersistence
070: .findByPrimaryKey(orgLaborId);
071:
072: checkPermission(orgLabor.getOrganizationId(), ActionKeys.VIEW);
073:
074: return orgLabor;
075: }
076:
077: public List getOrgLabors(long organizationId)
078: throws PortalException, SystemException {
079:
080: checkPermission(organizationId, ActionKeys.VIEW);
081:
082: return orgLaborLocalService.getOrgLabors(organizationId);
083: }
084:
085: public OrgLabor updateOrgLabor(long orgLaborId, int sunOpen,
086: int sunClose, int monOpen, int monClose, int tueOpen,
087: int tueClose, int wedOpen, int wedClose, int thuOpen,
088: int thuClose, int friOpen, int friClose, int satOpen,
089: int satClose) throws PortalException, SystemException {
090:
091: OrgLabor orgLabor = orgLaborPersistence
092: .findByPrimaryKey(orgLaborId);
093:
094: checkPermission(orgLabor.getOrganizationId(), ActionKeys.UPDATE);
095:
096: return orgLaborLocalService.updateOrgLabor(orgLaborId, sunOpen,
097: sunClose, monOpen, monClose, tueOpen, tueClose,
098: wedOpen, wedClose, thuOpen, thuClose, friOpen,
099: friClose, satOpen, satClose);
100: }
101:
102: protected void checkPermission(long organizationId, String actionId)
103: throws PortalException, SystemException {
104:
105: OrganizationPermissionUtil.check(getPermissionChecker(),
106: organizationId, actionId);
107: }
108:
109: }
|