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