001
014
015 package com.liferay.portlet.journal.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.OrderByComparator;
020 import com.liferay.portal.security.permission.ActionKeys;
021 import com.liferay.portal.service.ServiceContext;
022 import com.liferay.portlet.journal.model.JournalStructure;
023 import com.liferay.portlet.journal.service.base.JournalStructureServiceBaseImpl;
024 import com.liferay.portlet.journal.service.permission.JournalPermission;
025 import com.liferay.portlet.journal.service.permission.JournalStructurePermission;
026
027 import java.util.List;
028 import java.util.Locale;
029 import java.util.Map;
030
031
035 public class JournalStructureServiceImpl
036 extends JournalStructureServiceBaseImpl {
037
038 public JournalStructure addStructure(
039 long groupId, String structureId, boolean autoStructureId,
040 String parentStructureId, Map<Locale, String> nameMap,
041 Map<Locale, String> descriptionMap, String xsd,
042 ServiceContext serviceContext)
043 throws PortalException, SystemException {
044
045 JournalPermission.check(
046 getPermissionChecker(), groupId, ActionKeys.ADD_STRUCTURE);
047
048 return journalStructureLocalService.addStructure(
049 getUserId(), groupId, structureId, autoStructureId,
050 parentStructureId, nameMap, descriptionMap, xsd, serviceContext);
051 }
052
053 public JournalStructure copyStructure(
054 long groupId, String oldStructureId, String newStructureId,
055 boolean autoStructureId)
056 throws PortalException, SystemException {
057
058 JournalPermission.check(
059 getPermissionChecker(), groupId, ActionKeys.ADD_STRUCTURE);
060
061 return journalStructureLocalService.copyStructure(
062 getUserId(), groupId, oldStructureId, newStructureId,
063 autoStructureId);
064 }
065
066 public void deleteStructure(long groupId, String structureId)
067 throws PortalException, SystemException {
068
069 JournalStructurePermission.check(
070 getPermissionChecker(), groupId, structureId, ActionKeys.DELETE);
071
072 journalStructureLocalService.deleteStructure(groupId, structureId);
073 }
074
075 public JournalStructure getStructure(long groupId, String structureId)
076 throws PortalException, SystemException {
077
078 JournalStructurePermission.check(
079 getPermissionChecker(), groupId, structureId, ActionKeys.VIEW);
080
081 return journalStructureLocalService.getStructure(groupId, structureId);
082 }
083
084 public JournalStructure getStructure(
085 long groupId, String structureId, boolean includeGlobalStructures)
086 throws PortalException, SystemException {
087
088 JournalStructurePermission.check(
089 getPermissionChecker(), groupId, structureId, ActionKeys.VIEW);
090
091 return journalStructureLocalService.getStructure(
092 groupId, structureId, includeGlobalStructures);
093 }
094
095 public List<JournalStructure> getStructures(long groupId)
096 throws SystemException {
097
098 return journalStructurePersistence.filterFindByGroupId(groupId);
099 }
100
101 public List<JournalStructure> getStructures(long[] groupIds)
102 throws SystemException {
103
104 return journalStructurePersistence.filterFindByGroupId(groupIds);
105 }
106
107 public List<JournalStructure> search(
108 long companyId, long[] groupIds, String keywords, int start,
109 int end, OrderByComparator obc)
110 throws SystemException {
111
112 return journalStructureFinder.filterFindByKeywords(
113 companyId, groupIds, keywords, start, end, obc);
114 }
115
116 public List<JournalStructure> search(
117 long companyId, long[] groupIds, String structureId, String name,
118 String description, boolean andOperator, int start, int end,
119 OrderByComparator obc)
120 throws SystemException {
121
122 return journalStructureFinder.filterFindByC_G_S_N_D(
123 companyId, groupIds, structureId, name, description, andOperator,
124 start, end, obc);
125 }
126
127 public int searchCount(long companyId, long[] groupIds, String keywords)
128 throws SystemException {
129
130 return journalStructureFinder.filterCountByKeywords(
131 companyId, groupIds, keywords);
132 }
133
134 public int searchCount(
135 long companyId, long[] groupIds, String structureId, String name,
136 String description, boolean andOperator)
137 throws SystemException {
138
139 return journalStructureFinder.filterCountByC_G_S_N_D(
140 companyId, groupIds, structureId, name, description, andOperator);
141 }
142
143 public JournalStructure updateStructure(
144 long groupId, String structureId, String parentStructureId,
145 Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
146 String xsd, ServiceContext serviceContext)
147 throws PortalException, SystemException {
148
149 JournalStructurePermission.check(
150 getPermissionChecker(), groupId, structureId, ActionKeys.UPDATE);
151
152 return journalStructureLocalService.updateStructure(
153 groupId, structureId, parentStructureId, nameMap, descriptionMap,
154 xsd, serviceContext);
155 }
156
157 }