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.ListTypeConstants;
020 import com.liferay.portal.model.OrgLabor;
021 import com.liferay.portal.service.base.OrgLaborLocalServiceBaseImpl;
022
023 import java.util.List;
024
025
028 public class OrgLaborLocalServiceImpl extends OrgLaborLocalServiceBaseImpl {
029
030 public OrgLabor addOrgLabor(
031 long organizationId, int typeId, int sunOpen, int sunClose,
032 int monOpen, int monClose, int tueOpen, int tueClose, int wedOpen,
033 int wedClose, int thuOpen, int thuClose, int friOpen, int friClose,
034 int satOpen, int satClose)
035 throws PortalException, SystemException {
036
037 validate(typeId);
038
039 long orgLaborId = counterLocalService.increment();
040
041 OrgLabor orgLabor = orgLaborPersistence.create(orgLaborId);
042
043 orgLabor.setOrganizationId(organizationId);
044 orgLabor.setTypeId(typeId);
045 orgLabor.setSunOpen(sunOpen);
046 orgLabor.setSunClose(sunClose);
047 orgLabor.setMonOpen(monOpen);
048 orgLabor.setMonClose(monClose);
049 orgLabor.setTueOpen(tueOpen);
050 orgLabor.setTueClose(tueClose);
051 orgLabor.setWedOpen(wedOpen);
052 orgLabor.setWedClose(wedClose);
053 orgLabor.setThuOpen(thuOpen);
054 orgLabor.setThuClose(thuClose);
055 orgLabor.setFriOpen(friOpen);
056 orgLabor.setFriClose(friClose);
057 orgLabor.setSatOpen(satOpen);
058 orgLabor.setSatClose(satClose);
059
060 orgLaborPersistence.update(orgLabor, false);
061
062 return orgLabor;
063 }
064
065 public void deleteOrgLabor(long orgLaborId)
066 throws PortalException, SystemException {
067
068 orgLaborPersistence.remove(orgLaborId);
069 }
070
071 public OrgLabor getOrgLabor(long orgLaborId)
072 throws PortalException, SystemException {
073
074 return orgLaborPersistence.findByPrimaryKey(orgLaborId);
075 }
076
077 public List<OrgLabor> getOrgLabors(long organizationId)
078 throws SystemException {
079
080 return orgLaborPersistence.findByOrganizationId(organizationId);
081 }
082
083 public OrgLabor updateOrgLabor(
084 long orgLaborId, int typeId, int sunOpen, int sunClose, int monOpen,
085 int monClose, int tueOpen, int tueClose, int wedOpen, int wedClose,
086 int thuOpen, int thuClose, int friOpen, int friClose, int satOpen,
087 int satClose)
088 throws PortalException, SystemException {
089
090 validate(typeId);
091
092 OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
093
094 orgLabor.setTypeId(typeId);
095 orgLabor.setSunOpen(sunOpen);
096 orgLabor.setSunClose(sunClose);
097 orgLabor.setMonOpen(monOpen);
098 orgLabor.setMonClose(monClose);
099 orgLabor.setTueOpen(tueOpen);
100 orgLabor.setTueClose(tueClose);
101 orgLabor.setWedOpen(wedOpen);
102 orgLabor.setWedClose(wedClose);
103 orgLabor.setThuOpen(thuOpen);
104 orgLabor.setThuClose(thuClose);
105 orgLabor.setFriOpen(friOpen);
106 orgLabor.setFriClose(friClose);
107 orgLabor.setSatOpen(satOpen);
108 orgLabor.setSatClose(satClose);
109
110 orgLaborPersistence.update(orgLabor, false);
111
112 return orgLabor;
113 }
114
115 protected void validate(int typeId)
116 throws PortalException, SystemException {
117
118 listTypeService.validate(
119 typeId, ListTypeConstants.ORGANIZATION_SERVICE);
120 }
121
122 }