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.kernel.security.permission.ActionKeys;
026: import com.liferay.portal.model.Website;
027: import com.liferay.portal.service.base.WebsiteServiceBaseImpl;
028: import com.liferay.portal.service.permission.CommonPermissionUtil;
029:
030: import java.util.List;
031:
032: /**
033: * <a href="WebsiteServiceImpl.java.html"><b><i>View Source</i></b></a>
034: *
035: * @author Brian Wing Shun Chan
036: *
037: */
038: public class WebsiteServiceImpl extends WebsiteServiceBaseImpl {
039:
040: public Website addWebsite(String className, long classPK,
041: String url, int typeId, boolean primary)
042: throws PortalException, SystemException {
043:
044: CommonPermissionUtil.check(getPermissionChecker(), className,
045: classPK, ActionKeys.UPDATE);
046:
047: return websiteLocalService.addWebsite(getUserId(), className,
048: classPK, url, typeId, primary);
049: }
050:
051: public void deleteWebsite(long websiteId) throws PortalException,
052: SystemException {
053:
054: Website website = websitePersistence
055: .findByPrimaryKey(websiteId);
056:
057: CommonPermissionUtil.check(getPermissionChecker(), website
058: .getClassNameId(), website.getClassPK(),
059: ActionKeys.UPDATE);
060:
061: websiteLocalService.deleteWebsite(websiteId);
062: }
063:
064: public Website getWebsite(long websiteId) throws PortalException,
065: SystemException {
066:
067: Website website = websitePersistence
068: .findByPrimaryKey(websiteId);
069:
070: CommonPermissionUtil.check(getPermissionChecker(), website
071: .getClassNameId(), website.getClassPK(),
072: ActionKeys.VIEW);
073:
074: return website;
075: }
076:
077: public List getWebsites(String className, long classPK)
078: throws PortalException, SystemException {
079:
080: CommonPermissionUtil.check(getPermissionChecker(), className,
081: classPK, ActionKeys.VIEW);
082:
083: return websiteLocalService.getWebsites(
084: getUser().getCompanyId(), className, classPK);
085: }
086:
087: public Website updateWebsite(long websiteId, String url,
088: int typeId, boolean primary) throws PortalException,
089: SystemException {
090:
091: Website website = websitePersistence
092: .findByPrimaryKey(websiteId);
093:
094: CommonPermissionUtil.check(getPermissionChecker(), website
095: .getClassNameId(), website.getClassPK(),
096: ActionKeys.UPDATE);
097:
098: return websiteLocalService.updateWebsite(websiteId, url,
099: typeId, primary);
100: }
101:
102: }
|