001
014
015 package com.liferay.portlet.dynamicdatamapping.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.service.ServiceContext;
020 import com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink;
021 import com.liferay.portlet.dynamicdatamapping.service.base.DDMStructureLinkLocalServiceBaseImpl;
022
023 import java.util.List;
024
025
029 public class DDMStructureLinkLocalServiceImpl
030 extends DDMStructureLinkLocalServiceBaseImpl {
031
032 @Override
033 public DDMStructureLink addStructureLink(
034 long classNameId, long classPK, long structureId,
035 ServiceContext serviceContext)
036 throws SystemException {
037
038 long structureLinkId = counterLocalService.increment();
039
040 DDMStructureLink structureLink = ddmStructureLinkPersistence.create(
041 structureLinkId);
042
043 structureLink.setClassNameId(classNameId);
044 structureLink.setClassPK(classPK);
045 structureLink.setStructureId(structureId);
046
047 ddmStructureLinkPersistence.update(structureLink, false);
048
049 return structureLink;
050 }
051
052 @Override
053 public void deleteClassStructureLink(long classPK)
054 throws PortalException, SystemException {
055
056 DDMStructureLink structureLink =
057 ddmStructureLinkPersistence.findByClassPK(classPK);
058
059 deleteStructureLink(structureLink);
060 }
061
062 @Override
063 public void deleteStructureLink(DDMStructureLink structureLink)
064 throws SystemException {
065
066 ddmStructureLinkPersistence.remove(structureLink);
067 }
068
069 @Override
070 public void deleteStructureLink(long structureLinkId)
071 throws PortalException, SystemException {
072
073 DDMStructureLink structureLink =
074 ddmStructureLinkPersistence.findByPrimaryKey(structureLinkId);
075
076 deleteStructureLink(structureLink);
077 }
078
079 @Override
080 public void deleteStructureStructureLinks(long structureId)
081 throws SystemException {
082
083 List<DDMStructureLink> structureLinks =
084 ddmStructureLinkPersistence.findByStructureId(structureId);
085
086 for (DDMStructureLink structureLink : structureLinks) {
087 deleteStructureLink(structureLink);
088 }
089 }
090
091 @Override
092 public DDMStructureLink getClassStructureLink(long classPK)
093 throws PortalException, SystemException {
094
095 return ddmStructureLinkPersistence.findByClassPK(classPK);
096 }
097
098 @Override
099 public List<DDMStructureLink> getClassStructureLinks(long classNameId)
100 throws SystemException {
101
102 return ddmStructureLinkPersistence.findByStructureId(classNameId);
103 }
104
105 @Override
106 public DDMStructureLink getStructureLink(long structureLinkId)
107 throws PortalException, SystemException {
108
109 return ddmStructureLinkPersistence.findByPrimaryKey(structureLinkId);
110 }
111
112 @Override
113 public List<DDMStructureLink> getStructureLinks(
114 long structureId, int start, int end)
115 throws SystemException {
116
117 return ddmStructureLinkPersistence.findByStructureId(
118 structureId, start, end);
119 }
120
121 @Override
122 public DDMStructureLink updateStructureLink(
123 long structureLinkId, long classNameId, long classPK,
124 long structureId)
125 throws PortalException, SystemException {
126
127 DDMStructureLink structureLink =
128 ddmStructureLinkPersistence.findByPrimaryKey(structureLinkId);
129
130 structureLink.setClassNameId(classNameId);
131 structureLink.setClassPK(classPK);
132 structureLink.setStructureId(structureId);
133
134 ddmStructureLinkPersistence.update(structureLink, false);
135
136 return structureLink;
137 }
138
139 }