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