001
014
015 package com.liferay.portal.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.model.OrgLabor;
020 import com.liferay.portal.security.permission.ActionKeys;
021 import com.liferay.portal.service.base.OrgLaborServiceBaseImpl;
022 import com.liferay.portal.service.permission.OrganizationPermissionUtil;
023
024 import java.util.List;
025
026
029 public class OrgLaborServiceImpl extends OrgLaborServiceBaseImpl {
030
031 public OrgLabor addOrgLabor(
032 long organizationId, int typeId, int sunOpen, int sunClose,
033 int monOpen, int monClose, int tueOpen, int tueClose, int wedOpen,
034 int wedClose, int thuOpen, int thuClose, int friOpen, int friClose,
035 int satOpen, int satClose)
036 throws PortalException, SystemException {
037
038 OrganizationPermissionUtil.check(
039 getPermissionChecker(), organizationId, ActionKeys.UPDATE);
040
041 return orgLaborLocalService.addOrgLabor(
042 organizationId, typeId, sunOpen, sunClose, monOpen, monClose,
043 tueOpen, tueClose, wedOpen, wedClose, thuOpen, thuClose, friOpen,
044 friClose, satOpen, satClose);
045 }
046
047 public void deleteOrgLabor(long orgLaborId)
048 throws PortalException, SystemException {
049
050 OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
051
052 OrganizationPermissionUtil.check(
053 getPermissionChecker(), orgLabor.getOrganizationId(),
054 ActionKeys.UPDATE);
055
056 orgLaborLocalService.deleteOrgLabor(orgLaborId);
057 }
058
059 public OrgLabor getOrgLabor(long orgLaborId)
060 throws PortalException, SystemException {
061
062 OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
063
064 OrganizationPermissionUtil.check(
065 getPermissionChecker(), orgLabor.getOrganizationId(),
066 ActionKeys.VIEW);
067
068 return orgLabor;
069 }
070
071 public List<OrgLabor> getOrgLabors(long organizationId)
072 throws PortalException, SystemException {
073
074 OrganizationPermissionUtil.check(
075 getPermissionChecker(), organizationId, ActionKeys.VIEW);
076
077 return orgLaborLocalService.getOrgLabors(organizationId);
078 }
079
080 public OrgLabor updateOrgLabor(
081 long orgLaborId, int typeId, int sunOpen, int sunClose, int monOpen,
082 int monClose, int tueOpen, int tueClose, int wedOpen, int wedClose,
083 int thuOpen, int thuClose, int friOpen, int friClose, int satOpen,
084 int satClose)
085 throws PortalException, SystemException {
086
087 OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
088
089 OrganizationPermissionUtil.check(
090 getPermissionChecker(), orgLabor.getOrganizationId(),
091 ActionKeys.UPDATE);
092
093 return orgLaborLocalService.updateOrgLabor(
094 orgLaborId, typeId ,sunOpen, sunClose, monOpen, monClose, tueOpen,
095 tueClose, wedOpen, wedClose, thuOpen, thuClose, friOpen, friClose,
096 satOpen, satClose);
097 }
098
099 }