001
014
015 package com.liferay.portal.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.model.OrgLabor;
019 import com.liferay.portal.security.permission.ActionKeys;
020 import com.liferay.portal.service.base.OrgLaborServiceBaseImpl;
021 import com.liferay.portal.service.permission.OrganizationPermissionUtil;
022
023 import java.util.List;
024
025
028 public class OrgLaborServiceImpl extends OrgLaborServiceBaseImpl {
029
030 @Override
031 public OrgLabor addOrgLabor(
032 long organizationId, long 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 {
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 @Override
048 public void deleteOrgLabor(long orgLaborId) throws PortalException {
049 OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
050
051 OrganizationPermissionUtil.check(
052 getPermissionChecker(), orgLabor.getOrganizationId(),
053 ActionKeys.UPDATE);
054
055 orgLaborLocalService.deleteOrgLabor(orgLaborId);
056 }
057
058 @Override
059 public OrgLabor getOrgLabor(long orgLaborId) throws PortalException {
060 OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
061
062 OrganizationPermissionUtil.check(
063 getPermissionChecker(), orgLabor.getOrganizationId(),
064 ActionKeys.VIEW);
065
066 return orgLabor;
067 }
068
069 @Override
070 public List<OrgLabor> getOrgLabors(long organizationId)
071 throws PortalException {
072
073 OrganizationPermissionUtil.check(
074 getPermissionChecker(), organizationId, ActionKeys.VIEW);
075
076 return orgLaborLocalService.getOrgLabors(organizationId);
077 }
078
079 @Override
080 public OrgLabor updateOrgLabor(
081 long orgLaborId, long typeId, int sunOpen, int sunClose,
082 int monOpen, int monClose, int tueOpen, int tueClose, int wedOpen,
083 int wedClose, int thuOpen, int thuClose, int friOpen, int friClose,
084 int satOpen, int satClose)
085 throws PortalException {
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 }