com.liferay.portlet.dynamicdatamapping.service.impl.DDMStorageLinkLocalServiceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of portal-impl Show documentation
Show all versions of portal-impl Show documentation
Contains implementation for the portal services.
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.portlet.dynamicdatamapping.service.impl;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portlet.dynamicdatamapping.model.DDMStorageLink;
import com.liferay.portlet.dynamicdatamapping.service.base.DDMStorageLinkLocalServiceBaseImpl;
import java.util.List;
/**
* @author Brian Wing Shun Chan
* @author Eduardo Lundgren
*/
public class DDMStorageLinkLocalServiceImpl
extends DDMStorageLinkLocalServiceBaseImpl {
@Override
public DDMStorageLink addStorageLink(
long classNameId, long classPK, long structureId,
ServiceContext serviceContext)
throws SystemException {
long storageLinkId = counterLocalService.increment();
DDMStorageLink storageLink = ddmStorageLinkPersistence.create(
storageLinkId);
storageLink.setClassNameId(classNameId);
storageLink.setClassPK(classPK);
storageLink.setStructureId(structureId);
ddmStorageLinkPersistence.update(storageLink);
return storageLink;
}
@Override
public void deleteClassStorageLink(long classPK)
throws PortalException, SystemException {
DDMStorageLink storageLink = ddmStorageLinkPersistence.findByClassPK(
classPK);
deleteStorageLink(storageLink);
}
@Override
public void deleteStorageLink(DDMStorageLink storageLink)
throws SystemException {
ddmStorageLinkPersistence.remove(storageLink);
}
@Override
public void deleteStorageLink(long storageLinkId)
throws PortalException, SystemException {
DDMStorageLink storageLink = ddmStorageLinkPersistence.findByPrimaryKey(
storageLinkId);
deleteStorageLink(storageLink);
}
@Override
public void deleteStructureStorageLinks(long structureId)
throws SystemException {
List storageLinks =
ddmStorageLinkPersistence.findByStructureId(structureId);
for (DDMStorageLink storageLink : storageLinks) {
deleteStorageLink(storageLink);
}
}
@Override
public DDMStorageLink getClassStorageLink(long classPK)
throws PortalException, SystemException {
return ddmStorageLinkPersistence.findByClassPK(classPK);
}
@Override
public DDMStorageLink getStorageLink(long storageLinkId)
throws PortalException, SystemException {
return ddmStorageLinkPersistence.findByPrimaryKey(storageLinkId);
}
@Override
public List getStructureStorageLinks(long structureId)
throws SystemException {
return ddmStorageLinkPersistence.findByStructureId(structureId);
}
@Override
public int getStructureStorageLinksCount(long structureId)
throws SystemException {
return ddmStorageLinkPersistence.countByStructureId(structureId);
}
@Override
public DDMStorageLink updateStorageLink(
long storageLinkId, long classNameId, long classPK)
throws PortalException, SystemException {
DDMStorageLink storageLink = ddmStorageLinkPersistence.findByPrimaryKey(
storageLinkId);
storageLink.setClassNameId(classNameId);
storageLink.setClassPK(classPK);
ddmStorageLinkPersistence.update(storageLink);
return storageLink;
}
}