001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.impl;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025: import com.liferay.portal.model.OrgLabor;
026: import com.liferay.portal.model.impl.ListTypeImpl;
027: import com.liferay.portal.service.base.OrgLaborLocalServiceBaseImpl;
028:
029: import java.rmi.RemoteException;
030:
031: import java.util.List;
032:
033: /**
034: * <a href="OrgLaborLocalServiceImpl.java.html"><b><i>View Source</i></b></a>
035: *
036: * @author Brian Wing Shun Chan
037: *
038: */
039: public class OrgLaborLocalServiceImpl extends
040: OrgLaborLocalServiceBaseImpl {
041:
042: public OrgLabor addOrgLabor(long organizationId, int typeId,
043: int sunOpen, int sunClose, int monOpen, int monClose,
044: int tueOpen, int tueClose, int wedOpen, int wedClose,
045: int thuOpen, int thuClose, int friOpen, int friClose,
046: int satOpen, int satClose) throws PortalException,
047: SystemException {
048:
049: validate(typeId);
050:
051: long orgLaborId = counterLocalService.increment();
052:
053: OrgLabor orgLabor = orgLaborPersistence.create(orgLaborId);
054:
055: orgLabor.setOrganizationId(organizationId);
056: orgLabor.setTypeId(typeId);
057: orgLabor.setSunOpen(sunOpen);
058: orgLabor.setSunClose(sunClose);
059: orgLabor.setMonOpen(monOpen);
060: orgLabor.setMonClose(monClose);
061: orgLabor.setTueOpen(tueOpen);
062: orgLabor.setTueClose(tueClose);
063: orgLabor.setWedOpen(wedOpen);
064: orgLabor.setWedClose(wedClose);
065: orgLabor.setThuOpen(thuOpen);
066: orgLabor.setThuClose(thuClose);
067: orgLabor.setFriOpen(friOpen);
068: orgLabor.setFriClose(friClose);
069: orgLabor.setSatOpen(satOpen);
070: orgLabor.setSatClose(satClose);
071:
072: orgLaborPersistence.update(orgLabor);
073:
074: return orgLabor;
075: }
076:
077: public void deleteOrgLabor(long orgLaborId) throws PortalException,
078: SystemException {
079:
080: orgLaborPersistence.remove(orgLaborId);
081: }
082:
083: public OrgLabor getOrgLabor(long orgLaborId)
084: throws PortalException, SystemException {
085:
086: return orgLaborPersistence.findByPrimaryKey(orgLaborId);
087: }
088:
089: public List getOrgLabors(long organizationId)
090: throws SystemException {
091: return orgLaborPersistence.findByOrganizationId(organizationId);
092: }
093:
094: public OrgLabor updateOrgLabor(long orgLaborId, int sunOpen,
095: int sunClose, int monOpen, int monClose, int tueOpen,
096: int tueClose, int wedOpen, int wedClose, int thuOpen,
097: int thuClose, int friOpen, int friClose, int satOpen,
098: int satClose) throws PortalException, SystemException {
099:
100: OrgLabor orgLabor = orgLaborPersistence
101: .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) throws PortalException,
124: SystemException {
125:
126: try {
127: listTypeService.validate(typeId,
128: ListTypeImpl.ORGANIZATION_SERVICE);
129: } catch (RemoteException re) {
130: throw new SystemException(re);
131: }
132: }
133:
134: }
|