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);
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 getOrgLabors(long organizationId) throws SystemException {
91 return orgLaborPersistence.findByOrganizationId(organizationId);
92 }
93
94 public OrgLabor updateOrgLabor(
95 long orgLaborId, 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 OrgLabor orgLabor = orgLaborPersistence.findByPrimaryKey(orgLaborId);
102
103 orgLabor.setSunOpen(sunOpen);
104 orgLabor.setSunClose(sunClose);
105 orgLabor.setMonOpen(monOpen);
106 orgLabor.setMonClose(monClose);
107 orgLabor.setTueOpen(tueOpen);
108 orgLabor.setTueClose(tueClose);
109 orgLabor.setWedOpen(wedOpen);
110 orgLabor.setWedClose(wedClose);
111 orgLabor.setThuOpen(thuOpen);
112 orgLabor.setThuClose(thuClose);
113 orgLabor.setFriOpen(friOpen);
114 orgLabor.setFriClose(friClose);
115 orgLabor.setSatOpen(satOpen);
116 orgLabor.setSatClose(satClose);
117
118 orgLaborPersistence.update(orgLabor);
119
120 return orgLabor;
121 }
122
123 protected void validate(int typeId)
124 throws PortalException, SystemException {
125
126 try {
127 listTypeService.validate(typeId, ListTypeImpl.ORGANIZATION_SERVICE);
128 }
129 catch (RemoteException re) {
130 throw new SystemException(re);
131 }
132 }
133
134 }