1
22
23 package com.liferay.portal.service.impl;
24
25 import com.liferay.counter.service.CounterLocalServiceUtil;
26 import com.liferay.portal.PortalException;
27 import com.liferay.portal.SystemException;
28 import com.liferay.portal.model.OrgLabor;
29 import com.liferay.portal.model.impl.ListTypeImpl;
30 import com.liferay.portal.service.ListTypeServiceUtil;
31 import com.liferay.portal.service.base.OrgLaborLocalServiceBaseImpl;
32 import com.liferay.portal.service.persistence.OrgLaborUtil;
33
34 import java.rmi.RemoteException;
35
36 import java.util.List;
37
38
44 public class OrgLaborLocalServiceImpl extends OrgLaborLocalServiceBaseImpl {
45
46 public OrgLabor addOrgLabor(
47 long organizationId, int typeId, int sunOpen, int sunClose,
48 int monOpen, int monClose, int tueOpen, int tueClose, int wedOpen,
49 int wedClose, int thuOpen, int thuClose, int friOpen, int friClose,
50 int satOpen, int satClose)
51 throws PortalException, SystemException {
52
53 validate(typeId);
54
55 long orgLaborId = CounterLocalServiceUtil.increment();
56
57 OrgLabor orgLabor = OrgLaborUtil.create(orgLaborId);
58
59 orgLabor.setOrganizationId(organizationId);
60 orgLabor.setTypeId(typeId);
61 orgLabor.setSunOpen(sunOpen);
62 orgLabor.setSunClose(sunClose);
63 orgLabor.setMonOpen(monOpen);
64 orgLabor.setMonClose(monClose);
65 orgLabor.setTueOpen(tueOpen);
66 orgLabor.setTueClose(tueClose);
67 orgLabor.setWedOpen(wedOpen);
68 orgLabor.setWedClose(wedClose);
69 orgLabor.setThuOpen(thuOpen);
70 orgLabor.setThuClose(thuClose);
71 orgLabor.setFriOpen(friOpen);
72 orgLabor.setFriClose(friClose);
73 orgLabor.setSatOpen(satOpen);
74 orgLabor.setSatClose(satClose);
75
76 OrgLaborUtil.update(orgLabor);
77
78 return orgLabor;
79 }
80
81 public void deleteOrgLabor(long orgLaborId)
82 throws PortalException, SystemException {
83
84 OrgLaborUtil.remove(orgLaborId);
85 }
86
87 public OrgLabor getOrgLabor(long orgLaborId)
88 throws PortalException, SystemException {
89
90 return OrgLaborUtil.findByPrimaryKey(orgLaborId);
91 }
92
93 public List getOrgLabors(long organizationId) throws SystemException {
94 return OrgLaborUtil.findByOrganizationId(organizationId);
95 }
96
97 public OrgLabor updateOrgLabor(
98 long orgLaborId, int sunOpen, int sunClose, int monOpen,
99 int monClose, int tueOpen, int tueClose, int wedOpen, int wedClose,
100 int thuOpen, int thuClose, int friOpen, int friClose, int satOpen,
101 int satClose)
102 throws PortalException, SystemException {
103
104 OrgLabor orgLabor = OrgLaborUtil.findByPrimaryKey(orgLaborId);
105
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 OrgLaborUtil.update(orgLabor);
122
123 return orgLabor;
124 }
125
126 protected void validate(int typeId)
127 throws PortalException, SystemException {
128
129 try {
130 ListTypeServiceUtil.validate(
131 typeId, ListTypeImpl.ORGANIZATION_SERVICE);
132 }
133 catch (RemoteException re) {
134 throw new SystemException(re);
135 }
136 }
137
138 }