1
22
23 package com.liferay.portal.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.model.OrgLabor;
28 import com.liferay.portal.model.impl.ListTypeImpl;
29 import com.liferay.portal.service.base.OrgLaborLocalServiceBaseImpl;
30
31 import java.util.List;
32
33
39 public class OrgLaborLocalServiceImpl extends OrgLaborLocalServiceBaseImpl {
40
41 public OrgLabor addOrgLabor(
42 long organizationId, int typeId, int sunOpen, int sunClose,
43 int monOpen, int monClose, int tueOpen, int tueClose, int wedOpen,
44 int wedClose, int thuOpen, int thuClose, int friOpen, int friClose,
45 int satOpen, int satClose)
46 throws PortalException, SystemException {
47
48 validate(typeId);
49
50 long orgLaborId = counterLocalService.increment();
51
52 OrgLabor orgLabor = orgLaborPersistence.create(orgLaborId);
53
54 orgLabor.setOrganizationId(organizationId);
55 orgLabor.setTypeId(typeId);
56 orgLabor.setSunOpen(sunOpen);
57 orgLabor.setSunClose(sunClose);
58 orgLabor.setMonOpen(monOpen);
59 orgLabor.setMonClose(monClose);
60 orgLabor.setTueOpen(tueOpen);
61 orgLabor.setTueClose(tueClose);
62 orgLabor.setWedOpen(wedOpen);
63 orgLabor.setWedClose(wedClose);
64 orgLabor.setThuOpen(thuOpen);
65 orgLabor.setThuClose(thuClose);
66 orgLabor.setFriOpen(friOpen);
67 orgLabor.setFriClose(friClose);
68 orgLabor.setSatOpen(satOpen);
69 orgLabor.setSatClose(satClose);
70
71 orgLaborPersistence.update(orgLabor, false);
72
73 return orgLabor;
74 }
75
76 public void deleteOrgLabor(long orgLaborId)
77 throws PortalException, SystemException {
78
79 orgLaborPersistence.remove(orgLaborId);
80 }
81
82 public OrgLabor getOrgLabor(long orgLaborId)
83 throws PortalException, SystemException {
84
85 return orgLaborPersistence.findByPrimaryKey(orgLaborId);
86 }
87
88 public List<OrgLabor> getOrgLabors(long organizationId)
89 throws SystemException {
90
91 return orgLaborPersistence.findByOrganizationId(organizationId);
92 }
93
94 public OrgLabor updateOrgLabor(
95 long orgLaborId, int typeId, int sunOpen, int sunClose, int monOpen,
96 int monClose, int tueOpen, int tueClose, int wedOpen, int wedClose,
97 int thuOpen, int thuClose, int friOpen, int friClose, int satOpen,
98 int satClose)
99 throws PortalException, SystemException {
100
101 validate(typeId);
102
103 OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
104
105 orgLabor.setTypeId(typeId);
106 orgLabor.setSunOpen(sunOpen);
107 orgLabor.setSunClose(sunClose);
108 orgLabor.setMonOpen(monOpen);
109 orgLabor.setMonClose(monClose);
110 orgLabor.setTueOpen(tueOpen);
111 orgLabor.setTueClose(tueClose);
112 orgLabor.setWedOpen(wedOpen);
113 orgLabor.setWedClose(wedClose);
114 orgLabor.setThuOpen(thuOpen);
115 orgLabor.setThuClose(thuClose);
116 orgLabor.setFriOpen(friOpen);
117 orgLabor.setFriClose(friClose);
118 orgLabor.setSatOpen(satOpen);
119 orgLabor.setSatClose(satClose);
120
121 orgLaborPersistence.update(orgLabor, false);
122
123 return orgLabor;
124 }
125
126 protected void validate(int typeId)
127 throws PortalException, SystemException {
128
129 listTypeService.validate(typeId, ListTypeImpl.ORGANIZATION_SERVICE);
130 }
131
132 }